File tree Expand file tree Collapse file tree 1 file changed +14
-2
lines changed
compiler/rustc_codegen_llvm/src/coverageinfo Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ use rustc_codegen_ssa::traits::{BaseTypeCodegenMethods, ConstCodegenMethods};
77use rustc_data_structures:: fx:: FxIndexMap ;
88use rustc_index:: IndexVec ;
99use rustc_middle:: ty:: TyCtxt ;
10- use rustc_span:: { RemapPathScopeComponents , SourceFile , StableSourceFileId } ;
10+ use rustc_span:: { FileName , RemapPathScopeComponents , SourceFile , StableSourceFileId } ;
1111use tracing:: debug;
1212
1313use crate :: common:: CodegenCx ;
@@ -125,7 +125,19 @@ impl GlobalFileTable {
125125
126126 for file in all_files {
127127 raw_file_table. entry ( file. stable_id ) . or_insert_with ( || {
128- file. name . display ( RemapPathScopeComponents :: COVERAGE ) . to_string_lossy ( ) . into_owned ( )
128+ // Prefer using the embeddable filename as this filename is going to
129+ // end-up in the coverage artifacts (see rust-lang/rust#150020).
130+ if let FileName :: Real ( real) = & file. name {
131+ let ( _work_dir, abs_name) =
132+ real. embeddable_name ( RemapPathScopeComponents :: COVERAGE ) ;
133+
134+ abs_name. to_string_lossy ( ) . into_owned ( )
135+ } else {
136+ file. name
137+ . display ( RemapPathScopeComponents :: COVERAGE )
138+ . to_string_lossy ( )
139+ . into_owned ( )
140+ }
129141 } ) ;
130142 }
131143
You can’t perform that action at this time.
0 commit comments