Hash the remapped sysroot instead of the original.
This will help reproducible builds, as the sysroot depends on the
working directory.
diff --git a/src/librustc/session/config.rs b/src/librustc/session/config.rs
index 3536b2a..0a0f72a 100644
--- a/src/librustc/session/config.rs
+++ b/src/librustc/session/config.rs
@@ -395,7 +395,8 @@
output_types: OutputTypes [TRACKED],
search_paths: Vec<SearchPath> [UNTRACKED],
libs: Vec<(String, Option<String>, Option<cstore::NativeLibraryKind>)> [TRACKED],
- maybe_sysroot: Option<PathBuf> [TRACKED],
+ maybe_sysroot: Option<PathBuf> [UNTRACKED],
+ maybe_sysroot_remapped: Option<PathBuf> [TRACKED],
target_triple: TargetTriple [TRACKED],
@@ -610,6 +611,7 @@
output_types: OutputTypes(BTreeMap::new()),
search_paths: vec![],
maybe_sysroot: None,
+ maybe_sysroot_remapped: None,
target_triple: TargetTriple::from_triple(host_triple()),
test: false,
incremental: None,
@@ -2453,7 +2455,7 @@
let crate_name = matches.opt_str("crate-name");
- let remap_path_prefix = matches
+ let remap_path_prefix: Vec<(PathBuf, PathBuf)> = matches
.opt_strs("remap-path-prefix")
.into_iter()
.map(|remap| {
@@ -2470,6 +2472,10 @@
})
.collect();
+ let sysroot_remapped_opt = sysroot_opt
+ .clone()
+ .map(|sysroot| FilePathMapping::new(remap_path_prefix.clone()).map_prefix(sysroot).0);
+
(
Options {
crate_types,
@@ -2481,6 +2487,7 @@
output_types: OutputTypes(output_types),
search_paths,
maybe_sysroot: sysroot_opt,
+ maybe_sysroot_remapped: sysroot_remapped_opt,
target_triple,
test,
incremental,