1
Fork 0

Properly apply path prefix remapping paths emitted into debuginfo.

This commit is contained in:
Michael Woerister 2022-05-05 17:26:22 +02:00
parent 9e7b0ff2e1
commit 6411fef3ab
9 changed files with 193 additions and 73 deletions

View file

@ -500,6 +500,13 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> {
(!source_file.is_imported() || self.is_proc_macro)
})
.map(|(_, source_file)| {
// At export time we expand all source file paths to absolute paths because
// downstream compilation sessions can have a different compiler working
// directory, so relative paths from this or any other upstream crate
// won't be valid anymore.
//
// At this point we also erase the actual on-disk path and only keep
// the remapped version -- as is necessary for reproducible builds.
match source_file.name {
FileName::Real(ref original_file_name) => {
let adapted_file_name =