We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent d334027 commit 384d04dCopy full SHA for 384d04d
src/librustc_data_structures/obligation_forest/mod.rs
@@ -496,9 +496,14 @@ impl<O: ForestObligation> ObligationForest<O> {
496
}
497
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());
+ // Avoid cloning the key (predicate) in case it exists in the waiting cache
+ if let Some((predicate, _)) = self.waiting_cache
+ .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
+ }
507
node_rewrites[i] = nodes_len;
508
dead_nodes += 1;
509
0 commit comments