@@ -314,7 +314,7 @@ impl<'a> CoverageSpansGenerator<'a> {
314
314
debug ! (
315
315
" curr overlaps a closure (prev). Drop curr and keep prev for next iter. prev={prev:?}" ,
316
316
) ;
317
- self . take_curr ( ) ;
317
+ self . take_curr ( ) ; // Discards curr.
318
318
} else if curr. is_closure {
319
319
self . carve_out_span_for_closure ( ) ;
320
320
} else if self . prev_original_span == curr. span {
@@ -340,7 +340,7 @@ impl<'a> CoverageSpansGenerator<'a> {
340
340
as prev, but is in a different bcb. Drop curr and keep prev for next iter. \
341
341
prev={prev:?}",
342
342
) ;
343
- self . take_curr ( ) ;
343
+ self . take_curr ( ) ; // Discards curr.
344
344
} else {
345
345
self . hold_pending_dups_unless_dominated ( ) ;
346
346
}
@@ -430,6 +430,12 @@ impl<'a> CoverageSpansGenerator<'a> {
430
430
. unwrap_or_else ( || bug ! ( "invalid attempt to unwrap a None some_curr" ) )
431
431
}
432
432
433
+ /// If called, then the next call to `next_coverage_span()` will *not* update `prev` with the
434
+ /// `curr` coverage span.
435
+ fn take_curr ( & mut self ) -> CoverageSpan {
436
+ self . some_curr . take ( ) . unwrap_or_else ( || bug ! ( "invalid attempt to unwrap a None some_curr" ) )
437
+ }
438
+
433
439
fn prev ( & self ) -> & CoverageSpan {
434
440
self . some_prev
435
441
. as_ref ( )
@@ -499,12 +505,6 @@ impl<'a> CoverageSpansGenerator<'a> {
499
505
false
500
506
}
501
507
502
- /// If called, then the next call to `next_coverage_span()` will *not* update `prev` with the
503
- /// `curr` coverage span.
504
- fn take_curr ( & mut self ) -> CoverageSpan {
505
- self . some_curr . take ( ) . unwrap_or_else ( || bug ! ( "invalid attempt to unwrap a None some_curr" ) )
506
- }
507
-
508
508
/// Returns true if the curr span should be skipped because prev has already advanced beyond the
509
509
/// end of curr. This can only happen if a prior iteration updated `prev` to skip past a region
510
510
/// of code, such as skipping past a closure.
@@ -551,7 +551,7 @@ impl<'a> CoverageSpansGenerator<'a> {
551
551
dup. span = dup. span . with_lo ( right_cutoff) ;
552
552
}
553
553
self . pending_dups . append ( & mut pending_dups) ;
554
- let closure_covspan = self . take_curr ( ) ;
554
+ let closure_covspan = self . take_curr ( ) ; // Prevent this curr from becoming prev.
555
555
self . push_refined_span ( closure_covspan) ; // since self.prev() was already updated
556
556
} else {
557
557
pending_dups. clear ( ) ;
0 commit comments