Monomorphize types when not going through layout_of_local

This commit is contained in:
Oliver Scherer 2019-01-30 15:42:00 +01:00
parent 7017927aaf
commit 4e0af1fee1
2 changed files with 3 additions and 2 deletions

View file

@ -510,7 +510,8 @@ impl<'a, 'mir, 'tcx: 'mir, M: Machine<'a, 'mir, 'tcx>> EvalContext<'a, 'mir, 'tc
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));
}

View file

@ -624,7 +624,7 @@ where
// 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),
},