@@ -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
}
@@ -428,6 +428,12 @@ impl<'a> CoverageSpansGenerator<'a> {
428
428
. unwrap_or_else ( || bug ! ( "invalid attempt to unwrap a None some_curr" ) )
429
429
}
430
430
431
+ /// If called, then the next call to `next_coverage_span()` will *not* update `prev` with the
432
+ /// `curr` coverage span.
433
+ fn take_curr ( & mut self ) -> CoverageSpan {
434
+ self . some_curr . take ( ) . unwrap_or_else ( || bug ! ( "invalid attempt to unwrap a None some_curr" ) )
435
+ }
436
+
431
437
fn prev ( & self ) -> & CoverageSpan {
432
438
self . some_prev
433
439
. as_ref ( )
@@ -497,12 +503,6 @@ impl<'a> CoverageSpansGenerator<'a> {
497
503
false
498
504
}
499
505
500
- /// If called, then the next call to `next_coverage_span()` will *not* update `prev` with the
501
- /// `curr` coverage span.
502
- fn take_curr ( & mut self ) -> CoverageSpan {
503
- self . some_curr . take ( ) . unwrap_or_else ( || bug ! ( "invalid attempt to unwrap a None some_curr" ) )
504
- }
505
-
506
506
/// Returns true if the curr span should be skipped because prev has already advanced beyond the
507
507
/// end of curr. This can only happen if a prior iteration updated `prev` to skip past a region
508
508
/// of code, such as skipping past a closure.
@@ -549,7 +549,7 @@ impl<'a> CoverageSpansGenerator<'a> {
549
549
dup. span = dup. span . with_lo ( right_cutoff) ;
550
550
}
551
551
self . pending_dups . append ( & mut pending_dups) ;
552
- let closure_covspan = self . take_curr ( ) ;
552
+ let closure_covspan = self . take_curr ( ) ; // Prevent this curr from becoming prev.
553
553
self . push_refined_span ( closure_covspan) ; // since self.prev() was already updated
554
554
} else {
555
555
pending_dups. clear ( ) ;
0 commit comments