@@ -1333,10 +1333,11 @@ impl<B: BackingStorage> TurboTasksBackendInner<B> {
1333
1333
}
1334
1334
1335
1335
// handle cell counters: update max index and remove cells that are no longer used
1336
- let mut old_counters: FxHashMap < _ , _ > =
1336
+ let old_counters: FxHashMap < _ , _ > =
1337
1337
get_many ! ( task, CellTypeMaxIndex { cell_type } max_index => ( cell_type, * max_index) ) ;
1338
+ let mut counters_to_remove = old_counters. clone ( ) ;
1338
1339
for ( & cell_type, & max_index) in cell_counters. iter ( ) {
1339
- if let Some ( old_max_index) = old_counters . remove ( & cell_type) {
1340
+ if let Some ( old_max_index) = counters_to_remove . remove ( & cell_type) {
1340
1341
if old_max_index != max_index {
1341
1342
task. insert ( CachedDataItem :: CellTypeMaxIndex {
1342
1343
cell_type,
@@ -1350,7 +1351,7 @@ impl<B: BackingStorage> TurboTasksBackendInner<B> {
1350
1351
} ) ;
1351
1352
}
1352
1353
}
1353
- for ( cell_type, _) in old_counters {
1354
+ for ( cell_type, _) in counters_to_remove {
1354
1355
task. remove ( & CachedDataItemKey :: CellTypeMaxIndex { cell_type } ) ;
1355
1356
}
1356
1357
@@ -1405,14 +1406,17 @@ impl<B: BackingStorage> TurboTasksBackendInner<B> {
1405
1406
. get ( & cell. type_id )
1406
1407
. is_none_or ( |start_index| cell. index >= * start_index)
1407
1408
{
1408
- Some ( OutdatedEdge :: RemovedCellDependent {
1409
- task_id : task,
1410
- #[ cfg( feature = "trace_task_dirty" ) ]
1411
- value_type_id : cell. type_id ,
1412
- } )
1413
- } else {
1414
- None
1409
+ if let Some ( old_counter) = old_counters. get ( & cell. type_id ) {
1410
+ if cell. index < * old_counter {
1411
+ return Some ( OutdatedEdge :: RemovedCellDependent {
1412
+ task_id : task,
1413
+ #[ cfg( feature = "trace_task_dirty" ) ]
1414
+ value_type_id : cell. type_id ,
1415
+ } ) ;
1416
+ }
1417
+ }
1415
1418
}
1419
+ None
1416
1420
} ,
1417
1421
) ,
1418
1422
) ;
0 commit comments