@@ -31,7 +31,7 @@ pub(super) fn mir_to_initial_sorted_coverage_spans(
3131) -> Vec < Vec < SpanFromMir > > {
3232 let & ExtractedHirInfo { body_span, .. } = hir_info;
3333
34- let mut initial_spans = vec ! [ ] ;
34+ let mut covspans = vec ! [ ] ;
3535 let mut holes = vec ! [ ] ;
3636
3737 for ( bcb, bcb_data) in basic_coverage_blocks. iter_enumerated ( ) {
@@ -40,36 +40,36 @@ pub(super) fn mir_to_initial_sorted_coverage_spans(
4040 body_span,
4141 bcb,
4242 bcb_data,
43- & mut initial_spans ,
43+ & mut covspans ,
4444 & mut holes,
4545 ) ;
4646 }
4747
4848 // Only add the signature span if we found at least one span in the body.
49- if !initial_spans . is_empty ( ) || !holes. is_empty ( ) {
49+ if !covspans . is_empty ( ) || !holes. is_empty ( ) {
5050 // If there is no usable signature span, add a fake one (before refinement)
5151 // to avoid an ugly gap between the body start and the first real span.
5252 // FIXME: Find a more principled way to solve this problem.
5353 let fn_sig_span = hir_info. fn_sig_span_extended . unwrap_or_else ( || body_span. shrink_to_lo ( ) ) ;
54- initial_spans . push ( SpanFromMir :: for_fn_sig ( fn_sig_span) ) ;
54+ covspans . push ( SpanFromMir :: for_fn_sig ( fn_sig_span) ) ;
5555 }
5656
57- initial_spans . sort_by ( |a, b| basic_coverage_blocks. cmp_in_dominator_order ( a. bcb , b. bcb ) ) ;
58- remove_unwanted_macro_spans ( & mut initial_spans ) ;
59- split_visible_macro_spans ( & mut initial_spans ) ;
57+ covspans . sort_by ( |a, b| basic_coverage_blocks. cmp_in_dominator_order ( a. bcb , b. bcb ) ) ;
58+ remove_unwanted_macro_spans ( & mut covspans ) ;
59+ split_visible_macro_spans ( & mut covspans ) ;
6060
6161 let compare_covspans = |a : & SpanFromMir , b : & SpanFromMir | {
6262 compare_spans ( a. span , b. span )
6363 // After deduplication, we want to keep only the most-dominated BCB.
6464 . then_with ( || basic_coverage_blocks. cmp_in_dominator_order ( a. bcb , b. bcb ) . reverse ( ) )
6565 } ;
66- initial_spans . sort_by ( compare_covspans) ;
66+ covspans . sort_by ( compare_covspans) ;
6767
6868 // Among covspans with the same span, keep only one,
6969 // preferring the one with the most-dominated BCB.
7070 // (Ideally we should try to preserve _all_ non-dominating BCBs, but that
7171 // requires a lot more complexity in the span refiner, for little benefit.)
72- initial_spans . dedup_by ( |b, a| a. span . source_equal ( b. span ) ) ;
72+ covspans . dedup_by ( |b, a| a. span . source_equal ( b. span ) ) ;
7373
7474 // Sort the holes, and merge overlapping/adjacent holes.
7575 holes. sort_by ( |a, b| compare_spans ( a. span , b. span ) ) ;
@@ -78,7 +78,7 @@ pub(super) fn mir_to_initial_sorted_coverage_spans(
7878 // Now we're ready to start carving holes out of the initial coverage spans,
7979 // and grouping them in buckets separated by the holes.
8080
81- let mut initial_spans = VecDeque :: from ( initial_spans ) ;
81+ let mut input_covspans = VecDeque :: from ( covspans ) ;
8282 let mut fragments: Vec < SpanFromMir > = vec ! [ ] ;
8383
8484 // For each hole:
@@ -93,10 +93,10 @@ pub(super) fn mir_to_initial_sorted_coverage_spans(
9393 // Only inspect spans that precede or overlap this hole,
9494 // leaving the rest to be inspected by later holes.
9595 // (This relies on the spans and holes both being sorted.)
96- let relevant_initial_spans =
97- drain_front_while ( & mut initial_spans , |c| c. span . lo ( ) < hole. span . hi ( ) ) ;
96+ let relevant_input_covspans =
97+ drain_front_while ( & mut input_covspans , |c| c. span . lo ( ) < hole. span . hi ( ) ) ;
9898
99- for covspan in fragments_from_prev. into_iter ( ) . chain ( relevant_initial_spans ) {
99+ for covspan in fragments_from_prev. into_iter ( ) . chain ( relevant_input_covspans ) {
100100 let ( before, after) = covspan. split_around_hole_span ( hole. span ) ;
101101 bucket. extend ( before) ;
102102 fragments. extend ( after) ;
@@ -106,12 +106,12 @@ pub(super) fn mir_to_initial_sorted_coverage_spans(
106106 // After finding the spans before each hole, any remaining fragments/spans
107107 // form their own final bucket, after the final hole.
108108 // (If there were no holes, this will just be all of the initial spans.)
109- fragments. extend ( initial_spans ) ;
109+ fragments. extend ( input_covspans ) ;
110110 buckets. push ( fragments) ;
111111
112112 // Make sure each individual bucket is still internally sorted.
113- for bucket in & mut buckets {
114- bucket . sort_by ( compare_covspans) ;
113+ for covspans in & mut buckets {
114+ covspans . sort_by ( compare_covspans) ;
115115 }
116116 buckets
117117}
@@ -143,9 +143,9 @@ fn drain_front_while<'a, T>(
143143///
144144/// (The input spans should be sorted in BCB dominator order, so that the
145145/// retained "first" span is likely to dominate the others.)
146- fn remove_unwanted_macro_spans ( initial_spans : & mut Vec < SpanFromMir > ) {
146+ fn remove_unwanted_macro_spans ( covspans : & mut Vec < SpanFromMir > ) {
147147 let mut seen_macro_spans = FxHashSet :: default ( ) ;
148- initial_spans . retain ( |covspan| {
148+ covspans . retain ( |covspan| {
149149 // Ignore (retain) non-macro-expansion spans.
150150 if covspan. visible_macro . is_none ( ) {
151151 return true ;
@@ -160,10 +160,10 @@ fn remove_unwanted_macro_spans(initial_spans: &mut Vec<SpanFromMir>) {
160160/// function body, split it into two parts. The first part covers just the
161161/// macro name plus `!`, and the second part covers the rest of the macro
162162/// invocation. This seems to give better results for code that uses macros.
163- fn split_visible_macro_spans ( initial_spans : & mut Vec < SpanFromMir > ) {
163+ fn split_visible_macro_spans ( covspans : & mut Vec < SpanFromMir > ) {
164164 let mut extra_spans = vec ! [ ] ;
165165
166- initial_spans . retain ( |covspan| {
166+ covspans . retain ( |covspan| {
167167 let Some ( visible_macro) = covspan. visible_macro else { return true } ;
168168
169169 let split_len = visible_macro. as_str ( ) . len ( ) as u32 + 1 ;
@@ -183,7 +183,7 @@ fn split_visible_macro_spans(initial_spans: &mut Vec<SpanFromMir>) {
183183
184184 // The newly-split spans are added at the end, so any previous sorting
185185 // is not preserved.
186- initial_spans . extend ( extra_spans) ;
186+ covspans . extend ( extra_spans) ;
187187}
188188
189189// Generate a set of coverage spans from the filtered set of `Statement`s and `Terminator`s of
0 commit comments