@@ -599,9 +599,9 @@ impl<O: ForestObligation> ObligationForest<O> {
599
599
/// on these nodes may be present. This is done by e.g., `process_cycles`.
600
600
#[ inline( never) ]
601
601
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 ( ) ;
603
603
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 ) ;
605
605
let mut dead_nodes = 0 ;
606
606
607
607
// Now move all popped nodes to the end. Try to keep the order.
@@ -610,7 +610,7 @@ impl<O: ForestObligation> ObligationForest<O> {
610
610
// self.nodes[0..index - dead_nodes] are the first remaining nodes
611
611
// self.nodes[index - dead_nodes..index] are all dead
612
612
// self.nodes[index..] are unchanged
613
- for index in 0 ..self . nodes . len ( ) {
613
+ for index in 0 ..orig_nodes_len {
614
614
let node = & self . nodes [ index] ;
615
615
match node. state . get ( ) {
616
616
NodeState :: Pending | NodeState :: Waiting => {
@@ -631,15 +631,15 @@ impl<O: ForestObligation> ObligationForest<O> {
631
631
} else {
632
632
self . done_cache . insert ( node. obligation . as_predicate ( ) . clone ( ) ) ;
633
633
}
634
- node_rewrites[ index] = nodes_len ;
634
+ node_rewrites[ index] = orig_nodes_len ;
635
635
dead_nodes += 1 ;
636
636
}
637
637
NodeState :: Error => {
638
638
// We *intentionally* remove the node from the cache at this point. Otherwise
639
639
// tests must come up with a different type on every type error they
640
640
// check against.
641
641
self . active_cache . remove ( node. obligation . as_predicate ( ) ) ;
642
- node_rewrites[ index] = nodes_len ;
642
+ node_rewrites[ index] = orig_nodes_len ;
643
643
dead_nodes += 1 ;
644
644
self . insert_into_error_cache ( index) ;
645
645
}
@@ -667,7 +667,7 @@ impl<O: ForestObligation> ObligationForest<O> {
667
667
} )
668
668
. collect ( ) )
669
669
} else {
670
- self . nodes . truncate ( self . nodes . len ( ) - dead_nodes) ;
670
+ self . nodes . truncate ( orig_nodes_len - dead_nodes) ;
671
671
None
672
672
} ;
673
673
self . apply_rewrites ( & node_rewrites) ;
@@ -679,13 +679,13 @@ impl<O: ForestObligation> ObligationForest<O> {
679
679
}
680
680
681
681
fn apply_rewrites ( & mut self , node_rewrites : & [ usize ] ) {
682
- let nodes_len = node_rewrites. len ( ) ;
682
+ let orig_nodes_len = node_rewrites. len ( ) ;
683
683
684
684
for node in & mut self . nodes {
685
685
let mut i = 0 ;
686
686
while i < node. dependents . len ( ) {
687
687
let new_index = node_rewrites[ node. dependents [ i] ] ;
688
- if new_index >= nodes_len {
688
+ if new_index >= orig_nodes_len {
689
689
node. dependents . swap_remove ( i) ;
690
690
if i == 0 && node. has_parent {
691
691
// We just removed the parent.
@@ -702,7 +702,7 @@ impl<O: ForestObligation> ObligationForest<O> {
702
702
// removal of nodes within `compress` can fail. See above.
703
703
self . active_cache . retain ( |_predicate, index| {
704
704
let new_index = node_rewrites[ * index] ;
705
- if new_index >= nodes_len {
705
+ if new_index >= orig_nodes_len {
706
706
false
707
707
} else {
708
708
* index = new_index;
0 commit comments