@@ -1300,7 +1300,7 @@ impl<D: Delegate<Cx = X>, X: Cx> SearchGraph<D> {
1300
1300
1301
1301
let cycles = self . tree . rerun_get_and_reset_cycles ( prev_stack_entry. node_id ) ;
1302
1302
let current_stack_len = self . stack . len ( ) ;
1303
- let mut has_changed = HashSet :: default ( ) ;
1303
+ let mut was_reevaluated = HashSet :: default ( ) ;
1304
1304
' outer: for cycle in cycles {
1305
1305
let & tree:: Cycle { node_id : cycle_node_id, ref provisional_results } =
1306
1306
self . tree . get_cycle ( cycle) ;
@@ -1329,7 +1329,7 @@ impl<D: Delegate<Cx = X>, X: Cx> SearchGraph<D> {
1329
1329
// We've evaluated the `entry_node_id` before evaluating this goal. In case
1330
1330
// that node and its parents has not changed, we can reinsert the cache entry
1331
1331
// before starting to reevaluate it.
1332
- if !self . tree . goal_or_parent_has_changed ( node_id, & has_changed , entry_node_id) {
1332
+ if !self . tree . goal_or_parent_was_reevaluated ( node_id, & was_reevaluated , entry_node_id) {
1333
1333
continue ;
1334
1334
}
1335
1335
}
@@ -1369,7 +1369,7 @@ impl<D: Delegate<Cx = X>, X: Cx> SearchGraph<D> {
1369
1369
}
1370
1370
}
1371
1371
( Some ( & ( node_id, info) ) , None ) => {
1372
- if current_goal . 0 == node_id {
1372
+ if was_reevaluated . contains ( & node_id) {
1373
1373
debug ! ( parent = ?info. input, cycle = ?added_goals. last( ) . unwrap( ) , "reevaluated parent, skip cycle" ) ;
1374
1374
continue ' outer;
1375
1375
} else {
@@ -1427,15 +1427,12 @@ impl<D: Delegate<Cx = X>, X: Cx> SearchGraph<D> {
1427
1427
current_goal. 1 . step_kind_from_parent ,
1428
1428
inspect,
1429
1429
) ;
1430
+ was_reevaluated. insert ( current_goal. 0 ) ;
1430
1431
if node_id. is_some_and ( |node_id| self . tree . result_matches ( current_goal. 0 , node_id) )
1431
1432
{
1432
- // TODO: This seems wrong. If a later loop reevaluates this goal again, we'd use
1433
- // its updated `NodeId`.
1434
- removed_entries. remove ( & current_goal. 0 ) ;
1435
1433
debug ! ( input = ?current_goal. 1 . input, ?result, "goal did not change" ) ;
1436
1434
continue ' outer;
1437
1435
} else {
1438
- has_changed. insert ( current_goal. 0 ) ;
1439
1436
debug ! ( input = ?current_goal. 1 . input, ?result, "goal did change" ) ;
1440
1437
if self . stack . len ( ) > current_stack_len {
1441
1438
let parent = self . stack . pop ( ) ;
@@ -1481,7 +1478,7 @@ impl<D: Delegate<Cx = X>, X: Cx> SearchGraph<D> {
1481
1478
) ;
1482
1479
1483
1480
for ( entry_node_id, ( input, entry) ) in removed_entries {
1484
- if !self . tree . goal_or_parent_has_changed ( node_id, & has_changed , entry_node_id) {
1481
+ if !self . tree . goal_or_parent_was_reevaluated ( node_id, & was_reevaluated , entry_node_id) {
1485
1482
self . provisional_cache . entry ( input) . or_default ( ) . push ( entry) ;
1486
1483
}
1487
1484
}
0 commit comments