about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAntoni Boucher <bouanto@zoho.com>2023-06-08 17:27:34 -0400
committerAntoni Boucher <bouanto@zoho.com>2023-06-08 17:27:34 -0400
commit8d5e85607d3d52f920990334ae1cfa9798ad9259 (patch)
treece6adb165a62bfa0308516bbdd4c48e83556afda
parenta77659a1e1807ba567f513afe59115af2604dc30 (diff)
downloadrust-8d5e85607d3d52f920990334ae1cfa9798ad9259.tar.gz
rust-8d5e85607d3d52f920990334ae1cfa9798ad9259.zip
Allow overwriting the sysroot compile flag via --rustc-args
-rw-r--r--src/tools/compiletest/src/runtest.rs4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs
index 6582b534488..d16a7d66154 100644
--- a/src/tools/compiletest/src/runtest.rs
+++ b/src/tools/compiletest/src/runtest.rs
@@ -1951,7 +1951,9 @@ impl<'test> TestCx<'test> {
         rustc.arg("-Ztranslate-remapped-path-to-local-path=no");
 
         // Optionally prevent default --sysroot if specified in test compile-flags.
-        if !self.props.compile_flags.iter().any(|flag| flag.starts_with("--sysroot")) {
+        if !self.props.compile_flags.iter().any(|flag| flag.starts_with("--sysroot"))
+            && !self.config.host_rustcflags.iter().any(|flag| flag == "--sysroot")
+        {
             // In stage 0, make sure we use `stage0-sysroot` instead of the bootstrap sysroot.
             rustc.arg("--sysroot").arg(&self.config.sysroot_base);
         }