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