From 367dffc5a3fb2c375ce1f566038605de5b9a9fde Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Thu, 31 Oct 2024 08:00:18 +0100 Subject: [PATCH] bootstrap: show diagnostics relative to rustc src dir --- src/bootstrap/bootstrap.py | 3 ++- src/bootstrap/src/core/builder/cargo.rs | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/bootstrap/bootstrap.py b/src/bootstrap/bootstrap.py index d7ae0299dd696..762f4e653e91b 100644 --- a/src/bootstrap/bootstrap.py +++ b/src/bootstrap/bootstrap.py @@ -1029,7 +1029,8 @@ def build_bootstrap_cmd(self, env): raise Exception("no cargo executable found at `{}`".format( self.cargo())) args = [self.cargo(), "build", "--manifest-path", - os.path.join(self.rust_root, "src/bootstrap/Cargo.toml")] + os.path.join(self.rust_root, "src/bootstrap/Cargo.toml"), + "-Zroot-dir="+self.rust_root] args.extend("--verbose" for _ in range(self.verbose)) if self.use_locked_deps: args.append("--locked") diff --git a/src/bootstrap/src/core/builder/cargo.rs b/src/bootstrap/src/core/builder/cargo.rs index c3d0994f16410..fb1d5b07e1e92 100644 --- a/src/bootstrap/src/core/builder/cargo.rs +++ b/src/bootstrap/src/core/builder/cargo.rs @@ -703,6 +703,9 @@ impl Builder<'_> { cargo.arg("-j").arg(self.jobs().to_string()); + // Make cargo emit diagnostics relative to the rustc src dir. + cargo.arg(format!("-Zroot-dir={}", self.src.display())); + // FIXME: Temporary fix for https://github.com/rust-lang/cargo/issues/3005 // Force cargo to output binaries with disambiguating hashes in the name let mut metadata = if compiler.stage == 0 {