about summary refs log tree commit diff
path: root/compiler/rustc_metadata/src/rmeta
diff options
context:
space:
mode:
authorMichael Woerister <michaelwoerister@posteo>2022-05-05 17:26:22 +0200
committerMichael Woerister <michaelwoerister@posteo>2022-05-18 12:19:01 +0200
commit6411fef3aba5ba54a02b54b171b4e9bc83687ce9 (patch)
tree9bd85eea74036c0f5b6dc32f074f4c72d105014e /compiler/rustc_metadata/src/rmeta
parent9e7b0ff2e11fba83c5d87cf871e6531d94edb2e5 (diff)
downloadrust-6411fef3aba5ba54a02b54b171b4e9bc83687ce9.tar.gz
rust-6411fef3aba5ba54a02b54b171b4e9bc83687ce9.zip
Properly apply path prefix remapping paths emitted into debuginfo.
Diffstat (limited to 'compiler/rustc_metadata/src/rmeta')
-rw-r--r--compiler/rustc_metadata/src/rmeta/encoder.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/compiler/rustc_metadata/src/rmeta/encoder.rs b/compiler/rustc_metadata/src/rmeta/encoder.rs
index a382209e206..086f1bd94b6 100644
--- a/compiler/rustc_metadata/src/rmeta/encoder.rs
+++ b/compiler/rustc_metadata/src/rmeta/encoder.rs
@@ -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 =