Skip to content

Commit ad9308c

Browse files
committed
bootstrap: fully rely on RUSTC_WRAPPER
1 parent c1e3f03 commit ad9308c

File tree

2 files changed

+6
-11
lines changed

2 files changed

+6
-11
lines changed

src/bootstrap/src/bin/rustc.rs

+4-9
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
//! never get replaced.
1717
1818
use std::env;
19-
use std::path::{Path, PathBuf};
19+
use std::path::PathBuf;
2020
use std::process::{Child, Command};
2121
use std::time::Instant;
2222

@@ -75,17 +75,12 @@ fn main() {
7575
args.drain(..2);
7676
rustc_real
7777
} else {
78+
// The first param is the clippy-driver we should call.
7879
args.remove(0)
7980
}
8081
} else {
81-
// Cargo doesn't respect RUSTC_WRAPPER for version information >:(
82-
// don't remove the first arg if we're being run as RUSTC instead of RUSTC_WRAPPER.
83-
// Cargo also sometimes doesn't pass the `.exe` suffix on Windows - add it manually.
84-
let current_exe = env::current_exe().expect("couldn't get path to rustc shim");
85-
let arg0 = exe(args[0].to_str().expect("only utf8 paths are supported"), &host);
86-
if Path::new(&arg0) == current_exe {
87-
args.remove(0);
88-
}
82+
// We are RUSTC_WRAPPER; remove the dummy rustc invocation we wrap.
83+
args.remove(0);
8984
rustc_real
9085
};
9186

src/bootstrap/src/core/builder.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1754,8 +1754,8 @@ impl<'a> Builder<'a> {
17541754
// NOTE: we intentionally use RUSTC_WRAPPER so that we can support clippy - RUSTC is not
17551755
// respected by clippy-driver; RUSTC_WRAPPER happens earlier, before clippy runs.
17561756
cargo.env("RUSTC_WRAPPER", self.bootstrap_out.join("rustc"));
1757-
// NOTE: we also need to set RUSTC so cargo can run `rustc -vV`; apparently that ignores RUSTC_WRAPPER >:(
1758-
cargo.env("RUSTC", self.bootstrap_out.join("rustc"));
1757+
// Set RUSTC to a non-existent path: it should never be called, since we always invoke the wrapper!
1758+
cargo.env("RUSTC", "/path/to/nowhere/all-rustc-calls-should-go-through-the-wrapper");
17591759

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

0 commit comments

Comments
 (0)