@@ -1224,7 +1224,10 @@ impl<D: Delegate<Cx = X>, X: Cx> SearchGraph<D> {
1224
1224
& new_stack_entry,
1225
1225
|_, result| result,
1226
1226
) ;
1227
- self . tree . set_rebase_kind ( new_stack_entry. node_id , tree:: RebaseEntriesKind :: Normal ) ;
1227
+ self . tree . set_rebase_kind (
1228
+ new_stack_entry. node_id ,
1229
+ tree:: RebaseEntriesKind :: Normal ,
1230
+ ) ;
1228
1231
return EvaluationResult :: finalize (
1229
1232
new_stack_entry,
1230
1233
encountered_overflow,
@@ -1300,6 +1303,7 @@ impl<D: Delegate<Cx = X>, X: Cx> SearchGraph<D> {
1300
1303
)
1301
1304
}
1302
1305
Some ( tree:: RebaseEntriesKind :: Ambiguity ) => {
1306
+ debug ! ( ?reeval_entry. input, "rebase entries while truncating stack" ) ;
1303
1307
Self :: rebase_provisional_cache_entries (
1304
1308
stack,
1305
1309
provisional_cache,
@@ -1308,18 +1312,46 @@ impl<D: Delegate<Cx = X>, X: Cx> SearchGraph<D> {
1308
1312
)
1309
1313
}
1310
1314
Some ( tree:: RebaseEntriesKind :: Overflow ) => {
1315
+ debug ! ( ?reeval_entry. input, "rebase entries while truncating stack" ) ;
1311
1316
Self :: rebase_provisional_cache_entries (
1312
1317
stack,
1313
1318
provisional_cache,
1314
1319
& reeval_entry,
1315
1320
|input, _| D :: on_fixpoint_overflow ( cx, input) ,
1316
1321
)
1317
1322
}
1318
- None | _ => {
1319
- Self :: clear_dependent_provisional_results ( stack, provisional_cache)
1323
+ None => Self :: clear_dependent_provisional_results ( stack, provisional_cache) ,
1324
+ }
1325
+
1326
+ let entry = provisional_cache. entry ( reeval_entry. input ) . or_default ( ) ;
1327
+ for ( head, path_to_nested) in heads. iter ( ) {
1328
+ let path_from_head =
1329
+ Self :: cycle_path_kind ( & stack, reeval_entry. step_kind_from_parent , head) ;
1330
+ for path_kind in path_to_nested. extend_with ( path_from_head) . iter_paths ( ) {
1331
+ let usage_kind = UsageKind :: Single ( path_kind) ;
1332
+ stack[ head] . has_been_used = Some (
1333
+ stack[ head]
1334
+ . has_been_used
1335
+ . map_or ( usage_kind, |prev| prev. merge ( usage_kind) ) ,
1336
+ ) ;
1320
1337
}
1321
1338
}
1339
+ let path_from_head = Self :: cycle_path_kind (
1340
+ & stack,
1341
+ reeval_entry. step_kind_from_parent ,
1342
+ heads. highest_cycle_head ( ) ,
1343
+ ) ;
1344
+ let provisional_cache_entry = ProvisionalCacheEntry {
1345
+ entry_node_id : reeval_entry. node_id ,
1346
+ encountered_overflow,
1347
+ heads : heads. clone ( ) ,
1348
+ path_from_head,
1349
+ result,
1350
+ } ;
1351
+ debug ! ( ?reeval_entry. input, ?provisional_cache_entry) ;
1352
+ entry. push ( provisional_cache_entry) ;
1322
1353
} else {
1354
+ debug ! ( ?reeval_entry. input, "rebase entries while truncating stack" ) ;
1323
1355
Self :: clear_dependent_provisional_results ( stack, provisional_cache) ;
1324
1356
}
1325
1357
@@ -1331,34 +1363,6 @@ impl<D: Delegate<Cx = X>, X: Cx> SearchGraph<D> {
1331
1363
reeval_entry. encountered_overflow ,
1332
1364
UpdateParentGoalCtxt :: Ordinary ( & reeval_entry. nested_goals ) ,
1333
1365
) ;
1334
- let entry = provisional_cache. entry ( reeval_entry. input ) . or_default ( ) ;
1335
-
1336
- for ( head, path_to_nested) in heads. iter ( ) {
1337
- let path_from_head =
1338
- Self :: cycle_path_kind ( & stack, reeval_entry. step_kind_from_parent , head) ;
1339
- for path_kind in path_to_nested. extend_with ( path_from_head) . iter_paths ( ) {
1340
- let usage_kind = UsageKind :: Single ( path_kind) ;
1341
- stack[ head] . has_been_used = Some (
1342
- stack[ head]
1343
- . has_been_used
1344
- . map_or ( usage_kind, |prev| prev. merge ( usage_kind) ) ,
1345
- ) ;
1346
- }
1347
- }
1348
- let path_from_head = Self :: cycle_path_kind (
1349
- & stack,
1350
- reeval_entry. step_kind_from_parent ,
1351
- heads. highest_cycle_head ( ) ,
1352
- ) ;
1353
- let provisional_cache_entry = ProvisionalCacheEntry {
1354
- entry_node_id : reeval_entry. node_id ,
1355
- encountered_overflow,
1356
- heads : heads. clone ( ) ,
1357
- path_from_head,
1358
- result,
1359
- } ;
1360
- debug ! ( ?provisional_cache_entry) ;
1361
- entry. push ( provisional_cache_entry) ;
1362
1366
}
1363
1367
} ;
1364
1368
@@ -1385,12 +1389,6 @@ impl<D: Delegate<Cx = X>, X: Cx> SearchGraph<D> {
1385
1389
if entry_node_id < node_id {
1386
1390
continue ;
1387
1391
}
1388
- // This provisional cache entry was computed with the current goal on the
1389
- // stack. Check whether it depends on it.
1390
- if !self . tree . get_heads ( entry_node_id) . contains_stack_entry ( current_depth) {
1391
- continue ;
1392
- }
1393
-
1394
1392
// We've evaluated the `entry_node_id` before evaluating this goal. In case
1395
1393
// that node and its parents has not changed, we can reinsert the cache entry
1396
1394
// before starting to reevaluate it.
0 commit comments