about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-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");