Skip to content

Commit d1e1f76

Browse files
committed
fix tag GC deleting protected tags
1 parent 58433bf commit d1e1f76

File tree

1 file changed

+7
-4
lines changed
  • src/tools/miri/src/borrow_tracker

1 file changed

+7
-4
lines changed

src/tools/miri/src/borrow_tracker/mod.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ pub struct FrameState {
7474

7575
impl VisitTags for FrameState {
7676
fn visit_tags(&self, _visit: &mut dyn FnMut(BorTag)) {
77-
// `protected_tags` are fine to GC.
77+
// `protected_tags` are already recorded by `GlobalStateInner`.
7878
}
7979
}
8080

@@ -108,9 +108,12 @@ pub struct GlobalStateInner {
108108
}
109109

110110
impl VisitTags for GlobalStateInner {
111-
fn visit_tags(&self, _visit: &mut dyn FnMut(BorTag)) {
112-
// The only candidate is base_ptr_tags, and that does not need visiting since we don't ever
113-
// GC the bottommost tag.
111+
fn visit_tags(&self, visit: &mut dyn FnMut(BorTag)) {
112+
for &tag in self.protected_tags.keys() {
113+
visit(tag);
114+
}
115+
// The only other candidate is base_ptr_tags, and that does not need visiting since we don't ever
116+
// GC the bottommost/root tag.
114117
}
115118
}
116119

0 commit comments

Comments
 (0)