about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorJoel Galenson <jgalenson@google.com>2019-08-14 08:30:59 -0700
committerJoel Galenson <jgalenson@google.com>2019-08-14 08:30:59 -0700
commit55caf1dcd35789bee98a4fd2b537f57cf7edd77a (patch)
tree29e0a0867e60659e568318fd440f95689b1c67a1 /src
parentc01be67ea40266d6a4c3289654a07ddd7ce2a172 (diff)
downloadrust-55caf1dcd35789bee98a4fd2b537f57cf7edd77a.tar.gz
rust-55caf1dcd35789bee98a4fd2b537f57cf7edd77a.zip
Remap paths for proc-macro crates.
The remap-debuginfo config option remaps paths in most crates, but it
does not apply to proc-macros, so they are still non-reproducible.
This patch fixes that.
Diffstat (limited to 'src')
-rw-r--r--src/bootstrap/bin/rustc.rs10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/bootstrap/bin/rustc.rs b/src/bootstrap/bin/rustc.rs
index 54b689fb062..c524cf646dd 100644
--- a/src/bootstrap/bin/rustc.rs
+++ b/src/bootstrap/bin/rustc.rs
@@ -305,6 +305,16 @@ fn main() {
                 cmd.arg("-C").arg("target-feature=-crt-static");
             }
         }
+
+        let crate_type = args.windows(2)
+            .find(|w| &*w[0] == "--crate-type")
+            .and_then(|w| w[1].to_str());
+
+        if let Some("proc-macro") = crate_type {
+            if let Ok(map) = env::var("RUSTC_DEBUGINFO_MAP") {
+                cmd.arg("--remap-path-prefix").arg(&map);
+            }
+        }
     }
 
     // Force all crates compiled by this compiler to (a) be unstable and (b)