cargo-miri: better error message when RUSTC is not set

This commit is contained in:
Robin Appelman 2023-07-02 16:53:29 +02:00
parent 918f39375f
commit cc4670f54d

View file

@ -80,7 +80,11 @@ fn main() {
match first.as_str() {
"miri" => phase_cargo_miri(args),
"runner" => phase_runner(args, RunnerPhase::Cargo),
arg if arg == env::var("RUSTC").unwrap() => {
arg if arg == env::var("RUSTC").unwrap_or_else(|_| {
show_error!(
"`cargo-miri` called without RUSTC set; please only invoke this binary through `cargo miri`"
)
}) => {
// If the first arg is equal to the RUSTC env variable (which should be set at this
// point), then we need to behave as rustc. This is the somewhat counter-intuitive
// behavior of having both RUSTC and RUSTC_WRAPPER set