@@ -288,7 +288,7 @@ impl<'a> CoverageSpansGenerator<'a> {
288288 // span-processing steps don't make sense yet.
289289 if self . some_prev . is_none ( ) {
290290 debug ! ( " initial span" ) ;
291- self . check_invoked_macro_name_span ( ) ;
291+ self . maybe_push_macro_name_span ( ) ;
292292 continue ;
293293 }
294294
@@ -300,15 +300,15 @@ impl<'a> CoverageSpansGenerator<'a> {
300300 debug ! ( " same bcb (and neither is a closure), merge with prev={prev:?}" ) ;
301301 let prev = self . take_prev ( ) ;
302302 self . curr_mut ( ) . merge_from ( prev) ;
303- self . check_invoked_macro_name_span ( ) ;
303+ self . maybe_push_macro_name_span ( ) ;
304304 // Note that curr.span may now differ from curr_original_span
305305 } else if prev. span . hi ( ) <= curr. span . lo ( ) {
306306 debug ! (
307307 " different bcbs and disjoint spans, so keep curr for next iter, and add prev={prev:?}" ,
308308 ) ;
309309 let prev = self . take_prev ( ) ;
310310 self . push_refined_span ( prev) ;
311- self . check_invoked_macro_name_span ( ) ;
311+ self . maybe_push_macro_name_span ( ) ;
312312 } else if prev. is_closure {
313313 // drop any equal or overlapping span (`curr`) and keep `prev` to test again in the
314314 // next iter
@@ -347,7 +347,7 @@ impl<'a> CoverageSpansGenerator<'a> {
347347 }
348348 } else {
349349 self . cutoff_prev_at_overlapping_curr ( ) ;
350- self . check_invoked_macro_name_span ( ) ;
350+ self . maybe_push_macro_name_span ( ) ;
351351 }
352352 }
353353
@@ -393,7 +393,9 @@ impl<'a> CoverageSpansGenerator<'a> {
393393 }
394394 }
395395
396- fn check_invoked_macro_name_span ( & mut self ) {
396+ /// If `curr` is part of a new macro expansion, carve out and push a separate
397+ /// span that ends just after the macro name and its subsequent `!`.
398+ fn maybe_push_macro_name_span ( & mut self ) {
397399 let curr = self . curr ( ) ;
398400
399401 let Some ( visible_macro) = curr. visible_macro ( self . body_span ) else { return } ;
0 commit comments