@@ -393,14 +393,16 @@ pub(super) struct TraversalContext {
393393 worklist : VecDeque < BasicCoverageBlock > ,
394394}
395395
396- pub ( super ) struct TraverseCoverageGraphWithLoops {
396+ pub ( super ) struct TraverseCoverageGraphWithLoops < ' a > {
397+ basic_coverage_blocks : & ' a CoverageGraph ,
398+
397399 backedges : IndexVec < BasicCoverageBlock , Vec < BasicCoverageBlock > > ,
398400 context_stack : Vec < TraversalContext > ,
399401 visited : BitSet < BasicCoverageBlock > ,
400402}
401403
402- impl TraverseCoverageGraphWithLoops {
403- pub fn new ( basic_coverage_blocks : & CoverageGraph ) -> Self {
404+ impl < ' a > TraverseCoverageGraphWithLoops < ' a > {
405+ pub ( super ) fn new ( basic_coverage_blocks : & ' a CoverageGraph ) -> Self {
404406 let backedges = find_loop_backedges ( basic_coverage_blocks) ;
405407
406408 let worklist = VecDeque :: from ( [ basic_coverage_blocks. start_node ( ) ] ) ;
@@ -411,7 +413,7 @@ impl TraverseCoverageGraphWithLoops {
411413 // of the stack as loops are entered, and popped off of the stack when a loop's worklist is
412414 // exhausted.
413415 let visited = BitSet :: new_empty ( basic_coverage_blocks. num_nodes ( ) ) ;
414- Self { backedges, context_stack, visited }
416+ Self { basic_coverage_blocks , backedges, context_stack, visited }
415417 }
416418
417419 /// For each loop on the loop context stack (top-down), yields a list of BCBs
@@ -424,7 +426,7 @@ impl TraverseCoverageGraphWithLoops {
424426 . map ( |( from_bcbs, _to_bcb) | from_bcbs. as_slice ( ) )
425427 }
426428
427- pub fn next ( & mut self , basic_coverage_blocks : & CoverageGraph ) -> Option < BasicCoverageBlock > {
429+ pub ( super ) fn next ( & mut self ) -> Option < BasicCoverageBlock > {
428430 debug ! (
429431 "TraverseCoverageGraphWithLoops::next - context_stack: {:?}" ,
430432 self . context_stack. iter( ) . rev( ) . collect:: <Vec <_>>( )
@@ -445,7 +447,7 @@ impl TraverseCoverageGraphWithLoops {
445447 worklist : VecDeque :: new ( ) ,
446448 } ) ;
447449 }
448- self . extend_worklist ( basic_coverage_blocks , bcb) ;
450+ self . extend_worklist ( bcb) ;
449451 return Some ( bcb) ;
450452 } else {
451453 // Strip contexts with empty worklists from the top of the stack
@@ -456,11 +458,8 @@ impl TraverseCoverageGraphWithLoops {
456458 None
457459 }
458460
459- pub fn extend_worklist (
460- & mut self ,
461- basic_coverage_blocks : & CoverageGraph ,
462- bcb : BasicCoverageBlock ,
463- ) {
461+ pub fn extend_worklist ( & mut self , bcb : BasicCoverageBlock ) {
462+ let Self { basic_coverage_blocks, .. } = * self ;
464463 let successors = & basic_coverage_blocks. successors [ bcb] ;
465464 debug ! ( "{:?} has {} successors:" , bcb, successors. len( ) ) ;
466465 for & successor in successors {
0 commit comments