about summary refs log tree commit diff
path: root/src/bootstrap
diff options
context:
space:
mode:
authorTshepang Mbambo <hopsi@tuta.io>2025-07-28 08:45:28 +0200
committerGitHub <noreply@github.com>2025-07-28 08:45:28 +0200
commit466198cfaf2ea988a98aee08df10ed1198a3874a (patch)
treee9c9a7f48ae84ba9e277f06252ebdfbe076694e9 /src/bootstrap
parent9c99623b8ade68ae07a6226018732f2512526d34 (diff)
parent645b85e3d508123d45d79dc6e526a06648666c68 (diff)
Merge pull request #2519 from rust-lang/rustc-pull
Rustc pull update
Diffstat (limited to 'src/bootstrap')
-rw-r--r--src/bootstrap/src/core/build_steps/clippy.rs1
-rw-r--r--src/bootstrap/src/core/build_steps/compile.rs5
-rw-r--r--src/bootstrap/src/core/build_steps/test.rs12
-rw-r--r--src/bootstrap/src/core/sanity.rs6
-rw-r--r--src/bootstrap/src/lib.rs26
-rw-r--r--src/bootstrap/src/utils/change_tracker.rs2
-rw-r--r--src/bootstrap/src/utils/shared_helpers.rs22
-rw-r--r--src/bootstrap/src/utils/tests/mod.rs4
-rw-r--r--src/bootstrap/src/utils/tests/shared_helpers_tests.rs (renamed from src/bootstrap/src/utils/shared_helpers/tests.rs)7
9 files changed, 53 insertions, 32 deletions
diff --git a/src/bootstrap/src/core/build_steps/clippy.rs b/src/bootstrap/src/core/build_steps/clippy.rs
index a0371eb7155..b119f2dc3ce 100644
--- a/src/bootstrap/src/core/build_steps/clippy.rs
+++ b/src/bootstrap/src/core/build_steps/clippy.rs
@@ -19,6 +19,7 @@ const IGNORED_RULES_FOR_STD_AND_RUSTC: &[&str] = &[
     "too_many_arguments",
     "needless_lifetimes", // people want to keep the lifetimes
     "wrong_self_convention",
+    "approx_constant", // libcore is what defines those
 ];
 
 fn lint_args(builder: &Builder<'_>, config: &LintConfig, ignored_rules: &[&str]) -> Vec<String> {
diff --git a/src/bootstrap/src/core/build_steps/compile.rs b/src/bootstrap/src/core/build_steps/compile.rs
index c7e7b0160b1..4abfe1843eb 100644
--- a/src/bootstrap/src/core/build_steps/compile.rs
+++ b/src/bootstrap/src/core/build_steps/compile.rs
@@ -597,11 +597,6 @@ pub fn std_cargo(builder: &Builder<'_>, target: TargetSelection, stage: u32, car
 
     let mut features = String::new();
 
-    if stage != 0 && builder.config.default_codegen_backend(target).as_deref() == Some("cranelift")
-    {
-        features += "compiler-builtins-no-f16-f128 ";
-    }
-
     if builder.no_std(target) == Some(true) {
         features += " compiler-builtins-mem";
         if !target.starts_with("bpf") {
diff --git a/src/bootstrap/src/core/build_steps/test.rs b/src/bootstrap/src/core/build_steps/test.rs
index d346062761c..0f9268097d7 100644
--- a/src/bootstrap/src/core/build_steps/test.rs
+++ b/src/bootstrap/src/core/build_steps/test.rs
@@ -1113,6 +1113,12 @@ impl Step for Tidy {
             8 * std::thread::available_parallelism().map_or(1, std::num::NonZeroUsize::get) as u32
         });
         cmd.arg(jobs.to_string());
+        // pass the path to the npm command used for installing js deps.
+        if let Some(npm) = &builder.config.npm {
+            cmd.arg(npm);
+        } else {
+            cmd.arg("npm");
+        }
         if builder.is_verbose() {
             cmd.arg("--verbose");
         }
@@ -3126,7 +3132,11 @@ impl Step for Bootstrap {
     }
 
     fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
-        run.path("src/bootstrap")
+        // Bootstrap tests might not be perfectly self-contained and can depend on the external
+        // environment, submodules that are checked out, etc.
+        // Therefore we only run them by default on CI.
+        let runs_on_ci = run.builder.config.is_running_on_ci;
+        run.path("src/bootstrap").default_condition(runs_on_ci)
     }
 
     fn make_run(run: RunConfig<'_>) {
diff --git a/src/bootstrap/src/core/sanity.rs b/src/bootstrap/src/core/sanity.rs
index b39d464493e..15e04f59129 100644
--- a/src/bootstrap/src/core/sanity.rs
+++ b/src/bootstrap/src/core/sanity.rs
@@ -338,12 +338,6 @@ than building it.
 
         // Make sure musl-root is valid.
         if target.contains("musl") && !target.contains("unikraft") {
-            // If this is a native target (host is also musl) and no musl-root is given,
-            // fall back to the system toolchain in /usr before giving up
-            if build.musl_root(*target).is_none() && build.config.is_host_target(*target) {
-                let target = build.config.target_config.entry(*target).or_default();
-                target.musl_root = Some("/usr".into());
-            }
             match build.musl_libdir(*target) {
                 Some(libdir) => {
                     if fs::metadata(libdir.join("libc.a")).is_err() {
diff --git a/src/bootstrap/src/lib.rs b/src/bootstrap/src/lib.rs
index 63aab4d116a..51a84ad5272 100644
--- a/src/bootstrap/src/lib.rs
+++ b/src/bootstrap/src/lib.rs
@@ -1329,23 +1329,33 @@ impl Build {
         }
     }
 
-    /// Returns the "musl root" for this `target`, if defined
+    /// Returns the "musl root" for this `target`, if defined.
+    ///
+    /// If this is a native target (host is also musl) and no musl-root is given,
+    /// it falls back to the system toolchain in /usr.
     fn musl_root(&self, target: TargetSelection) -> Option<&Path> {
-        self.config
+        let configured_root = self
+            .config
             .target_config
             .get(&target)
             .and_then(|t| t.musl_root.as_ref())
             .or(self.config.musl_root.as_ref())
-            .map(|p| &**p)
+            .map(|p| &**p);
+
+        if self.config.is_host_target(target) && configured_root.is_none() {
+            Some(Path::new("/usr"))
+        } else {
+            configured_root
+        }
     }
 
     /// Returns the "musl libdir" for this `target`.
     fn musl_libdir(&self, target: TargetSelection) -> Option<PathBuf> {
-        let t = self.config.target_config.get(&target)?;
-        if let libdir @ Some(_) = &t.musl_libdir {
-            return libdir.clone();
-        }
-        self.musl_root(target).map(|root| root.join("lib"))
+        self.config
+            .target_config
+            .get(&target)
+            .and_then(|t| t.musl_libdir.clone())
+            .or_else(|| self.musl_root(target).map(|root| root.join("lib")))
     }
 
     /// Returns the `lib` directory for the WASI target specified, if
diff --git a/src/bootstrap/src/utils/change_tracker.rs b/src/bootstrap/src/utils/change_tracker.rs
index f802640a42d..4b0c4821364 100644
--- a/src/bootstrap/src/utils/change_tracker.rs
+++ b/src/bootstrap/src/utils/change_tracker.rs
@@ -439,7 +439,7 @@ pub const CONFIG_CHANGE_HISTORY: &[ChangeInfo] = &[
     ChangeInfo {
         change_id: 143255,
         severity: ChangeSeverity::Warning,
-        summary: "`llvm.lld` is no longer enabled by default for the dist profile.",
+        summary: "`rust.lld` is no longer enabled by default for the dist profile.",
     },
     ChangeInfo {
         change_id: 143251,
diff --git a/src/bootstrap/src/utils/shared_helpers.rs b/src/bootstrap/src/utils/shared_helpers.rs
index 9c6b4a7615d..9428e221f41 100644
--- a/src/bootstrap/src/utils/shared_helpers.rs
+++ b/src/bootstrap/src/utils/shared_helpers.rs
@@ -1,14 +1,18 @@
 //! This module serves two purposes:
-//!     1. It is part of the `utils` module and used in other parts of bootstrap.
-//!     2. It is embedded inside bootstrap shims to avoid a dependency on the bootstrap library.
-//!        Therefore, this module should never use any other bootstrap module. This reduces binary
-//!        size and improves compilation time by minimizing linking time.
+//!
+//! 1. It is part of the `utils` module and used in other parts of bootstrap.
+//! 2. It is embedded inside bootstrap shims to avoid a dependency on the bootstrap library.
+//!    Therefore, this module should never use any other bootstrap module. This reduces binary size
+//!    and improves compilation time by minimizing linking time.
+
+// # Note on tests
+//
+// If we were to declare a tests submodule here, the shim binaries that include this module via
+// `#[path]` would fail to find it, which breaks `./x check bootstrap`. So instead the unit tests
+// for this module are in `super::tests::shared_helpers_tests`.
 
 #![allow(dead_code)]
 
-#[cfg(test)]
-mod tests;
-
 use std::env;
 use std::ffi::OsString;
 use std::fs::OpenOptions;
@@ -16,10 +20,6 @@ use std::io::Write;
 use std::process::Command;
 use std::str::FromStr;
 
-// If we were to declare a tests submodule here, the shim binaries that include this
-// module via `#[path]` would fail to find it, which breaks `./x check bootstrap`.
-// So instead the unit tests for this module are in `super::tests::shared_helpers_tests`.
-
 /// Returns the environment variable which the dynamic library lookup path
 /// resides in for this platform.
 pub fn dylib_path_var() -> &'static str {
diff --git a/src/bootstrap/src/utils/tests/mod.rs b/src/bootstrap/src/utils/tests/mod.rs
index ec87e71e0b6..983680b0385 100644
--- a/src/bootstrap/src/utils/tests/mod.rs
+++ b/src/bootstrap/src/utils/tests/mod.rs
@@ -12,6 +12,10 @@ use crate::{Build, Config, Flags, t};
 
 pub mod git;
 
+// Note: tests for `shared_helpers` is separate here, as otherwise shim binaries that include the
+// `shared_helpers` via `#[path]` would fail to find it, breaking `./x check bootstrap`.
+mod shared_helpers_tests;
+
 /// Holds temporary state of a bootstrap test.
 /// Right now it is only used to redirect the build directory of the bootstrap
 /// invocation, in the future it would be great if we could actually execute
diff --git a/src/bootstrap/src/utils/shared_helpers/tests.rs b/src/bootstrap/src/utils/tests/shared_helpers_tests.rs
index 559e9f70abd..c486e65007e 100644
--- a/src/bootstrap/src/utils/shared_helpers/tests.rs
+++ b/src/bootstrap/src/utils/tests/shared_helpers_tests.rs
@@ -1,3 +1,10 @@
+//! The `shared_helpers` module can't have its own tests submodule, because that would cause
+//! problems for the shim binaries that include it via `#[path]`, so instead those unit tests live
+//! here.
+//!
+//! To prevent tidy from complaining about this file not being named `tests.rs`, it lives inside a
+//! submodule directory named `tests`.
+
 use crate::utils::shared_helpers::parse_value_from_args;
 
 #[test]