@@ -65,7 +65,7 @@ pub struct FrameState {
65
65
/// incremental updates of the global list of protected tags stored in the
66
66
/// `stacked_borrows::GlobalState` upon function return, and if we attempt to pop a protected
67
67
/// tag, to identify which call is responsible for protecting the tag.
68
- /// See `Stack::item_popped ` for more explanation.
68
+ /// See `Stack::item_invalidated ` for more explanation.
69
69
/// Tree Borrows also needs to know which allocation these tags
70
70
/// belong to so that it can perform a read through them immediately before
71
71
/// the frame gets popped.
@@ -76,8 +76,10 @@ pub struct FrameState {
76
76
}
77
77
78
78
impl VisitProvenance for FrameState {
79
- fn visit_provenance ( & self , _visit : & mut VisitWith < ' _ > ) {
80
- // `protected_tags` are already recorded by `GlobalStateInner`.
79
+ fn visit_provenance ( & self , visit : & mut VisitWith < ' _ > ) {
80
+ for ( id, tag) in & self . protected_tags {
81
+ visit ( Some ( * id) , Some ( * tag) ) ;
82
+ }
81
83
}
82
84
}
83
85
@@ -98,7 +100,7 @@ pub struct GlobalStateInner {
98
100
/// An item is protected if its tag is in this set, *and* it has the "protected" bit set.
99
101
/// We add tags to this when they are created with a protector in `reborrow`, and
100
102
/// we remove tags from this when the call which is protecting them returns, in
101
- /// `GlobalStateInner::end_call`. See `Stack::item_popped ` for more details.
103
+ /// `GlobalStateInner::end_call`. See `Stack::item_invalidated ` for more details.
102
104
protected_tags : FxHashMap < BorTag , ProtectorKind > ,
103
105
/// The pointer ids to trace
104
106
tracked_pointer_tags : FxHashSet < BorTag > ,
@@ -111,10 +113,8 @@ pub struct GlobalStateInner {
111
113
}
112
114
113
115
impl VisitProvenance for GlobalStateInner {
114
- fn visit_provenance ( & self , visit : & mut VisitWith < ' _ > ) {
115
- for & tag in self . protected_tags . keys ( ) {
116
- visit ( None , Some ( tag) ) ;
117
- }
116
+ fn visit_provenance ( & self , _visit : & mut VisitWith < ' _ > ) {
117
+ // All the provenance in protected_tags is also stored in FrameState, and visited there.
118
118
// The only other candidate is base_ptr_tags, and that does not need visiting since we don't ever
119
119
// GC the bottommost/root tag.
120
120
}
0 commit comments