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