about summary refs log tree commit diff
diff options
context:
space:
mode:
authorRalf Jung <post@ralfj.de>2023-07-12 22:28:33 +0200
committerRalf Jung <post@ralfj.de>2023-07-12 22:28:33 +0200
commitd1e1f76afe15b50a474091dafa0c41f0813b6b2d (patch)
treed14f7f56488dc695510bc7de91812156ebe617a6
parent58433bfb95b6df7f9518fe0b09c678792304c062 (diff)
downloadrust-d1e1f76afe15b50a474091dafa0c41f0813b6b2d.tar.gz
rust-d1e1f76afe15b50a474091dafa0c41f0813b6b2d.zip
fix tag GC deleting protected tags
-rw-r--r--src/tools/miri/src/borrow_tracker/mod.rs11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/tools/miri/src/borrow_tracker/mod.rs b/src/tools/miri/src/borrow_tracker/mod.rs
index a2cf7c80950..fcfa8f64570 100644
--- a/src/tools/miri/src/borrow_tracker/mod.rs
+++ b/src/tools/miri/src/borrow_tracker/mod.rs
@@ -74,7 +74,7 @@ pub struct FrameState {
 
 impl VisitTags for FrameState {
     fn visit_tags(&self, _visit: &mut dyn FnMut(BorTag)) {
-        // `protected_tags` are fine to GC.
+        // `protected_tags` are already recorded by `GlobalStateInner`.
     }
 }
 
@@ -108,9 +108,12 @@ pub struct GlobalStateInner {
 }
 
 impl VisitTags for GlobalStateInner {
-    fn visit_tags(&self, _visit: &mut dyn FnMut(BorTag)) {
-        // The only candidate is base_ptr_tags, and that does not need visiting since we don't ever
-        // GC the bottommost tag.
+    fn visit_tags(&self, visit: &mut dyn FnMut(BorTag)) {
+        for &tag in self.protected_tags.keys() {
+            visit(tag);
+        }
+        // The only other candidate is base_ptr_tags, and that does not need visiting since we don't ever
+        // GC the bottommost/root tag.
     }
 }