Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions compiler/rustc_codegen_llvm/src/coverageinfo/mapgen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use rustc_codegen_ssa::traits::{BaseTypeCodegenMethods, ConstCodegenMethods};
use rustc_data_structures::fx::FxIndexMap;
use rustc_index::IndexVec;
use rustc_middle::ty::TyCtxt;
use rustc_span::{RemapPathScopeComponents, SourceFile, StableSourceFileId};
use rustc_span::{FileName, RemapPathScopeComponents, SourceFile, StableSourceFileId};
use tracing::debug;

use crate::common::CodegenCx;
Expand Down Expand Up @@ -125,7 +125,19 @@ impl GlobalFileTable {

for file in all_files {
raw_file_table.entry(file.stable_id).or_insert_with(|| {
file.name.display(RemapPathScopeComponents::COVERAGE).to_string_lossy().into_owned()
// Prefer using the embeddable filename as this filename is going to
// end-up in the coverage artifacts (see rust-lang/rust#150020).
if let FileName::Real(real) = &file.name {
let (_work_dir, abs_name) =
real.embeddable_name(RemapPathScopeComponents::COVERAGE);

abs_name.to_string_lossy().into_owned()
} else {
file.name
.display(RemapPathScopeComponents::COVERAGE)
.to_string_lossy()
.into_owned()
}
});
}

Expand Down
Loading