@@ -1333,10 +1333,11 @@ impl<B: BackingStorage> TurboTasksBackendInner<B> {
13331333 }
13341334
13351335 // 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 < _ , _ > =
13371337 get_many ! ( task, CellTypeMaxIndex { cell_type } max_index => ( cell_type, * max_index) ) ;
1338+ let mut counters_to_remove = old_counters. clone ( ) ;
13381339 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) {
13401341 if old_max_index != max_index {
13411342 task. insert ( CachedDataItem :: CellTypeMaxIndex {
13421343 cell_type,
@@ -1350,7 +1351,7 @@ impl<B: BackingStorage> TurboTasksBackendInner<B> {
13501351 } ) ;
13511352 }
13521353 }
1353- for ( cell_type, _) in old_counters {
1354+ for ( cell_type, _) in counters_to_remove {
13541355 task. remove ( & CachedDataItemKey :: CellTypeMaxIndex { cell_type } ) ;
13551356 }
13561357
@@ -1405,14 +1406,17 @@ impl<B: BackingStorage> TurboTasksBackendInner<B> {
14051406 . get ( & cell. type_id )
14061407 . is_none_or ( |start_index| cell. index >= * start_index)
14071408 {
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+ }
14151418 }
1419+ None
14161420 } ,
14171421 ) ,
14181422 ) ;
0 commit comments