We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent c8baac5 commit 6b26640Copy full SHA for 6b26640
2 files changed
compiler/rustc_mir/src/interpret/eval_context.rs
@@ -18,8 +18,8 @@ use rustc_span::{Pos, Span};
18
use rustc_target::abi::{Align, HasDataLayout, LayoutOf, Size, TargetDataLayout};
19
20
use super::{
21
- Immediate, MPlaceTy, Machine, MemPlace, MemPlaceMeta, Memory, Operand, Place, PlaceTy,
22
- ScalarMaybeUninit, StackPopJump,
+ Immediate, MPlaceTy, Machine, MemPlace, MemPlaceMeta, Memory, MemoryKind, Operand, Place,
+ PlaceTy, ScalarMaybeUninit, StackPopJump,
23
};
24
use crate::transform::validate::equal_up_to_regions;
25
use crate::util::storage::AlwaysLiveLocals;
@@ -900,7 +900,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
900
// due to the local having ZST type.
901
let ptr = ptr.assert_ptr();
902
trace!("deallocating local: {:?}", self.memory.dump_alloc(ptr.alloc_id));
903
- self.memory.deallocate_local(ptr)?;
+ self.memory.deallocate(ptr, None, MemoryKind::Stack)?;
904
905
Ok(())
906
}
compiler/rustc_mir/src/interpret/memory.rs
@@ -276,17 +276,6 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> Memory<'mir, 'tcx, M> {
276
Ok(new_ptr)
277
278
279
- /// Deallocate a local, or do nothing if that local has been made into a global.
280
- pub fn deallocate_local(&mut self, ptr: Pointer<M::PointerTag>) -> InterpResult<'tcx> {
281
- // The allocation might be already removed by global interning.
282
- // This can only really happen in the CTFE instance, not in miri.
283
- if self.alloc_map.contains_key(&ptr.alloc_id) {
284
- self.deallocate(ptr, None, MemoryKind::Stack)
285
- } else {
286
- Ok(())
287
- }
288
289
-
290
pub fn deallocate(
291
&mut self,
292
ptr: Pointer<M::PointerTag>,
@@ -1110,7 +1099,11 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> Memory<'mir, 'tcx, M> {
1110
1099
1111
1100
1112
1101
// now fill in all the "init" data
1113
- dest_alloc.mark_compressed_init_range(&compressed, alloc_range(dest.offset, size), num_copies);
1102
+ dest_alloc.mark_compressed_init_range(
1103
+ &compressed,
1104
+ alloc_range(dest.offset, size),
1105
+ num_copies,
1106
+ );
1114
1107
// copy the relocations to the destination
1115
1108
dest_alloc.mark_relocation_range(relocations);
1116
1109
0 commit comments