Auto merge of #2259 - RalfJung:cargo-rustc, r=RalfJung

avoid setting both RUSTC and RUSTC_WRAPPER

Fixes https://github.com/rust-lang/miri/issues/2238
This commit is contained in:
bors 2022-06-22 17:05:03 +00:00
commit 35023f50c0

View File

@ -638,6 +638,14 @@ fn phase_cargo_miri(mut args: env::Args) {
); );
} }
cmd.env("RUSTC_WRAPPER", &cargo_miri_path); cmd.env("RUSTC_WRAPPER", &cargo_miri_path);
// Having both `RUSTC_WRAPPER` and `RUSTC` set does some odd things, so let's avoid that.
// See <https://github.com/rust-lang/miri/issues/2238>.
if env::var_os("RUSTC").is_some() && env::var_os("MIRI").is_none() {
println!(
"WARNING: Ignoring `RUSTC` environment variable; set `MIRI` if you want to control the binary used as the driver."
);
}
cmd.env_remove("RUSTC");
let runner_env_name = let runner_env_name =
|triple: &str| format!("CARGO_TARGET_{}_RUNNER", triple.to_uppercase().replace('-', "_")); |triple: &str| format!("CARGO_TARGET_{}_RUNNER", triple.to_uppercase().replace('-', "_"));