@@ -133,7 +133,6 @@ impl<'tcx> SearchGraph<'tcx> {
133
133
let cache = & mut self . provisional_cache ;
134
134
let provisional_entry_index = * cache. lookup_table . get ( & goal) . unwrap ( ) ;
135
135
let provisional_entry = & mut cache. entries [ provisional_entry_index] ;
136
- let depth = provisional_entry. depth ;
137
136
// We eagerly update the response in the cache here. If we have to reevaluate
138
137
// this goal we use the new response when hitting a cycle, and we definitely
139
138
// want to access the final response whenever we look at the cache.
@@ -157,29 +156,41 @@ impl<'tcx> SearchGraph<'tcx> {
157
156
self . stack . push ( StackElem { goal, has_been_used : false } ) ;
158
157
false
159
158
} else {
160
- // If not, we're done with this goal.
161
- //
162
- // Check whether that this goal doesn't depend on a goal deeper on the stack
163
- // and if so, move it and all nested goals to the global cache.
164
- //
165
- // Note that if any nested goal were to depend on something deeper on the stack,
166
- // this would have also updated the depth of the current goal.
167
- if depth == self . stack . next_index ( ) {
168
- for ( i, entry) in cache. entries . drain_enumerated ( provisional_entry_index. index ( ) ..)
169
- {
170
- let actual_index = cache. lookup_table . remove ( & entry. goal ) ;
171
- debug_assert_eq ! ( Some ( i) , actual_index) ;
172
- debug_assert ! ( entry. depth == depth) ;
173
- cache:: try_move_finished_goal_to_global_cache (
174
- tcx,
175
- & mut self . overflow_data ,
176
- & self . stack ,
177
- entry. goal ,
178
- entry. response ,
179
- ) ;
180
- }
181
- }
159
+ self . try_move_finished_goal_to_global_cache ( tcx, & goal) ;
182
160
true
183
161
}
184
162
}
163
+
164
+ pub ( super ) fn try_move_finished_goal_to_global_cache (
165
+ & mut self ,
166
+ tcx : TyCtxt < ' tcx > ,
167
+ goal : & CanonicalGoal < ' tcx > ,
168
+ ) {
169
+ let cache = & mut self . provisional_cache ;
170
+ let provisional_entry_index = * cache. lookup_table . get ( goal) . unwrap ( ) ;
171
+ let provisional_entry = & mut cache. entries [ provisional_entry_index] ;
172
+ let depth = provisional_entry. depth ;
173
+
174
+ // If not, we're done with this goal.
175
+ //
176
+ // Check whether that this goal doesn't depend on a goal deeper on the stack
177
+ // and if so, move it and all nested goals to the global cache.
178
+ //
179
+ // Note that if any nested goal were to depend on something deeper on the stack,
180
+ // this would have also updated the depth of the current goal.
181
+ if depth == self . stack . next_index ( ) {
182
+ for ( i, entry) in cache. entries . drain_enumerated ( provisional_entry_index. index ( ) ..) {
183
+ let actual_index = cache. lookup_table . remove ( & entry. goal ) ;
184
+ debug_assert_eq ! ( Some ( i) , actual_index) ;
185
+ debug_assert ! ( entry. depth == depth) ;
186
+ cache:: try_move_finished_goal_to_global_cache (
187
+ tcx,
188
+ & mut self . overflow_data ,
189
+ & self . stack ,
190
+ entry. goal ,
191
+ entry. response ,
192
+ ) ;
193
+ }
194
+ }
195
+ }
185
196
}
0 commit comments