File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed
compiler/rustc_data_structures/src/graph/scc Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -535,7 +535,6 @@ where
535535 successors_len: 0 ,
536536 min_cycle_root: initial,
537537 successor_node: initial,
538- // Strictly speaking not necessary, but assumed to be idempotent:
539538 current_component_annotation: ( self . to_annotation) ( initial) ,
540539 } ] ;
541540
@@ -556,7 +555,9 @@ where
556555 let depth = * depth;
557556
558557 // node is definitely in the current component, add it to the annotation.
559- current_component_annotation. update_scc ( ( self . to_annotation ) ( node) ) ;
558+ if node != initial {
559+ current_component_annotation. update_scc ( ( self . to_annotation ) ( node) ) ;
560+ }
560561 debug ! (
561562 "Visiting {node:?} at depth {depth:?}, annotation: {current_component_annotation:?}"
562563 ) ;
@@ -570,8 +571,10 @@ where
570571 debug_assert ! ( matches!( self . node_states[ node] , NodeState :: NotVisited ) ) ;
571572
572573 // Push `node` onto the stack.
573- self . node_states [ node] =
574- NodeState :: BeingVisited { depth, annotation : ( self . to_annotation ) ( node) } ;
574+ self . node_states [ node] = NodeState :: BeingVisited {
575+ depth,
576+ annotation : * current_component_annotation,
577+ } ;
575578 self . node_stack . push ( node) ;
576579
577580 // Walk each successor of the node, looking to see if any of
You can’t perform that action at this time.
0 commit comments