File tree Expand file tree Collapse file tree 1 file changed +12
-5
lines changed Expand file tree Collapse file tree 1 file changed +12
-5
lines changed Original file line number Diff line number Diff line change @@ -476,12 +476,19 @@ fn in_cargo_miri() {
476
476
fn inside_cargo_rustc ( ) {
477
477
let sysroot = std:: env:: var ( "MIRI_SYSROOT" ) . expect ( "The wrapper should have set MIRI_SYSROOT" ) ;
478
478
479
+
479
480
let rustc_args = std:: env:: args ( ) . skip ( 2 ) ; // skip `cargo rustc`
480
- let mut args: Vec < String > = rustc_args
481
- . chain ( Some ( "--sysroot" . to_owned ( ) ) )
482
- . chain ( Some ( sysroot) )
483
- . collect ( ) ;
484
- args. splice ( 0 ..0 , miri:: miri_default_args ( ) . iter ( ) . map ( ToString :: to_string) ) ;
481
+
482
+ let mut args = if std:: env:: args ( ) . skip ( 2 ) . find ( |arg| arg == "build_script_build" ) . is_some ( ) {
483
+ rustc_args. collect ( )
484
+ } else {
485
+ let mut args: Vec < String > = rustc_args
486
+ . chain ( Some ( "--sysroot" . to_owned ( ) ) )
487
+ . chain ( Some ( sysroot) )
488
+ . collect ( ) ;
489
+ args. splice ( 0 ..0 , miri:: miri_default_args ( ) . iter ( ) . map ( ToString :: to_string) ) ;
490
+ args
491
+ } ;
485
492
486
493
// See if we can find the `cargo-miri` markers. Those only get added to the binary we want to
487
494
// run. They also serve to mark the user-defined arguments, which we have to move all the way
You can’t perform that action at this time.
0 commit comments