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