@@ -488,11 +488,13 @@ impl<'a> CoverageSpansGenerator<'a> {
488
488
}
489
489
while let Some ( curr) = self . sorted_spans_iter . next ( ) {
490
490
debug ! ( "FOR curr={:?}" , curr) ;
491
- if self . some_prev . is_some ( ) && self . prev_starts_after_next ( & curr) {
491
+ if let Some ( prev) = & self . some_prev && prev. span . lo ( ) > curr. span . lo ( ) {
492
+ // Skip curr because prev has already advanced beyond the end of curr.
493
+ // This can only happen if a prior iteration updated `prev` to skip past
494
+ // a region of code, such as skipping past a closure.
492
495
debug ! (
493
496
" prev.span starts after curr.span, so curr will be dropped (skipping past \
494
- closure?); prev={:?}",
495
- self . prev( )
497
+ closure?); prev={prev:?}",
496
498
) ;
497
499
} else {
498
500
// Save a copy of the original span for `curr` in case the `CoverageSpan` is changed
@@ -506,13 +508,6 @@ impl<'a> CoverageSpansGenerator<'a> {
506
508
false
507
509
}
508
510
509
- /// Returns true if the curr span should be skipped because prev has already advanced beyond the
510
- /// end of curr. This can only happen if a prior iteration updated `prev` to skip past a region
511
- /// of code, such as skipping past a closure.
512
- fn prev_starts_after_next ( & self , next_curr : & CoverageSpan ) -> bool {
513
- self . prev ( ) . span . lo ( ) > next_curr. span . lo ( )
514
- }
515
-
516
511
/// If `prev`s span extends left of the closure (`curr`), carve out the closure's span from
517
512
/// `prev`'s span. (The closure's coverage counters will be injected when processing the
518
513
/// closure's own MIR.) Add the portion of the span to the left of the closure; and if the span
0 commit comments