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.
This commit is contained in:
Matthias Krüger 2022-05-07 22:44:42 +02:00 committed by GitHub
commit 2dcb6fdc1d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 2 deletions

View File

@ -664,8 +664,6 @@ fn run(self, builder: &Builder<'_>) {
&[], &[],
); );
// 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_TEST_SUITE", builder.rustc(compiler));
cargo.env("RUSTC_LIB_PATH", builder.rustc_libdir(compiler)); cargo.env("RUSTC_LIB_PATH", builder.rustc_libdir(compiler));
let host_libs = builder.stage_out(compiler, Mode::ToolRustc).join(builder.cargo_dir()); let host_libs = builder.stage_out(compiler, Mode::ToolRustc).join(builder.cargo_dir());

View File

@ -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 // if tools are using lzma we want to force the build script to build its
// own copy // own copy
cargo.env("LZMA_API_STATIC", "1"); cargo.env("LZMA_API_STATIC", "1");