Skip to content

Commit 9fff866

Browse files
authored
Rollup merge of #112435 - antoyo:allow-overwrite-sysroot, r=Mark-Simulacrum
Allow overwriting the sysroot compile flag via --rustc-args Hi. As discussed on [Zulip](https://rust-lang.zulipchat.com/#narrow/stream/182449-t-compiler.2Fhelp/topic/How.20to.20overwrite.20sysroot.20in.20x.2Epy.20test/near/364272269), this is a solution to allow the codegens to overwrite the sysroot as part of their test suite. Thanks for the review.
2 parents be0f3bd + 8d5e856 commit 9fff866

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/tools/compiletest/src/runtest.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1951,7 +1951,9 @@ impl<'test> TestCx<'test> {
19511951
rustc.arg("-Ztranslate-remapped-path-to-local-path=no");
19521952

19531953
// Optionally prevent default --sysroot if specified in test compile-flags.
1954-
if !self.props.compile_flags.iter().any(|flag| flag.starts_with("--sysroot")) {
1954+
if !self.props.compile_flags.iter().any(|flag| flag.starts_with("--sysroot"))
1955+
&& !self.config.host_rustcflags.iter().any(|flag| flag == "--sysroot")
1956+
{
19551957
// In stage 0, make sure we use `stage0-sysroot` instead of the bootstrap sysroot.
19561958
rustc.arg("--sysroot").arg(&self.config.sysroot_base);
19571959
}

0 commit comments

Comments
 (0)