Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 938866d

Browse files
committedNov 30, 2024
Auto merge of #132390 - RalfJung:diagnostics-root-dir, r=albertlarsan68
bootstrap: show diagnostics relative to rustc src dir Fixes #128726 Depends on rust-lang/cargo#14752 propagating to bootstrap cargo
2 parents 7442931 + c4cab8a commit 938866d

8 files changed

+11
-7
lines changed
 

‎src/bootstrap/bootstrap.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -1029,7 +1029,8 @@ def build_bootstrap_cmd(self, env):
10291029
raise Exception("no cargo executable found at `{}`".format(
10301030
self.cargo()))
10311031
args = [self.cargo(), "build", "--manifest-path",
1032-
os.path.join(self.rust_root, "src/bootstrap/Cargo.toml")]
1032+
os.path.join(self.rust_root, "src/bootstrap/Cargo.toml"),
1033+
"-Zroot-dir="+self.rust_root]
10331034
args.extend("--verbose" for _ in range(self.verbose))
10341035
if self.use_locked_deps:
10351036
args.append("--locked")

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

+3
Original file line numberDiff line numberDiff line change
@@ -703,6 +703,9 @@ impl Builder<'_> {
703703

704704
cargo.arg("-j").arg(self.jobs().to_string());
705705

706+
// Make cargo emit diagnostics relative to the rustc src dir.
707+
cargo.arg(format!("-Zroot-dir={}", self.src.display()));
708+
706709
// FIXME: Temporary fix for https://github.com/rust-lang/cargo/issues/3005
707710
// Force cargo to output binaries with disambiguating hashes in the name
708711
let mut metadata = if compiler.stage == 0 {
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
thread 'main' panicked at core/src/panicking.rs:$LINE:$COL:
1+
thread 'main' panicked at library/core/src/panicking.rs:$LINE:$COL:
22
attempted to compute the size or alignment of extern type `Opaque`
33
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
44
thread caused non-unwinding panic. aborting.
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
thread 'main' panicked at core/src/panicking.rs:$LINE:$COL:
1+
thread 'main' panicked at library/core/src/panicking.rs:$LINE:$COL:
22
attempted to compute the size or alignment of extern type `A`
33
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
44
thread caused non-unwinding panic. aborting.
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
thread 'main' panicked at core/src/panicking.rs:$LINE:$COL:
1+
thread 'main' panicked at library/core/src/panicking.rs:$LINE:$COL:
22
attempted to compute the size or alignment of extern type `A`
33
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
44
thread caused non-unwinding panic. aborting.

‎tests/ui/panics/panic-in-cleanup.run.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
44
thread 'main' panicked at $DIR/panic-in-cleanup.rs:16:9:
55
BOOM
66
stack backtrace:
7-
thread 'main' panicked at core/src/panicking.rs:$LINE:$COL:
7+
thread 'main' panicked at library/core/src/panicking.rs:$LINE:$COL:
88
panic in a destructor during cleanup
99
thread caused non-unwinding panic. aborting.

‎tests/ui/panics/panic-in-ffi.run.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ thread 'main' panicked at $DIR/panic-in-ffi.rs:21:5:
22
Test
33
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
44
Noisy Drop
5-
thread 'main' panicked at core/src/panicking.rs:$LINE:$COL:
5+
thread 'main' panicked at library/core/src/panicking.rs:$LINE:$COL:
66
panic in a function that cannot unwind
77
stack backtrace:
88
thread caused non-unwinding panic. aborting.
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
thread 'main' panicked at std/src/io/stdio.rs:LL:CC:
1+
thread 'main' panicked at library/std/src/io/stdio.rs:LL:CC:
22
failed printing to stdout: Broken pipe (os error 32)
33
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

0 commit comments

Comments
 (0)
Failed to load comments.