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