Skip to content

Commit 7d12d2f

Browse files
committed
Auto merge of rust-lang#2950 - icewind1991:cargo-miri-rustc-error, r=RalfJung
cargo-miri: better error message when RUSTC is not set Currently, when running `cargo-miri` instead of `cargo miri` you get a very confusing. ``` thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: NotPresent', src/tools/miri/cargo-miri/src/main.rs:83:41 ``` error. This replaces that with a message telling them to use `cargo miri`
2 parents a6eb25a + cc4670f commit 7d12d2f

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)