Forward some layouts to prevent recomputation

This commit is contained in:
Oli Scherer 2021-03-30 16:08:53 +00:00
parent dbacfbc368
commit 4e8edfb5c2
2 changed files with 2 additions and 2 deletions

View file

@ -171,7 +171,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
}; };
let val = let val =
self.tcx.const_eval_global_id(self.param_env, gid, Some(self.tcx.span))?; self.tcx.const_eval_global_id(self.param_env, gid, Some(self.tcx.span))?;
let val = self.const_val_to_op(val, ty, None)?; let val = self.const_val_to_op(val, ty, Some(dest.layout))?;
self.copy_op(&val, dest)?; self.copy_op(&val, dest)?;
} }

View file

@ -578,7 +578,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
) -> InterpResult<'tcx, OpTy<'tcx, M::PointerTag>> { ) -> InterpResult<'tcx, OpTy<'tcx, M::PointerTag>> {
match val { match val {
mir::ConstantKind::Ty(ct) => self.const_to_op(ct, layout), mir::ConstantKind::Ty(ct) => self.const_to_op(ct, layout),
mir::ConstantKind::Val(val, ty) => self.const_val_to_op(*val, ty, None), mir::ConstantKind::Val(val, ty) => self.const_val_to_op(*val, ty, layout),
} }
} }