]> git.lizzy.rs Git - rust.git/commitdiff
Monomorphize types when not going through `layout_of_local`
authorOliver Scherer <github35764891676564198441@oli-obk.de>
Wed, 30 Jan 2019 14:42:00 +0000 (15:42 +0100)
committerOliver Scherer <github35764891676564198441@oli-obk.de>
Wed, 30 Jan 2019 14:42:00 +0000 (15:42 +0100)
src/librustc_mir/interpret/eval_context.rs
src/librustc_mir/interpret/place.rs

index 3382288b99a2530bf66b1e12d7b972ff401d3489..4bf84cb465f7783538bd342564e19e310ceceb89 100644 (file)
@@ -510,7 +510,8 @@ pub fn push_stack_frame(
                 match local.state {
                     LocalState::Live(_) => {
                         // This needs to be properly initialized.
-                        let layout = self.layout_of(mir.local_decls[idx].ty)?;
+                        let ty = self.monomorphize(mir.local_decls[idx].ty)?;
+                        let layout = self.layout_of(ty)?;
                         local.state = LocalState::Live(self.uninit_operand(layout)?);
                         local.layout = Cell::new(Some(layout));
                     }
index ba1960300a85cfc369a0cd41c492d5e09f030783..9ca7f9d8e27ff43214f0dd1817dd7339891e3b7d 100644 (file)
@@ -624,7 +624,7 @@ pub fn eval_place(
                     // their layout on return.
                     PlaceTy {
                         place: *return_place,
-                        layout: self.layout_of(self.frame().mir.return_ty())?,
+                        layout: self.layout_of(self.monomorphize(self.frame().mir.return_ty())?)?,
                     },
                 None => return err!(InvalidNullPointerUsage),
             },