Skip to content

Commit 9bdb94f

Browse files
committed
Hack around build script issue
1 parent 2e1ede7 commit 9bdb94f

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

src/bin/cargo-miri.rs

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -476,12 +476,19 @@ fn in_cargo_miri() {
476476
fn inside_cargo_rustc() {
477477
let sysroot = std::env::var("MIRI_SYSROOT").expect("The wrapper should have set MIRI_SYSROOT");
478478

479+
479480
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+
};
485492

486493
// See if we can find the `cargo-miri` markers. Those only get added to the binary we want to
487494
// run. They also serve to mark the user-defined arguments, which we have to move all the way

0 commit comments

Comments
 (0)