avoid passing --sysroot twice in bootstrap

This commit is contained in:
Ralf Jung 2024-04-16 08:52:06 +02:00
parent 2f08c2c965
commit 876ac7b1c3

View File

@ -412,8 +412,11 @@ fn out_filenames() -> Vec<PathBuf> {
// Arguments are treated very differently depending on whether this crate is // Arguments are treated very differently depending on whether this crate is
// for interpretation by Miri, or for use by a build script / proc macro. // for interpretation by Miri, or for use by a build script / proc macro.
if target_crate { if target_crate {
// Set the sysroot. if phase != RustcPhase::Setup {
// Set the sysroot -- except during setup, where we don't have an existing sysroot yet
// and where the bootstrap wrapper adds its own `--sysroot` flag so we can't set ours.
cmd.arg("--sysroot").arg(env::var_os("MIRI_SYSROOT").unwrap()); cmd.arg("--sysroot").arg(env::var_os("MIRI_SYSROOT").unwrap());
}
// Forward arguments, but patched. // Forward arguments, but patched.
let emit_flag = "--emit"; let emit_flag = "--emit";
@ -578,9 +581,9 @@ pub fn phase_runner(mut binary_args: impl Iterator<Item = String>, phase: Runner
} }
if phase != RunnerPhase::Rustdoc { if phase != RunnerPhase::Rustdoc {
// Set the sysroot. Not necessary in rustdoc, where we already set the sysroot when invoking // Set the sysroot. Not necessary in rustdoc, where we already set the sysroot in
// rustdoc itself, which will forward that flag when invoking rustc (i.e., us), so the flag // `phase_rustdoc`. rustdoc will forward that flag when invoking rustc (i.e., us), so the
// is present in `info.args`. // flag is present in `info.args`.
cmd.arg("--sysroot").arg(env::var_os("MIRI_SYSROOT").unwrap()); cmd.arg("--sysroot").arg(env::var_os("MIRI_SYSROOT").unwrap());
} }
// Forward rustc arguments. // Forward rustc arguments.