about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbjorn3 <bjorn3@users.noreply.github.com>2021-07-28 18:31:27 +0200
committerbjorn3 <bjorn3@users.noreply.github.com>2021-07-28 18:31:27 +0200
commitb7881bb08d129a119c69ca79999cae54cef3efb4 (patch)
treeeb5d45b75131e3612ba5dc535ea2f49b89c67546
parent8704a66922e9fbe3fafb4d27eeb13b34e8cebd82 (diff)
downloadrust-b7881bb08d129a119c69ca79999cae54cef3efb4.tar.gz
rust-b7881bb08d129a119c69ca79999cae54cef3efb4.zip
Remove CPlace::no_place
It is never the right function
-rw-r--r--src/abi/returning.rs3
-rw-r--r--src/value_and_place.rs9
2 files changed, 5 insertions, 7 deletions
diff --git a/src/abi/returning.rs b/src/abi/returning.rs
index 3b126938f14..f9fc3992ae2 100644
--- a/src/abi/returning.rs
+++ b/src/abi/returning.rs
@@ -58,8 +58,7 @@ pub(super) fn codegen_return_param<'tcx>(
     block_params_iter: &mut impl Iterator<Item = Value>,
 ) -> CPlace<'tcx> {
     let (ret_place, ret_param): (_, SmallVec<[_; 2]>) = match fx.fn_abi.as_ref().unwrap().ret.mode {
-        PassMode::Ignore => (CPlace::no_place(fx.fn_abi.as_ref().unwrap().ret.layout), smallvec![]),
-        PassMode::Direct(_) | PassMode::Pair(_, _) | PassMode::Cast(_) => {
+        PassMode::Ignore | PassMode::Direct(_) | PassMode::Pair(_, _) | PassMode::Cast(_) => {
             let is_ssa = ssa_analyzed[RETURN_PLACE] == crate::analyze::SsaKind::Ssa;
             (
                 super::make_local_place(
diff --git a/src/value_and_place.rs b/src/value_and_place.rs
index d1b66ab02e1..364b3da92b8 100644
--- a/src/value_and_place.rs
+++ b/src/value_and_place.rs
@@ -318,17 +318,16 @@ impl<'tcx> CPlace<'tcx> {
         &self.inner
     }
 
-    pub(crate) fn no_place(layout: TyAndLayout<'tcx>) -> CPlace<'tcx> {
-        CPlace { inner: CPlaceInner::Addr(Pointer::dangling(layout.align.pref), None), layout }
-    }
-
     pub(crate) fn new_stack_slot(
         fx: &mut FunctionCx<'_, '_, 'tcx>,
         layout: TyAndLayout<'tcx>,
     ) -> CPlace<'tcx> {
         assert!(!layout.is_unsized());
         if layout.size.bytes() == 0 {
-            return CPlace::no_place(layout);
+            return CPlace {
+                inner: CPlaceInner::Addr(Pointer::dangling(layout.align.pref), None),
+                layout,
+            };
         }
 
         let stack_slot = fx.bcx.create_stack_slot(StackSlotData {