@@ -570,26 +570,27 @@ impl<'a> CoverageSpansGenerator<'a> {
570570 /// until their disposition is determined. In this latter case, the `prev` dup is moved into
571571 /// `pending_dups` so the new `curr` dup can be moved to `prev` for the next iteration.
572572 fn update_pending_dups ( & mut self ) {
573+ let prev_bcb = self . prev ( ) . bcb ;
574+ let curr_bcb = self . curr ( ) . bcb ;
575+
573576 // Equal coverage spans are ordered by dominators before dominated (if any), so it should be
574577 // 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 ) ) ;
576579
577580 let initial_pending_count = self . pending_dups . len ( ) ;
578581 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 {
584587 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" ,
588589 ) ;
589590 }
590591 }
591592
592- if self . span_bcb_dominates ( self . prev ( ) , self . curr ( ) ) {
593+ if self . basic_coverage_blocks . dominates ( prev_bcb , curr_bcb ) {
593594 debug ! (
594595 " different bcbs but SAME spans, and prev dominates curr. Discard prev={:?}" ,
595596 self . prev( )
@@ -654,8 +655,4 @@ impl<'a> CoverageSpansGenerator<'a> {
654655 self . pending_dups . clear ( ) ;
655656 }
656657 }
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- }
661658}
0 commit comments