Forward some layouts to prevent recomputation
This commit is contained in:
parent
dbacfbc368
commit
4e8edfb5c2
compiler/rustc_mir/src/interpret
@ -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)?;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user