Skip to content

Commit 4e0af1f

Browse files
committed
Monomorphize types when not going through layout_of_local
1 parent 7017927 commit 4e0af1f

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

src/librustc_mir/interpret/eval_context.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -510,7 +510,8 @@ impl<'a, 'mir, 'tcx: 'mir, M: Machine<'a, 'mir, 'tcx>> EvalContext<'a, 'mir, 'tc
510510
match local.state {
511511
LocalState::Live(_) => {
512512
// This needs to be properly initialized.
513-
let layout = self.layout_of(mir.local_decls[idx].ty)?;
513+
let ty = self.monomorphize(mir.local_decls[idx].ty)?;
514+
let layout = self.layout_of(ty)?;
514515
local.state = LocalState::Live(self.uninit_operand(layout)?);
515516
local.layout = Cell::new(Some(layout));
516517
}

src/librustc_mir/interpret/place.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -624,7 +624,7 @@ where
624624
// their layout on return.
625625
PlaceTy {
626626
place: *return_place,
627-
layout: self.layout_of(self.frame().mir.return_ty())?,
627+
layout: self.layout_of(self.monomorphize(self.frame().mir.return_ty())?)?,
628628
},
629629
None => return err!(InvalidNullPointerUsage),
630630
},

0 commit comments

Comments
 (0)