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> {
496496 }
497497 }
498498 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+ }
502507 node_rewrites[ i] = nodes_len;
503508 dead_nodes += 1 ;
504509 }
You can’t perform that action at this time.
0 commit comments