Skip to content

Commit 876ac7b

Browse files
committed
avoid passing --sysroot twice in bootstrap
1 parent 2f08c2c commit 876ac7b

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

Diff for: src/tools/miri/cargo-miri/src/phases.rs

+8-5
Original file line numberDiff line numberDiff line change
@@ -412,8 +412,11 @@ pub fn phase_rustc(mut args: impl Iterator<Item = String>, phase: RustcPhase) {
412412
// Arguments are treated very differently depending on whether this crate is
413413
// for interpretation by Miri, or for use by a build script / proc macro.
414414
if target_crate {
415-
// Set the sysroot.
416-
cmd.arg("--sysroot").arg(env::var_os("MIRI_SYSROOT").unwrap());
415+
if phase != RustcPhase::Setup {
416+
// Set the sysroot -- except during setup, where we don't have an existing sysroot yet
417+
// and where the bootstrap wrapper adds its own `--sysroot` flag so we can't set ours.
418+
cmd.arg("--sysroot").arg(env::var_os("MIRI_SYSROOT").unwrap());
419+
}
417420

418421
// Forward arguments, but patched.
419422
let emit_flag = "--emit";
@@ -578,9 +581,9 @@ pub fn phase_runner(mut binary_args: impl Iterator<Item = String>, phase: Runner
578581
}
579582

580583
if phase != RunnerPhase::Rustdoc {
581-
// Set the sysroot. Not necessary in rustdoc, where we already set the sysroot when invoking
582-
// rustdoc itself, which will forward that flag when invoking rustc (i.e., us), so the flag
583-
// is present in `info.args`.
584+
// Set the sysroot. Not necessary in rustdoc, where we already set the sysroot in
585+
// `phase_rustdoc`. rustdoc will forward that flag when invoking rustc (i.e., us), so the
586+
// flag is present in `info.args`.
584587
cmd.arg("--sysroot").arg(env::var_os("MIRI_SYSROOT").unwrap());
585588
}
586589
// Forward rustc arguments.

0 commit comments

Comments
 (0)