diff --git a/src/borrow_tracker/mod.rs b/src/borrow_tracker/mod.rs index 852da3a68a..2fc7e5a88b 100644 --- a/src/borrow_tracker/mod.rs +++ b/src/borrow_tracker/mod.rs @@ -236,6 +236,10 @@ impl GlobalStateInner { tag }) } + + pub fn remove_unreachable_allocs(&mut self, reachable: &FxHashSet) { + self.base_ptr_tags.retain(|id, _| reachable.contains(id)); + } } /// Which borrow tracking method to use diff --git a/src/provenance_gc.rs b/src/provenance_gc.rs index 8e1775cfb9..cfef34e52a 100644 --- a/src/provenance_gc.rs +++ b/src/provenance_gc.rs @@ -185,7 +185,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: MiriInterpCxExt<'mir, 'tcx> { this.machine.allocation_spans.borrow_mut().retain(|id, _| allocs.contains(id)); this.machine.intptrcast.borrow_mut().remove_unreachable_allocs(&allocs); if let Some(borrow_tracker) = &this.machine.borrow_tracker { - borrow_tracker.borrow_mut().base_ptr_tags.retain(|id, _| allocs.contains(id)); + borrow_tracker.borrow_mut().remove_unreachable_allocs(&allocs); } } }