From 101f9522651f05d58f7e07d20d841be189841843 Mon Sep 17 00:00:00 2001 From: Joshua Nelson Date: Thu, 5 May 2022 20:37:08 -0500 Subject: [PATCH] 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. --- src/bootstrap/test.rs | 2 -- src/bootstrap/tool.rs | 4 ++++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/bootstrap/test.rs b/src/bootstrap/test.rs index 4dfc02dea4605..8f2347be90e86 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 fc1c2f04fabff..3b30e6de12a63 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");