File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed
src/librustc_data_structures/obligation_forest Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -496,9 +496,14 @@ impl<O: ForestObligation> ObligationForest<O> {
496
496
}
497
497
}
498
498
NodeState :: Done => {
499
- self . waiting_cache . remove ( self . nodes [ i] . obligation . as_predicate ( ) ) ;
500
- // FIXME(HashMap): why can't I get my key back?
501
- self . done_cache . insert ( self . nodes [ i] . obligation . as_predicate ( ) . clone ( ) ) ;
499
+ // Avoid cloning the key (predicate) in case it exists in the waiting cache
500
+ if let Some ( ( predicate, _) ) = self . waiting_cache
501
+ . remove_entry ( self . nodes [ i] . obligation . as_predicate ( ) )
502
+ {
503
+ self . done_cache . insert ( predicate) ;
504
+ } else {
505
+ self . done_cache . insert ( self . nodes [ i] . obligation . as_predicate ( ) . clone ( ) ) ;
506
+ }
502
507
node_rewrites[ i] = nodes_len;
503
508
dead_nodes += 1 ;
504
509
}
You can’t perform that action at this time.
0 commit comments