Skip to content

Commit 67bd5f5

Browse files
committed
Prefer remapping the relative library/ and compiler/ directories
This is done to avoid leaking the relative paths to the standard library after the overall of filenames. Noted that the paths were already leaking before, but to a lesser extent since the paths embedded in the distributed `rlib` were absolute. In general Cargo compiles workspace members with relative paths, so it's better anyway to remap the relative path. cf https://rust-lang.zulipchat.com/#narrow/channel/131828-t-compiler/topic/remapping.20of.20the.20standard.20library/near/564093571
1 parent 8188f6c commit 67bd5f5

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

src/bootstrap/src/core/builder/cargo.rs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1032,10 +1032,7 @@ impl Builder<'_> {
10321032
self.build.debuginfo_map_to(GitRepo::Rustc, RemapScheme::Compiler)
10331033
{
10341034
// When building compiler sources, we want to apply the compiler remap scheme.
1035-
cargo.env(
1036-
"RUSTC_DEBUGINFO_MAP",
1037-
format!("{}={}", self.build.src.display(), map_to),
1038-
);
1035+
cargo.env("RUSTC_DEBUGINFO_MAP", format!("compiler/={map_to}/compiler"));
10391036
cargo.env("CFG_VIRTUAL_RUSTC_DEV_SOURCE_BASE_DIR", map_to);
10401037
}
10411038
}
@@ -1047,10 +1044,7 @@ impl Builder<'_> {
10471044
if let Some(ref map_to) =
10481045
self.build.debuginfo_map_to(GitRepo::Rustc, RemapScheme::NonCompiler)
10491046
{
1050-
cargo.env(
1051-
"RUSTC_DEBUGINFO_MAP",
1052-
format!("{}={}", self.build.src.display(), map_to),
1053-
);
1047+
cargo.env("RUSTC_DEBUGINFO_MAP", format!("library/={map_to}/library"));
10541048
}
10551049
}
10561050
}

0 commit comments

Comments
 (0)