about summary refs log tree commit diff
path: root/src/bootstrap
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2022-05-07 22:44:42 +0200
committerGitHub <noreply@github.com>2022-05-07 22:44:42 +0200
commit2dcb6fdc1d68eaf93fbbd55516b5ab8b364e897a (patch)
tree5c5a8288349368170700ea5af6503d32b65ff322 /src/bootstrap
parent16892cfe9538941ee941d2908125465c596cfb8f (diff)
parent101f9522651f05d58f7e07d20d841be189841843 (diff)
downloadrust-2dcb6fdc1d68eaf93fbbd55516b5ab8b364e897a.tar.gz
rust-2dcb6fdc1d68eaf93fbbd55516b5ab8b364e897a.zip
Rollup merge of #96757 - jyn514:fewer-clippy-rebuilds, r=Mark-Simulacrum
Don't constantly rebuild clippy on `x test src/tools/clippy`.

This happened because the `SYSROOT` variable was set for `x test`, but not `x build`.
Set it consistently for both to avoid unnecessary rebuilds.

This is a very small step towards https://github.com/rust-lang/rust/issues/76495.
Diffstat (limited to 'src/bootstrap')
-rw-r--r--src/bootstrap/test.rs2
-rw-r--r--src/bootstrap/tool.rs4
2 files changed, 4 insertions, 2 deletions
diff --git a/src/bootstrap/test.rs b/src/bootstrap/test.rs
index 4dfc02dea46..8f2347be90e 100644
--- a/src/bootstrap/test.rs
+++ b/src/bootstrap/test.rs
@@ -664,8 +664,6 @@ impl Step for Clippy {
             &[],
         );
 
-        // clippy tests need to know about the stage sysroot
-        cargo.env("SYSROOT", builder.sysroot(compiler));
         cargo.env("RUSTC_TEST_SUITE", builder.rustc(compiler));
         cargo.env("RUSTC_LIB_PATH", builder.rustc_libdir(compiler));
         let host_libs = builder.stage_out(compiler, Mode::ToolRustc).join(builder.cargo_dir());
diff --git a/src/bootstrap/tool.rs b/src/bootstrap/tool.rs
index fc1c2f04fab..3b30e6de12a 100644
--- a/src/bootstrap/tool.rs
+++ b/src/bootstrap/tool.rs
@@ -250,6 +250,10 @@ pub fn prepare_tool_cargo(
         }
     }
 
+    // clippy tests need to know about the stage sysroot. Set them consistently while building to
+    // avoid rebuilding when running tests.
+    cargo.env("SYSROOT", builder.sysroot(compiler));
+
     // if tools are using lzma we want to force the build script to build its
     // own copy
     cargo.env("LZMA_API_STATIC", "1");