about summary refs log tree commit diff
diff options
context:
space:
mode:
authoronur-ozkan <work@onurozkan.dev>2023-11-12 22:34:13 +0300
committeronur-ozkan <work@onurozkan.dev>2023-11-12 22:34:13 +0300
commitb1afb6c49fdcc11988ad6626909731e7f6fa93ac (patch)
tree566060c04135b4dcdfd0e04eacaf83f677046ec4
parent1db4b12494f698754b925f55061eb9e6b3241423 (diff)
downloadrust-b1afb6c49fdcc11988ad6626909731e7f6fa93ac.tar.gz
rust-b1afb6c49fdcc11988ad6626909731e7f6fa93ac.zip
bootstrap: simplify setting unstable-options for tools
We unconditionally set this to avoid recompiling tools between
`x check $tool` and `x test $tool` executions.

See https://github.com/rust-lang/rust/issues/116538 for more information.

Signed-off-by: onur-ozkan <work@onurozkan.dev>
-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 121925b56a0..f2785dee32d 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 d1bc05e51d7..f11a08c8b2b 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
 }