@@ -494,19 +494,20 @@ path = "lib.rs"
494
494
// The `MIRI_CALLED_FROM_XARGO` will mean we dispatch to `phase_setup_rustc`.
495
495
let cargo_miri_path = std:: env:: current_exe ( ) . expect ( "current executable path invalid" ) ;
496
496
if env:: var_os ( "RUSTC_STAGE" ) . is_some ( ) {
497
+ assert ! ( env:: var_os( "RUSTC" ) . is_some( ) ) ;
497
498
command. env ( "RUSTC_REAL" , & cargo_miri_path) ;
498
499
} else {
499
500
command. env ( "RUSTC" , & cargo_miri_path) ;
500
501
}
501
502
command. env ( "MIRI_CALLED_FROM_XARGO" , "1" ) ;
502
- // Make sure there are no other wrappers or flags getting in our way
503
- // (Cc https://github.com/rust-lang/miri/issues/1421).
504
- // This is consistent with normal `cargo build` that does not apply `RUSTFLAGS`
505
- // to the sysroot either.
506
- command . env_remove ( "RUSTC_WRAPPER" ) ;
507
- command . env_remove ( "RUSTFLAGS" ) ;
508
- // Disable debug assertions in the standard library -- Miri is already slow enough.
509
- // But keep the overflow checks, they are cheap .
503
+ // Make sure there are no other wrappers getting in our way
504
+ // (Cc https://github.com/rust-lang/miri/issues/1421, https://github.com/rust-lang/miri/issues/2429 ).
505
+ // Looks like setting `RUSTC_WRAPPER` to the empty string overwrites `build.rustc-wrapper` set via `config.toml`.
506
+ command . env ( "RUSTC_WRAPPER" , "" ) ;
507
+ // Disable debug assertions in the standard library -- Miri is already slow enough. But keep the
508
+ // overflow checks, they are cheap. This completely overwrites flags the user might have set,
509
+ // which is consistent with normal `cargo build` that does not apply `RUSTFLAGS` to the sysroot
510
+ // either .
510
511
command. env ( "RUSTFLAGS" , "-Cdebug-assertions=off -Coverflow-checks=on" ) ;
511
512
// Manage the output the user sees.
512
513
if only_setup {
0 commit comments