@@ -159,10 +159,6 @@ impl CoverageSpan {
159
159
/// execution
160
160
/// * Carve out (leave uncovered) any span that will be counted by another MIR (notably, closures)
161
161
struct CoverageSpansGenerator < ' a > {
162
- /// A `Span` covering the function body of the MIR (typically from left curly brace to right
163
- /// curly brace).
164
- body_span : Span ,
165
-
166
162
/// The BasicCoverageBlock Control Flow Graph (BCB CFG).
167
163
basic_coverage_blocks : & ' a CoverageGraph ,
168
164
@@ -239,7 +235,6 @@ impl<'a> CoverageSpansGenerator<'a> {
239
235
) ;
240
236
241
237
let coverage_spans = Self {
242
- body_span : hir_info. body_span ,
243
238
basic_coverage_blocks,
244
239
sorted_spans_iter : sorted_spans. into_iter ( ) ,
245
240
some_curr : None ,
@@ -261,7 +256,6 @@ impl<'a> CoverageSpansGenerator<'a> {
261
256
// span-processing steps don't make sense yet.
262
257
if self . some_prev . is_none ( ) {
263
258
debug ! ( " initial span" ) ;
264
- self . maybe_push_macro_name_span ( ) ;
265
259
continue ;
266
260
}
267
261
@@ -273,15 +267,13 @@ impl<'a> CoverageSpansGenerator<'a> {
273
267
debug ! ( " same bcb (and neither is a closure), merge with prev={prev:?}" ) ;
274
268
let prev = self . take_prev ( ) ;
275
269
self . curr_mut ( ) . merge_from ( & prev) ;
276
- self . maybe_push_macro_name_span ( ) ;
277
270
// Note that curr.span may now differ from curr_original_span
278
271
} else if prev. span . hi ( ) <= curr. span . lo ( ) {
279
272
debug ! (
280
273
" different bcbs and disjoint spans, so keep curr for next iter, and add prev={prev:?}" ,
281
274
) ;
282
275
let prev = self . take_prev ( ) ;
283
276
self . refined_spans . push ( prev) ;
284
- self . maybe_push_macro_name_span ( ) ;
285
277
} else if prev. is_closure {
286
278
// drop any equal or overlapping span (`curr`) and keep `prev` to test again in the
287
279
// next iter
@@ -297,7 +289,6 @@ impl<'a> CoverageSpansGenerator<'a> {
297
289
self . update_pending_dups ( ) ;
298
290
} else {
299
291
self . cutoff_prev_at_overlapping_curr ( ) ;
300
- self . maybe_push_macro_name_span ( ) ;
301
292
}
302
293
}
303
294
@@ -332,41 +323,6 @@ impl<'a> CoverageSpansGenerator<'a> {
332
323
self . refined_spans
333
324
}
334
325
335
- /// If `curr` is part of a new macro expansion, carve out and push a separate
336
- /// span that ends just after the macro name and its subsequent `!`.
337
- fn maybe_push_macro_name_span ( & mut self ) {
338
- let curr = self . curr ( ) ;
339
-
340
- let Some ( visible_macro) = curr. visible_macro ( self . body_span ) else { return } ;
341
- if let Some ( prev) = & self . some_prev
342
- && prev. expn_span . eq_ctxt ( curr. expn_span )
343
- {
344
- return ;
345
- }
346
-
347
- // The split point is relative to `curr_original_span`,
348
- // because `curr.span` may have been merged with preceding spans.
349
- let split_point_after_macro_bang = self . curr_original_span . lo ( )
350
- + BytePos ( visible_macro. as_str ( ) . len ( ) as u32 )
351
- + BytePos ( 1 ) ; // add 1 for the `!`
352
- debug_assert ! ( split_point_after_macro_bang <= curr. span. hi( ) ) ;
353
- if split_point_after_macro_bang > curr. span . hi ( ) {
354
- // Something is wrong with the macro name span;
355
- // return now to avoid emitting malformed mappings (e.g. #117788).
356
- return ;
357
- }
358
-
359
- let mut macro_name_cov = curr. clone ( ) ;
360
- macro_name_cov. span = macro_name_cov. span . with_hi ( split_point_after_macro_bang) ;
361
- self . curr_mut ( ) . span = curr. span . with_lo ( split_point_after_macro_bang) ;
362
-
363
- debug ! (
364
- " and curr starts a new macro expansion, so add a new span just for \
365
- the macro `{visible_macro}!`, new span={macro_name_cov:?}",
366
- ) ;
367
- self . refined_spans . push ( macro_name_cov) ;
368
- }
369
-
370
326
#[ track_caller]
371
327
fn curr ( & self ) -> & CoverageSpan {
372
328
self . some_curr . as_ref ( ) . unwrap_or_else ( || bug ! ( "some_curr is None (curr)" ) )
0 commit comments