@@ -421,38 +421,13 @@ fn in_cargo_miri() {
421
421
}
422
422
423
423
fn inside_cargo_rustc ( ) {
424
- let home = option_env ! ( "RUSTUP_HOME" ) . or ( option_env ! ( "MULTIRUST_HOME" ) ) ;
425
- let toolchain = option_env ! ( "RUSTUP_TOOLCHAIN" ) . or ( option_env ! ( "MULTIRUST_TOOLCHAIN" ) ) ;
426
- let sys_root = if let Ok ( sysroot) = :: std:: env:: var ( "MIRI_SYSROOT" ) {
427
- sysroot
428
- } else if let ( Some ( home) , Some ( toolchain) ) = ( home, toolchain) {
429
- format ! ( "{}/toolchains/{}" , home, toolchain)
430
- } else {
431
- option_env ! ( "RUST_SYSROOT" )
432
- . map ( |s| s. to_owned ( ) )
433
- . or_else ( || {
434
- Command :: new ( "rustc" )
435
- . arg ( "--print" )
436
- . arg ( "sysroot" )
437
- . output ( )
438
- . ok ( )
439
- . and_then ( |out| String :: from_utf8 ( out. stdout ) . ok ( ) )
440
- . map ( |s| s. trim ( ) . to_owned ( ) )
441
- } )
442
- . expect ( "need to specify `RUST_SYSROOT` env var during miri compilation, or use rustup or multirust" )
443
- } ;
424
+ let sysroot = std:: env:: var ( "MIRI_SYSROOT" ) . expect ( "The wrapper should have set MIRI_SYSROOT" ) ;
444
425
445
- // This conditional check for the `--sysroot` flag is there so that users can call `cargo-miri`
446
- // directly without having to pass `--sysroot` or anything.
447
- let rustc_args = std:: env:: args ( ) . skip ( 2 ) ;
448
- let mut args: Vec < String > = if std:: env:: args ( ) . any ( |s| s == "--sysroot" ) {
449
- rustc_args. collect ( )
450
- } else {
451
- rustc_args
426
+ let rustc_args = std:: env:: args ( ) . skip ( 2 ) ; // skip `cargo rustc`
427
+ let mut args: Vec < String > = rustc_args
452
428
. chain ( Some ( "--sysroot" . to_owned ( ) ) )
453
- . chain ( Some ( sys_root) )
454
- . collect ( )
455
- } ;
429
+ . chain ( Some ( sysroot) )
430
+ . collect ( ) ;
456
431
args. splice ( 0 ..0 , miri:: miri_default_args ( ) . iter ( ) . map ( ToString :: to_string) ) ;
457
432
458
433
// See if we can find the `cargo-miri` markers. Those only get added to the binary we want to
0 commit comments