Skip to content

Commit 58436e9

Browse files
committed
Auto merge of #1769 - RalfJung:remove-compat, r=oli-obk
remove compatibility code for passing miri flags via cargo arguments With #1540, we deprecated `cargo miri test -- -Zmiri-disable-stacked-borrows` as a style of passing flags to Miri, introducing `MIRIFLAGS="-Zmiri-disable-stacked-borrows" cargo miri test` instead. This made `cargo miri` more compatible with `cargo`; both now behave the same in terms of argument parsing. However, to avoid breaking things, I introduced some backwards compatibility hack such that the old way would still work. Six months later, I think it is time to remove that hack.
2 parents 36176cd + eaba4b2 commit 58436e9

File tree

1 file changed

+2
-40
lines changed

1 file changed

+2
-40
lines changed

cargo-miri/bin.rs

+2-40
Original file line numberDiff line numberDiff line change
@@ -506,46 +506,8 @@ fn phase_cargo_miri(mut args: env::Args) {
506506
&host
507507
};
508508

509-
// Forward all further arguments. We do some processing here because we want to
510-
// detect people still using the old way of passing flags to Miri
511-
// (`cargo miri -- -Zmiri-foo`).
512-
while let Some(arg) = args.next() {
513-
cmd.arg(&arg);
514-
if arg == "--" {
515-
// Check if the next argument starts with `-Zmiri`. If yes, we assume
516-
// this is an old-style invocation.
517-
if let Some(next_arg) = args.next() {
518-
if next_arg.starts_with("-Zmiri") || next_arg == "--" {
519-
eprintln!(
520-
"WARNING: it seems like you are setting Miri's flags in `cargo miri` the old way,\n\
521-
i.e., by passing them after the first `--`. This style is deprecated; please set\n\
522-
the MIRIFLAGS environment variable instead. `cargo miri run/test` now interprets\n\
523-
arguments the exact same way as `cargo run/test`."
524-
);
525-
// Old-style invocation. Turn these into MIRIFLAGS, if there are any.
526-
if next_arg != "--" {
527-
let mut miriflags = env::var("MIRIFLAGS").unwrap_or_default();
528-
miriflags.push(' ');
529-
miriflags.push_str(&next_arg);
530-
while let Some(further_arg) = args.next() {
531-
if further_arg == "--" {
532-
// End of the Miri flags!
533-
break;
534-
}
535-
miriflags.push(' ');
536-
miriflags.push_str(&further_arg);
537-
}
538-
env::set_var("MIRIFLAGS", miriflags);
539-
}
540-
// Pass the remaining flags to cargo.
541-
cmd.args(args);
542-
break;
543-
}
544-
// Not a Miri argument after all, make sure we pass it to cargo.
545-
cmd.arg(next_arg);
546-
}
547-
}
548-
}
509+
// Forward all further arguments to cargo.
510+
cmd.args(args);
549511

550512
// Set `RUSTC_WRAPPER` to ourselves. Cargo will prepend that binary to its usual invocation,
551513
// i.e., the first argument is `rustc` -- which is what we use in `main` to distinguish

0 commit comments

Comments
 (0)