Skip to content

Commit 9b54afa

Browse files
committed
fix -vV under the shim
1 parent 85d0690 commit 9b54afa

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

src/bootstrap/src/bin/rustc.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,11 @@ fn main() {
8383
args.remove(0)
8484
}
8585
} else {
86-
args.remove(0);
86+
// Cargo doesn't respect RUSTC_WRAPPER for version information >:(
87+
// don't remove the first arg if we're being run as RUSTC instead of RUSTC_WRAPPER.
88+
if args[0] == env::current_exe().expect("couldn't get path to rustc shim") {
89+
args.remove(0);
90+
}
8791
rustc_real
8892
};
8993

src/bootstrap/src/core/builder.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1643,6 +1643,8 @@ impl<'a> Builder<'a> {
16431643
// NOTE: we intentionally use RUSTC_WRAPPER so that we can support clippy - RUSTC is not
16441644
// respected by clippy-driver; RUSTC_WRAPPER happens earlier, before clippy runs.
16451645
cargo.env("RUSTC_WRAPPER", self.bootstrap_out.join("rustc"));
1646+
// NOTE: we also need to set RUSTC so cargo can run `rustc -vV`; apparently that ignores RUSTC_WRAPPER >:(
1647+
cargo.env("RUSTC", self.bootstrap_out.join("rustc"));
16461648

16471649
// Someone might have set some previous rustc wrapper (e.g.
16481650
// sccache) before bootstrap overrode it. Respect that variable.

0 commit comments

Comments
 (0)