Skip to content

Commit cc4670f

Browse files
committed
cargo-miri: better error message when RUSTC is not set
1 parent 918f393 commit cc4670f

File tree

1 file changed

+5
-1
lines changed
  • src/tools/miri/cargo-miri/src

1 file changed

+5
-1
lines changed

src/tools/miri/cargo-miri/src/main.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,11 @@ fn main() {
8080
match first.as_str() {
8181
"miri" => phase_cargo_miri(args),
8282
"runner" => phase_runner(args, RunnerPhase::Cargo),
83-
arg if arg == env::var("RUSTC").unwrap() => {
83+
arg if arg == env::var("RUSTC").unwrap_or_else(|_| {
84+
show_error!(
85+
"`cargo-miri` called without RUSTC set; please only invoke this binary through `cargo miri`"
86+
)
87+
}) => {
8488
// If the first arg is equal to the RUSTC env variable (which should be set at this
8589
// point), then we need to behave as rustc. This is the somewhat counter-intuitive
8690
// behavior of having both RUSTC and RUSTC_WRAPPER set

0 commit comments

Comments
 (0)