diff options
| author | Nicholas Nethercote <n.nethercote@gmail.com> | 2022-06-03 11:50:31 +1000 |
|---|---|---|
| committer | Nicholas Nethercote <n.nethercote@gmail.com> | 2022-06-06 08:47:49 +1000 |
| commit | cdb446fec39b9359ffcf04e1c4ba7c2eae800809 (patch) | |
| tree | f09fc32f0aa04fc449445b91b1bb60c9faa0e283 | |
| parent | fee3a459dd6aba8e34a5b99f0fbcb4218a1e2401 (diff) | |
| download | rust-cdb446fec39b9359ffcf04e1c4ba7c2eae800809.tar.gz rust-cdb446fec39b9359ffcf04e1c4ba7c2eae800809.zip | |
Streamline `active_cache` to `done_cache` transfer.
| -rw-r--r-- | compiler/rustc_data_structures/src/obligation_forest/mod.rs | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/compiler/rustc_data_structures/src/obligation_forest/mod.rs b/compiler/rustc_data_structures/src/obligation_forest/mod.rs index 74f432a7967..c085e18fd66 100644 --- a/compiler/rustc_data_structures/src/obligation_forest/mod.rs +++ b/compiler/rustc_data_structures/src/obligation_forest/mod.rs @@ -634,17 +634,14 @@ impl<O: ForestObligation> ObligationForest<O> { } } NodeState::Done => { - // This lookup can fail because the contents of + // The removal lookup might fail because the contents of // `self.active_cache` are not guaranteed to match those of // `self.nodes`. See the comment in `process_obligation` // for more details. - if let Some((predicate, _)) = - self.active_cache.remove_entry(&node.obligation.as_cache_key()) - { - self.done_cache.insert(predicate); - } else { - self.done_cache.insert(node.obligation.as_cache_key().clone()); - } + let cache_key = node.obligation.as_cache_key(); + self.active_cache.remove(&cache_key); + self.done_cache.insert(cache_key); + // Extract the success stories. outcome_cb(&node.obligation); node_rewrites[index] = orig_nodes_len; |
