Skip to content

Commit 8a62bb1

Browse files
committed
Rename nodes_len and use it in a few more places.
1 parent 9e67f19 commit 8a62bb1

File tree

1 file changed

+9
-9
lines changed
  • src/librustc_data_structures/obligation_forest

1 file changed

+9
-9
lines changed

src/librustc_data_structures/obligation_forest/mod.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -599,9 +599,9 @@ impl<O: ForestObligation> ObligationForest<O> {
599599
/// on these nodes may be present. This is done by e.g., `process_cycles`.
600600
#[inline(never)]
601601
fn compress(&mut self, do_completed: DoCompleted) -> Option<Vec<O>> {
602-
let nodes_len = self.nodes.len();
602+
let orig_nodes_len = self.nodes.len();
603603
let mut node_rewrites: Vec<_> = self.node_rewrites.replace(vec![]);
604-
node_rewrites.extend(0..nodes_len);
604+
node_rewrites.extend(0..orig_nodes_len);
605605
let mut dead_nodes = 0;
606606

607607
// Now move all popped nodes to the end. Try to keep the order.
@@ -610,7 +610,7 @@ impl<O: ForestObligation> ObligationForest<O> {
610610
// self.nodes[0..index - dead_nodes] are the first remaining nodes
611611
// self.nodes[index - dead_nodes..index] are all dead
612612
// self.nodes[index..] are unchanged
613-
for index in 0..self.nodes.len() {
613+
for index in 0..orig_nodes_len {
614614
let node = &self.nodes[index];
615615
match node.state.get() {
616616
NodeState::Pending | NodeState::Waiting => {
@@ -631,15 +631,15 @@ impl<O: ForestObligation> ObligationForest<O> {
631631
} else {
632632
self.done_cache.insert(node.obligation.as_predicate().clone());
633633
}
634-
node_rewrites[index] = nodes_len;
634+
node_rewrites[index] = orig_nodes_len;
635635
dead_nodes += 1;
636636
}
637637
NodeState::Error => {
638638
// We *intentionally* remove the node from the cache at this point. Otherwise
639639
// tests must come up with a different type on every type error they
640640
// check against.
641641
self.active_cache.remove(node.obligation.as_predicate());
642-
node_rewrites[index] = nodes_len;
642+
node_rewrites[index] = orig_nodes_len;
643643
dead_nodes += 1;
644644
self.insert_into_error_cache(index);
645645
}
@@ -667,7 +667,7 @@ impl<O: ForestObligation> ObligationForest<O> {
667667
})
668668
.collect())
669669
} else {
670-
self.nodes.truncate(self.nodes.len() - dead_nodes);
670+
self.nodes.truncate(orig_nodes_len - dead_nodes);
671671
None
672672
};
673673
self.apply_rewrites(&node_rewrites);
@@ -679,13 +679,13 @@ impl<O: ForestObligation> ObligationForest<O> {
679679
}
680680

681681
fn apply_rewrites(&mut self, node_rewrites: &[usize]) {
682-
let nodes_len = node_rewrites.len();
682+
let orig_nodes_len = node_rewrites.len();
683683

684684
for node in &mut self.nodes {
685685
let mut i = 0;
686686
while i < node.dependents.len() {
687687
let new_index = node_rewrites[node.dependents[i]];
688-
if new_index >= nodes_len {
688+
if new_index >= orig_nodes_len {
689689
node.dependents.swap_remove(i);
690690
if i == 0 && node.has_parent {
691691
// We just removed the parent.
@@ -702,7 +702,7 @@ impl<O: ForestObligation> ObligationForest<O> {
702702
// removal of nodes within `compress` can fail. See above.
703703
self.active_cache.retain(|_predicate, index| {
704704
let new_index = node_rewrites[*index];
705-
if new_index >= nodes_len {
705+
if new_index >= orig_nodes_len {
706706
false
707707
} else {
708708
*index = new_index;

0 commit comments

Comments
 (0)