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 @@ 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_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");