@@ -452,26 +452,28 @@ fn phase_cargo_miri(mut args: env::Args) {
452
452
// Check if the next argument starts with `-Zmiri`. If yes, we assume
453
453
// this is an old-style invocation.
454
454
if let Some ( next_arg) = args. next ( ) {
455
- if next_arg. starts_with ( "-Zmiri" ) {
455
+ if next_arg. starts_with ( "-Zmiri" ) || next_arg == "--" {
456
456
eprintln ! (
457
457
"WARNING: it seems like you are setting Miri's flags in `cargo miri` the old way,\n \
458
458
i.e., by passing them after the first `--`. This style is deprecated; please set\n \
459
459
the MIRIFLAGS environment variable instead. `cargo miri run/test` now interprets\n \
460
460
arguments the exact same way as `cargo run/test`."
461
461
) ;
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 ( ) ;
471
465
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) ;
473
476
}
474
- env:: set_var ( "MIRIFLAGS" , miriflags) ;
475
477
// Pass the remaining flags to cargo.
476
478
cmd. args ( args) ;
477
479
break ;
0 commit comments