Skip to content

Commit cbc7560

Browse files
committed
Auto merge of #1556 - RalfJung:compat, r=RalfJung
also support old 'cargo miri run -- -- args' style I forgot this in #1540. Again this is just temporary, for backwards compatibility.
2 parents 5a15c8a + 88b9c21 commit cbc7560

File tree

1 file changed

+14
-12
lines changed

1 file changed

+14
-12
lines changed

cargo-miri/bin.rs

+14-12
Original file line numberDiff line numberDiff line change
@@ -452,26 +452,28 @@ fn phase_cargo_miri(mut args: env::Args) {
452452
// Check if the next argument starts with `-Zmiri`. If yes, we assume
453453
// this is an old-style invocation.
454454
if let Some(next_arg) = args.next() {
455-
if next_arg.starts_with("-Zmiri") {
455+
if next_arg.starts_with("-Zmiri") || next_arg == "--" {
456456
eprintln!(
457457
"WARNING: it seems like you are setting Miri's flags in `cargo miri` the old way,\n\
458458
i.e., by passing them after the first `--`. This style is deprecated; please set\n\
459459
the MIRIFLAGS environment variable instead. `cargo miri run/test` now interprets\n\
460460
arguments the exact same way as `cargo run/test`."
461461
);
462-
// Old-style invocation. Turn these into MIRIFLAGS.
463-
let mut miriflags = env::var("MIRIFLAGS").unwrap_or_default();
464-
miriflags.push(' ');
465-
miriflags.push_str(&next_arg);
466-
while let Some(further_arg) = args.next() {
467-
if further_arg == "--" {
468-
// End of the Miri flags!
469-
break;
470-
}
462+
// Old-style invocation. Turn these into MIRIFLAGS, if there are any.
463+
if next_arg != "--" {
464+
let mut miriflags = env::var("MIRIFLAGS").unwrap_or_default();
471465
miriflags.push(' ');
472-
miriflags.push_str(&further_arg);
466+
miriflags.push_str(&next_arg);
467+
while let Some(further_arg) = args.next() {
468+
if further_arg == "--" {
469+
// End of the Miri flags!
470+
break;
471+
}
472+
miriflags.push(' ');
473+
miriflags.push_str(&further_arg);
474+
}
475+
env::set_var("MIRIFLAGS", miriflags);
473476
}
474-
env::set_var("MIRIFLAGS", miriflags);
475477
// Pass the remaining flags to cargo.
476478
cmd.args(args);
477479
break;

0 commit comments

Comments
 (0)