@@ -568,26 +568,27 @@ impl<'a> CoverageSpansGenerator<'a> {
568
568
/// until their disposition is determined. In this latter case, the `prev` dup is moved into
569
569
/// `pending_dups` so the new `curr` dup can be moved to `prev` for the next iteration.
570
570
fn update_pending_dups ( & mut self ) {
571
+ let prev_bcb = self . prev ( ) . bcb ;
572
+ let curr_bcb = self . curr ( ) . bcb ;
573
+
571
574
// Equal coverage spans are ordered by dominators before dominated (if any), so it should be
572
575
// impossible for `curr` to dominate any previous `CoverageSpan`.
573
- debug_assert ! ( !self . span_bcb_dominates ( self . curr ( ) , self . prev ( ) ) ) ;
576
+ debug_assert ! ( !self . basic_coverage_blocks . dominates ( curr_bcb , prev_bcb ) ) ;
574
577
575
578
let initial_pending_count = self . pending_dups . len ( ) ;
576
579
if initial_pending_count > 0 {
577
- let mut pending_dups = self . pending_dups . split_off ( 0 ) ;
578
- let curr = self . curr ( ) ;
579
- pending_dups . retain ( |dup| ! self . span_bcb_dominates ( dup , curr ) ) ;
580
- self . pending_dups . append ( & mut pending_dups ) ;
581
- if self . pending_dups . len ( ) < initial_pending_count {
580
+ self . pending_dups
581
+ . retain ( |dup| ! self . basic_coverage_blocks . dominates ( dup . bcb , curr_bcb ) ) ;
582
+
583
+ let n_discarded = initial_pending_count - self . pending_dups . len ( ) ;
584
+ if n_discarded > 0 {
582
585
debug ! (
583
- " discarded {} of {} pending_dups that dominated curr" ,
584
- initial_pending_count - self . pending_dups. len( ) ,
585
- initial_pending_count
586
+ " discarded {n_discarded} of {initial_pending_count} pending_dups that dominated curr" ,
586
587
) ;
587
588
}
588
589
}
589
590
590
- if self . span_bcb_dominates ( self . prev ( ) , self . curr ( ) ) {
591
+ if self . basic_coverage_blocks . dominates ( prev_bcb , curr_bcb ) {
591
592
debug ! (
592
593
" different bcbs but SAME spans, and prev dominates curr. Discard prev={:?}" ,
593
594
self . prev( )
@@ -652,8 +653,4 @@ impl<'a> CoverageSpansGenerator<'a> {
652
653
self . pending_dups . clear ( ) ;
653
654
}
654
655
}
655
-
656
- fn span_bcb_dominates ( & self , dom_covspan : & CoverageSpan , covspan : & CoverageSpan ) -> bool {
657
- self . basic_coverage_blocks . dominates ( dom_covspan. bcb , covspan. bcb )
658
- }
659
656
}
0 commit comments