mirror of
https://github.com/openharmony/third_party_rust_rust.git
synced 2026-07-20 22:57:39 -04:00
rename MPlaceTy::dangling to fake_alloc_zst
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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),
|
||||
|
||||
Reference in New Issue
Block a user