diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2021-10-15 11:24:20 +0200 |
|---|---|---|
| committer | Matthias Krüger <matthias.krueger@famsik.de> | 2021-10-15 11:28:23 +0200 |
| commit | 44570143989cdd529aff488b8fa5534c4802fbce (patch) | |
| tree | 6ac2b6660b1055c06b20475a05eec0f9359d1143 /compiler/rustc_data_structures/src/obligation_forest | |
| parent | 72d66064e77281536588189a916af28a1819b313 (diff) | |
| download | rust-44570143989cdd529aff488b8fa5534c4802fbce.tar.gz rust-44570143989cdd529aff488b8fa5534c4802fbce.zip | |
Revert "Auto merge of #89709 - clemenswasser:apply_clippy_suggestions_2, r=petrochenkov"
The PR had some unforseen perf regressions that are not as easy to find. Revert the PR for now. This reverts commit 6ae8912a3e7d2c4c775024f58a7ba4b1aedc4073, reversing changes made to 86d6d2b7389fe1b339402c1798edae8b695fc9ef.
Diffstat (limited to 'compiler/rustc_data_structures/src/obligation_forest')
| -rw-r--r-- | compiler/rustc_data_structures/src/obligation_forest/mod.rs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/compiler/rustc_data_structures/src/obligation_forest/mod.rs b/compiler/rustc_data_structures/src/obligation_forest/mod.rs index caf515b0d19..25b7a84b3a0 100644 --- a/compiler/rustc_data_structures/src/obligation_forest/mod.rs +++ b/compiler/rustc_data_structures/src/obligation_forest/mod.rs @@ -390,7 +390,7 @@ impl<O: ForestObligation> ObligationForest<O> { .map(|(index, _node)| Error { error: error.clone(), backtrace: self.error_at(index) }) .collect(); - self.compress(|_| unreachable!()); + self.compress(|_| assert!(false)); errors } @@ -612,7 +612,7 @@ impl<O: ForestObligation> ObligationForest<O> { fn compress(&mut self, mut outcome_cb: impl FnMut(&O)) { let orig_nodes_len = self.nodes.len(); let mut node_rewrites: Vec<_> = std::mem::take(&mut self.reused_node_vec); - assert!(node_rewrites.is_empty()); + debug_assert!(node_rewrites.is_empty()); node_rewrites.extend(0..orig_nodes_len); let mut dead_nodes = 0; @@ -623,13 +623,13 @@ impl<O: ForestObligation> ObligationForest<O> { // self.nodes[0..index - dead_nodes] are the first remaining nodes // self.nodes[index - dead_nodes..index] are all dead // self.nodes[index..] are unchanged - for (index, node_rewrite) in node_rewrites.iter_mut().enumerate() { + for index in 0..orig_nodes_len { let node = &self.nodes[index]; match node.state.get() { NodeState::Pending | NodeState::Waiting => { if dead_nodes > 0 { self.nodes.swap(index, index - dead_nodes); - *node_rewrite -= dead_nodes; + node_rewrites[index] -= dead_nodes; } } NodeState::Done => { @@ -646,7 +646,7 @@ impl<O: ForestObligation> ObligationForest<O> { } // Extract the success stories. outcome_cb(&node.obligation); - *node_rewrite = orig_nodes_len; + node_rewrites[index] = orig_nodes_len; dead_nodes += 1; } NodeState::Error => { @@ -655,7 +655,7 @@ impl<O: ForestObligation> ObligationForest<O> { // check against. self.active_cache.remove(&node.obligation.as_cache_key()); self.insert_into_error_cache(index); - *node_rewrite = orig_nodes_len; + node_rewrites[index] = orig_nodes_len; dead_nodes += 1; } NodeState::Success => unreachable!(), |
