@@ -300,17 +300,7 @@ impl<D: Delegate<Cx = X>, X: Cx> SearchGraph<D> {
300300 // We update both the head of this cycle to rerun its evaluation until
301301 // we reach a fixpoint and all other cycle participants to make sure that
302302 // their result does not get moved to the global cache.
303- fn tag_cycle_participants (
304- stack : & mut IndexVec < StackDepth , StackEntry < X > > ,
305- usage_kind : Option < UsageKind > ,
306- head : StackDepth ,
307- ) {
308- if let Some ( usage_kind) = usage_kind {
309- stack[ head] . has_been_used =
310- Some ( stack[ head] . has_been_used . map_or ( usage_kind, |prev| prev. merge ( usage_kind) ) ) ;
311- }
312- debug_assert ! ( stack[ head] . has_been_used. is_some( ) ) ;
313-
303+ fn tag_cycle_participants ( stack : & mut IndexVec < StackDepth , StackEntry < X > > , head : StackDepth ) {
314304 // The current root of these cycles. Note that this may not be the final
315305 // root in case a later goal depends on a goal higher up the stack.
316306 let mut current_root = head;
@@ -403,7 +393,8 @@ impl<D: Delegate<Cx = X>, X: Cx> SearchGraph<D> {
403393 // We have a nested goal which is already in the provisional cache, use
404394 // its result. We do not provide any usage kind as that should have been
405395 // already set correctly while computing the cache entry.
406- Self :: tag_cycle_participants ( & mut self . stack , None , entry. head ) ;
396+ debug_assert ! ( self . stack[ entry. head] . has_been_used. is_some( ) ) ;
397+ Self :: tag_cycle_participants ( & mut self . stack , entry. head ) ;
407398 return entry. result ;
408399 } else if let Some ( stack_depth) = cache_entry. stack_depth {
409400 debug ! ( "encountered cycle with depth {stack_depth:?}" ) ;
@@ -416,11 +407,13 @@ impl<D: Delegate<Cx = X>, X: Cx> SearchGraph<D> {
416407 let is_coinductive_cycle = Self :: stack_coinductive_from ( cx, & self . stack , stack_depth) ;
417408 let cycle_kind =
418409 if is_coinductive_cycle { CycleKind :: Coinductive } else { CycleKind :: Inductive } ;
419- Self :: tag_cycle_participants (
420- & mut self . stack ,
421- Some ( UsageKind :: Single ( cycle_kind) ) ,
422- stack_depth,
410+ let usage_kind = UsageKind :: Single ( cycle_kind) ;
411+ self . stack [ stack_depth] . has_been_used = Some (
412+ self . stack [ stack_depth]
413+ . has_been_used
414+ . map_or ( usage_kind, |prev| prev. merge ( usage_kind) ) ,
423415 ) ;
416+ Self :: tag_cycle_participants ( & mut self . stack , stack_depth) ;
424417
425418 // Return the provisional result or, if we're in the first iteration,
426419 // start with no constraints.
0 commit comments