File tree Expand file tree Collapse file tree 1 file changed +17
-18
lines changed
compiler/rustc_mir_transform/src/coverage Expand file tree Collapse file tree 1 file changed +17
-18
lines changed Original file line number Diff line number Diff line change @@ -419,26 +419,25 @@ impl<'a> TraverseCoverageGraphWithLoops<'a> {
419419 ) ;
420420
421421 while let Some ( context) = self . context_stack . last_mut ( ) {
422- if let Some ( bcb) = context. worklist . pop_front ( ) {
423- if !self . visited . insert ( bcb) {
424- debug ! ( "Already visited: {bcb:?}" ) ;
425- continue ;
426- }
427- debug ! ( "Visiting {bcb:?}" ) ;
428-
429- if self . backedges [ bcb] . len ( ) > 0 {
430- debug ! ( "{bcb:?} is a loop header! Start a new TraversalContext..." ) ;
431- self . context_stack . push ( TraversalContext {
432- loop_header : Some ( bcb) ,
433- worklist : VecDeque :: new ( ) ,
434- } ) ;
435- }
436- self . add_successors_to_worklists ( bcb) ;
437- return Some ( bcb) ;
438- } else {
439- // Strip contexts with empty worklists from the top of the stack
422+ let Some ( bcb) = context. worklist . pop_front ( ) else {
423+ // This stack level is exhausted; pop it and try the next one.
440424 self . context_stack . pop ( ) ;
425+ continue ;
426+ } ;
427+
428+ if !self . visited . insert ( bcb) {
429+ debug ! ( "Already visited: {bcb:?}" ) ;
430+ continue ;
431+ }
432+ debug ! ( "Visiting {bcb:?}" ) ;
433+
434+ if self . backedges [ bcb] . len ( ) > 0 {
435+ debug ! ( "{bcb:?} is a loop header! Start a new TraversalContext..." ) ;
436+ self . context_stack
437+ . push ( TraversalContext { loop_header : Some ( bcb) , worklist : VecDeque :: new ( ) } ) ;
441438 }
439+ self . add_successors_to_worklists ( bcb) ;
440+ return Some ( bcb) ;
442441 }
443442
444443 None
You can’t perform that action at this time.
0 commit comments