Skip to content

Commit 542ee0b

Browse files
committed
Make cargo miri run work within the rustc repo
1 parent d0e3b42 commit 542ee0b

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

cargo-miri/bin.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -871,6 +871,14 @@ fn phase_rustc(mut args: env::Args, phase: RustcPhase) {
871871
cmd.arg("-C").arg("panic=abort");
872872
}
873873
} else {
874+
if !print {
875+
// When we're running `cargo-miri` from `x.py` we need to pass the sysroot explicitly as rustc
876+
// can't figure out the sysroot on its own unless it's from rustup.
877+
if let Some(sysroot) = std::env::var_os("SYSROOT") {
878+
cmd.arg("--sysroot").arg(sysroot);
879+
}
880+
}
881+
874882
// For host crates or when we are printing, just forward everything.
875883
cmd.args(args);
876884
}

0 commit comments

Comments
 (0)