From 55caf1dcd35789bee98a4fd2b537f57cf7edd77a Mon Sep 17 00:00:00 2001 From: Joel Galenson Date: Wed, 14 Aug 2019 08:30:59 -0700 Subject: [PATCH 1/2] 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. --- src/bootstrap/bin/rustc.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/bootstrap/bin/rustc.rs b/src/bootstrap/bin/rustc.rs index 54b689fb062a5..c524cf646dd57 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) From 9e2d02a1a1c657fece7ed4f5c71fbdf484931ddc Mon Sep 17 00:00:00 2001 From: Joel Galenson Date: Wed, 14 Aug 2019 10:47:06 -0700 Subject: [PATCH 2/2] Remap debuginfo for all crates. --- src/bootstrap/bin/rustc.rs | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/src/bootstrap/bin/rustc.rs b/src/bootstrap/bin/rustc.rs index c524cf646dd57..8d59d2e93c0cc 100644 --- a/src/bootstrap/bin/rustc.rs +++ b/src/bootstrap/bin/rustc.rs @@ -287,10 +287,6 @@ fn main() { cmd.arg("-C").arg("target-feature=-crt-static"); } } - - if let Ok(map) = env::var("RUSTC_DEBUGINFO_MAP") { - cmd.arg("--remap-path-prefix").arg(&map); - } } else { // Override linker if necessary. if let Ok(host_linker) = env::var("RUSTC_HOST_LINKER") { @@ -305,16 +301,10 @@ 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); - } - } + 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)