diff --git a/src/librustc_mir/interpret/machine.rs b/src/librustc_mir/interpret/machine.rs index 7aeadfa408a9..e9d181479e52 100644 --- a/src/librustc_mir/interpret/machine.rs +++ b/src/librustc_mir/interpret/machine.rs @@ -199,6 +199,7 @@ pub trait Machine<'a, 'mir, 'tcx>: Sized { fn memory_deallocated( _alloc: &mut Allocation, _ptr: Pointer, + _size: Size, ) -> EvalResult<'tcx> { Ok(()) } diff --git a/src/librustc_mir/interpret/memory.rs b/src/librustc_mir/interpret/memory.rs index 91f3813e2b1f..a9ef35845fc8 100644 --- a/src/librustc_mir/interpret/memory.rs +++ b/src/librustc_mir/interpret/memory.rs @@ -232,7 +232,8 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> Memory<'a, 'mir, 'tcx, M> { } // Let the machine take some extra action - M::memory_deallocated(&mut alloc, ptr)?; + let size = Size::from_bytes(alloc.bytes.len() as u64); + M::memory_deallocated(&mut alloc, ptr, size)?; // Don't forget to remember size and align of this now-dead allocation let old = self.dead_alloc_map.insert(