@@ -75,9 +75,8 @@ impl Stack {
75
75
76
76
#[ cfg( feature = "stack-cache" ) ]
77
77
if let Some ( first_removed) = first_removed {
78
- // Base tags are Unique or SharedReadOnly.
79
- // When the base tag is SharedReadOnly, we do nothing. When the base tag is Unique,
80
- // the start of this range is still precise.
78
+ // Either end of unique_range may have shifted, all we really know is that we can't
79
+ // have introduced a new Unique.
81
80
if !self . unique_range . is_empty ( ) {
82
81
self . unique_range = 0 ..self . len ( ) ;
83
82
}
@@ -159,14 +158,11 @@ impl<'tcx> Stack {
159
158
160
159
// Check that the unique_range is a valid index into the borrow stack.
161
160
// This asserts that the unique_range's start <= end.
162
- let uniques = & self . borrows [ self . unique_range . clone ( ) ] ;
161
+ let _uniques = & self . borrows [ self . unique_range . clone ( ) ] ;
163
162
164
- // Check that the start of the unique_range is precise.
165
- if let Some ( first_unique) = uniques. first ( ) {
166
- assert_eq ! ( first_unique. perm( ) , Permission :: Unique ) ;
167
- }
168
- // We cannot assert that the unique range is exact on the upper end.
169
- // When we pop items within the unique range, setting the end of the range precisely
163
+ // We cannot assert that the unique range is precise.
164
+ // Both ends may shift around when `Stack::retain` is called. Additionally,
165
+ // when we pop items within the unique range, setting the end of the range precisely
170
166
// requires doing a linear search of the borrow stack, which is exactly the kind of
171
167
// operation that all this caching exists to avoid.
172
168
}
0 commit comments