@@ -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