@@ -566,26 +566,27 @@ impl<'a> CoverageSpansGenerator<'a> {
566566 /// until their disposition is determined. In this latter case, the `prev` dup is moved into
567567 /// `pending_dups` so the new `curr` dup can be moved to `prev` for the next iteration.
568568 fn update_pending_dups ( & mut self ) {
569+ let prev_bcb = self . prev ( ) . bcb ;
570+ let curr_bcb = self . curr ( ) . bcb ;
571+
569572 // Equal coverage spans are ordered by dominators before dominated (if any), so it should be
570573 // 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 ) ) ;
572575
573576 let initial_pending_count = self . pending_dups . len ( ) ;
574577 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 {
580583 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" ,
584585 ) ;
585586 }
586587 }
587588
588- if self . span_bcb_dominates ( self . prev ( ) , self . curr ( ) ) {
589+ if self . basic_coverage_blocks . dominates ( prev_bcb , curr_bcb ) {
589590 debug ! (
590591 " different bcbs but SAME spans, and prev dominates curr. Discard prev={:?}" ,
591592 self . prev( )
@@ -650,8 +651,4 @@ impl<'a> CoverageSpansGenerator<'a> {
650651 self . pending_dups . clear ( ) ;
651652 }
652653 }
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- }
657654}
0 commit comments