]> git.lizzy.rs Git - rust.git/blobdiff - src/librustc_mir/interpret/terminator.rs
Rollup merge of #62096 - spastorino:impl-place-from, r=oli-obk,Centril
[rust.git] / src / librustc_mir / interpret / terminator.rs
index af061f968104e576725c9def03d7adc79ebc344c..13baf245d10fbeb865097e86e39419978a0823e3 100644 (file)
@@ -355,7 +355,7 @@ fn eval_fn_call(
                     let mut locals_iter = body.args_iter();
                     while let Some(local) = locals_iter.next() {
                         let dest = self.eval_place(
-                            &mir::Place::Base(mir::PlaceBase::Local(local))
+                            &mir::Place::from(local)
                         )?;
                         if Some(local) == body.spread_arg {
                             // Must be a tuple
@@ -388,12 +388,10 @@ fn eval_fn_call(
                             ));
                         }
                     } else {
-                        let callee_layout =
-                            self.layout_of_local(self.frame(), mir::RETURN_PLACE, None)?;
-                        if !callee_layout.abi.is_uninhabited() {
-                            return err!(FunctionRetMismatch(
-                                self.tcx.types.never, callee_layout.ty
-                            ));
+                        let local = mir::RETURN_PLACE;
+                        let ty = self.frame().body.local_decls[local].ty;
+                        if !self.tcx.is_ty_uninhabited_from_any_module(ty) {
+                            return err!(FunctionRetMismatch(self.tcx.types.never, ty));
                         }
                     }
                     Ok(())