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