Skip to content

Commit 42dfd15

Browse files
committed
fix -vV under the shim
1 parent 975b8a7 commit 42dfd15

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

src/bootstrap/src/bin/rustc.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,11 @@ fn main() {
8181
args.remove(0)
8282
}
8383
} else {
84-
args.remove(0);
84+
// Cargo doesn't respect RUSTC_WRAPPER for version information >:(
85+
// don't remove the first arg if we're being run as RUSTC instead of RUSTC_WRAPPER.
86+
if args[0] == env::current_exe().expect("couldn't get path to rustc shim") {
87+
args.remove(0);
88+
}
8589
rustc_real
8690
};
8791

src/bootstrap/src/core/builder.rs

+2
Original file line numberDiff line numberDiff line change
@@ -1662,6 +1662,8 @@ impl<'a> Builder<'a> {
16621662
// NOTE: we intentionally use RUSTC_WRAPPER so that we can support clippy - RUSTC is not
16631663
// respected by clippy-driver; RUSTC_WRAPPER happens earlier, before clippy runs.
16641664
cargo.env("RUSTC_WRAPPER", self.bootstrap_out.join("rustc"));
1665+
// NOTE: we also need to set RUSTC so cargo can run `rustc -vV`; apparently that ignores RUSTC_WRAPPER >:(
1666+
cargo.env("RUSTC", self.bootstrap_out.join("rustc"));
16651667

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

0 commit comments

Comments
 (0)