@@ -23,7 +23,7 @@ use rustc_middle::ty::TyCtxt;
23
23
use rustc_span:: def_id:: LocalDefId ;
24
24
use rustc_span:: source_map:: SourceMap ;
25
25
use rustc_span:: { BytePos , Pos , RelativeBytePos , Span , Symbol } ;
26
- use tracing:: { debug, debug_span, instrument , trace} ;
26
+ use tracing:: { debug, debug_span, trace} ;
27
27
28
28
use crate :: coverage:: counters:: { CounterIncrementSite , CoverageCounters } ;
29
29
use crate :: coverage:: graph:: CoverageGraph ;
@@ -154,7 +154,7 @@ fn create_mappings<'tcx>(
154
154
155
155
let term_for_bcb =
156
156
|bcb| coverage_counters. term_for_bcb ( bcb) . expect ( "all BCBs with spans were given counters" ) ;
157
- let region_for_span = |span : Span | make_source_region ( source_map, file_name , span , body_span ) ;
157
+ let region_for_span = |span : Span | make_source_region ( source_map, hir_info , file_name , span ) ;
158
158
159
159
// Fully destructure the mappings struct to make sure we don't miss any kinds.
160
160
let ExtractedMappings {
@@ -408,12 +408,11 @@ fn inject_statement(mir_body: &mut mir::Body<'_>, counter_kind: CoverageKind, bb
408
408
/// but it's hard to rule out entirely (especially in the presence of complex macros
409
409
/// or other expansions), and if it does happen then skipping a span or function is
410
410
/// better than an ICE or `llvm-cov` failure that the user might have no way to avoid.
411
- #[ instrument( level = "debug" , skip( source_map) ) ]
412
411
fn make_source_region (
413
412
source_map : & SourceMap ,
413
+ hir_info : & ExtractedHirInfo ,
414
414
file_name : Symbol ,
415
415
span : Span ,
416
- body_span : Span ,
417
416
) -> Option < SourceRegion > {
418
417
let lo = span. lo ( ) ;
419
418
let hi = span. hi ( ) ;
@@ -441,6 +440,7 @@ fn make_source_region(
441
440
// worth of bytes, so that it is more visible in `llvm-cov` reports.
442
441
// We do this after resolving line/column numbers, so that empty spans at the
443
442
// end of a line get an extra column instead of wrapping to the next line.
443
+ let body_span = hir_info. body_span ;
444
444
if span. is_empty ( )
445
445
&& body_span. contains ( span)
446
446
&& let Some ( src) = & file. src
0 commit comments