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