diff --git a/src/bootstrap/src/bin/rustc.rs b/src/bootstrap/src/bin/rustc.rs index 18f5a1a58db93..b1b98db7dc7ca 100644 --- a/src/bootstrap/src/bin/rustc.rs +++ b/src/bootstrap/src/bin/rustc.rs @@ -16,7 +16,7 @@ //! never get replaced. use std::env; -use std::path::{Path, PathBuf}; +use std::path::PathBuf; use std::process::{Child, Command}; use std::time::Instant; @@ -75,17 +75,12 @@ fn main() { args.drain(..2); rustc_real } else { + // The first param is the clippy-driver we should call. args.remove(0) } } else { - // Cargo doesn't respect RUSTC_WRAPPER for version information >:( - // don't remove the first arg if we're being run as RUSTC instead of RUSTC_WRAPPER. - // Cargo also sometimes doesn't pass the `.exe` suffix on Windows - add it manually. - let current_exe = env::current_exe().expect("couldn't get path to rustc shim"); - let arg0 = exe(args[0].to_str().expect("only utf8 paths are supported"), &host); - if Path::new(&arg0) == current_exe { - args.remove(0); - } + // We are RUSTC_WRAPPER; remove the dummy rustc invocation we wrap. + args.remove(0); rustc_real }; diff --git a/src/bootstrap/src/core/builder.rs b/src/bootstrap/src/core/builder.rs index 9ac0b0a01f7ee..9d67b3a3fd6cc 100644 --- a/src/bootstrap/src/core/builder.rs +++ b/src/bootstrap/src/core/builder.rs @@ -1845,8 +1845,8 @@ impl<'a> Builder<'a> { // NOTE: we intentionally use RUSTC_WRAPPER so that we can support clippy - RUSTC is not // respected by clippy-driver; RUSTC_WRAPPER happens earlier, before clippy runs. cargo.env("RUSTC_WRAPPER", self.bootstrap_out.join("rustc")); - // NOTE: we also need to set RUSTC so cargo can run `rustc -vV`; apparently that ignores RUSTC_WRAPPER >:( - cargo.env("RUSTC", self.bootstrap_out.join("rustc")); + // Set RUSTC to a non-existent path: it should never be called, since we always invoke the wrapper! + cargo.env("RUSTC", "/path/to/nowhere/all-rustc-calls-should-go-through-the-wrapper"); // Someone might have set some previous rustc wrapper (e.g. // sccache) before bootstrap overrode it. Respect that variable.