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