@@ -65,7 +65,7 @@ pub struct FrameState {
6565 /// incremental updates of the global list of protected tags stored in the
6666 /// `stacked_borrows::GlobalState` upon function return, and if we attempt to pop a protected
6767 /// 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.
6969 /// Tree Borrows also needs to know which allocation these tags
7070 /// belong to so that it can perform a read through them immediately before
7171 /// the frame gets popped.
@@ -76,8 +76,10 @@ pub struct FrameState {
7676}
7777
7878impl 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+ }
8183 }
8284}
8385
@@ -98,7 +100,7 @@ pub struct GlobalStateInner {
98100 /// An item is protected if its tag is in this set, *and* it has the "protected" bit set.
99101 /// We add tags to this when they are created with a protector in `reborrow`, and
100102 /// 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.
102104 protected_tags : FxHashMap < BorTag , ProtectorKind > ,
103105 /// The pointer ids to trace
104106 tracked_pointer_tags : FxHashSet < BorTag > ,
@@ -111,10 +113,8 @@ pub struct GlobalStateInner {
111113}
112114
113115impl 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.
118118 // The only other candidate is base_ptr_tags, and that does not need visiting since we don't ever
119119 // GC the bottommost/root tag.
120120 }
0 commit comments