1
Fork 0

rename MPlaceTy::dangling to fake_alloc_zst

This commit is contained in:
Ralf Jung 2022-07-14 11:40:47 -04:00
parent 874a130ca0
commit e3ef4fdac9
2 changed files with 4 additions and 2 deletions

View file

@ -188,8 +188,10 @@ impl<Tag: Provenance> Place<Tag> {
impl<'tcx, Tag: Provenance> MPlaceTy<'tcx, Tag> {
/// Produces a MemPlace that works for ZST but nothing else.
/// Conceptually this is a new allocation, but it doesn't actually create an allocation so you
/// don't need to worry about memory leaks.
#[inline]
pub fn dangling(layout: TyAndLayout<'tcx>) -> Self {
pub fn fake_alloc_zst(layout: TyAndLayout<'tcx>) -> Self {
assert!(layout.is_zst());
let align = layout.align.abi;
let ptr = Pointer::from_addr(align.bytes()); // no provenance, absolute address

View file

@ -617,7 +617,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
place.to_ref(self),
self.layout_of(self.tcx.mk_mut_ptr(place.layout.ty))?,
);
let ret = MPlaceTy::dangling(self.layout_of(self.tcx.types.unit)?);
let ret = MPlaceTy::fake_alloc_zst(self.layout_of(self.tcx.types.unit)?);
self.eval_fn_call(
FnVal::Instance(instance),