about summary refs log tree commit diff
diff options
context:
space:
mode:
authorTakayuki Maeda <takoyaki0316@gmail.com>2023-11-17 12:56:30 +0900
committerGitHub <noreply@github.com>2023-11-17 12:56:30 +0900
commit3644594cf3d746b8bb7ff53d9fbf92208123bbc6 (patch)
treeaeca04f553562ee0849f64277b9e140eabf71d31
parent2b2dd2514ec80786910d3d562b8dc6629fcb1251 (diff)
parentb1afb6c49fdcc11988ad6626909731e7f6fa93ac (diff)
downloadrust-3644594cf3d746b8bb7ff53d9fbf92208123bbc6.tar.gz
rust-3644594cf3d746b8bb7ff53d9fbf92208123bbc6.zip
Rollup merge of #117850 - onur-ozkan:fix-116538, r=Mark-Simulacrum
bootstrap: simplify setting unstable-options for tools

Previously, we unconditionally(instead of `if path == "src/tools/clippy" || ..`) set this (to prevent recompiling tools between `x check $tool` and '` check $another_tool` executions) specifically for tools in the `x check` step. This PR relocates that logic to `fn prepare_tool_cargo`, making it step-agnostic.

Fixes #116538
Fixes #117983
-rw-r--r--src/bootstrap/src/core/build_steps/check.rs4
-rw-r--r--src/bootstrap/src/core/build_steps/tool.rs10
2 files changed, 10 insertions, 4 deletions
diff --git a/src/bootstrap/src/core/build_steps/check.rs b/src/bootstrap/src/core/build_steps/check.rs
index d36c41906b0..ecaaf91aec1 100644
--- a/src/bootstrap/src/core/build_steps/check.rs
+++ b/src/bootstrap/src/core/build_steps/check.rs
@@ -463,10 +463,6 @@ macro_rules! tool_check_step {
                     cargo.arg("--all-targets");
                 }
 
-                // Enable internal lints for clippy and rustdoc
-                // NOTE: this doesn't enable lints for any other tools unless they explicitly add `#![warn(rustc::internal)]`
-                // See https://github.com/rust-lang/rust/pull/80573#issuecomment-754010776
-                cargo.rustflag("-Zunstable-options");
                 let _guard = builder.msg_check(&concat!(stringify!($name), " artifacts").to_lowercase(), target);
                 run_cargo(
                     builder,
diff --git a/src/bootstrap/src/core/build_steps/tool.rs b/src/bootstrap/src/core/build_steps/tool.rs
index e8327b751d3..37cd96e7c63 100644
--- a/src/bootstrap/src/core/build_steps/tool.rs
+++ b/src/bootstrap/src/core/build_steps/tool.rs
@@ -203,6 +203,16 @@ pub fn prepare_tool_cargo(
     if !features.is_empty() {
         cargo.arg("--features").arg(&features.join(", "));
     }
+
+    // Enable internal lints for clippy and rustdoc
+    // NOTE: this doesn't enable lints for any other tools unless they explicitly add `#![warn(rustc::internal)]`
+    // See https://github.com/rust-lang/rust/pull/80573#issuecomment-754010776
+    //
+    // NOTE: We unconditionally set this here to avoid recompiling tools between `x check $tool`
+    // and `x test $tool` executions.
+    // See https://github.com/rust-lang/rust/issues/116538
+    cargo.rustflag("-Zunstable-options");
+
     cargo
 }