From 4e32edba4d0dcb49710926d6957d026ecd212bfd Mon Sep 17 00:00:00 2001 From: David Venhoek Date: Mon, 7 Sep 2026 14:09:09 +0200 Subject: [PATCH] Rename the src install build step to rust-src. This avoids installing the src component from the command line also triggering a whole lot of other things which are behind the src path. Furthermore, it makes the name match the component as distributed in rustup, reducing confusion. --- bootstrap.example.toml | 2 +- src/bootstrap/src/core/build_steps/install.rs | 4 +-- src/bootstrap/src/core/builder/tests.rs | 36 ++----------------- src/bootstrap/src/utils/change_tracker.rs | 5 +++ 4 files changed, 10 insertions(+), 37 deletions(-) diff --git a/bootstrap.example.toml b/bootstrap.example.toml index 0470b9151ef34..7f4aac63f36a8 100644 --- a/bootstrap.example.toml +++ b/bootstrap.example.toml @@ -431,7 +431,7 @@ # "rust-analyzer", # "rust-analyzer-proc-macro-srv", # "analysis", -# "src", +# "rust-src", # "wasm-component-ld", # "miri", "cargo-miri" # for dev/nightly channels #] diff --git a/src/bootstrap/src/core/build_steps/install.rs b/src/bootstrap/src/core/build_steps/install.rs index db0d18e8368e2..cad6117e686da 100644 --- a/src/bootstrap/src/core/build_steps/install.rs +++ b/src/bootstrap/src/core/build_steps/install.rs @@ -324,12 +324,12 @@ impl CommandLineStep for Src { const IS_HOST: bool = true; fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> { - run.path("src") + run.alias("rust-src") } fn is_default_step(builder: &Builder<'_>) -> bool { let config = &builder.config; - config.extended && config.tools.as_ref().is_none_or(|t| t.contains("src")) + config.extended && config.tools.as_ref().is_none_or(|t| t.contains("rust-src")) } fn make_run(run: RunConfig<'_>) { diff --git a/src/bootstrap/src/core/builder/tests.rs b/src/bootstrap/src/core/builder/tests.rs index 9c613811c8ccc..cc6ac39672950 100644 --- a/src/bootstrap/src/core/builder/tests.rs +++ b/src/bootstrap/src/core/builder/tests.rs @@ -2798,7 +2798,7 @@ mod snapshot { let ctx = TestCtx::new(); insta::assert_snapshot!( ctx.config("install") - .path("src") + .path("rust-src") .args(&[ // Using backslashes fails with `--set` "--set", &format!("install.prefix={}", ctx.normalized_dir()), @@ -2815,36 +2815,7 @@ mod snapshot { .render_with(RenderConfig { normalize_host: false }), @r" - [build] llvm - [build] rustc 0 -> rustc 1 - [build] rustc 1 -> std 1 - [build] rustc 0 -> UnstableBookGen 1 - [build] rustc 0 -> Rustbook 1 - [doc] unstable-book (book) - [doc] book (book) - [doc] book/first-edition (book) - [doc] book/second-edition (book) - [doc] book/2018-edition (book) - [build] rustdoc 1 - [doc] rustc 1 -> standalone 2 - [doc] rustc 1 -> std 1 crates=[alloc,compiler_builtins,core,panic_abort,panic_unwind,proc_macro,rustc-std-workspace-core,std,std_detect,sysroot,test,unwind] - [build] rustc 1 -> rustc 2 - [build] rustc 1 -> error-index 2 - [doc] rustc 1 -> error-index 2 - [doc] nomicon (book) - [doc] rustc 1 -> reference (book) 2 - [doc] rustdoc (book) - [doc] rust-by-example (book) - [build] rustc 0 -> LintDocs 1 - [doc] rustc (book) - [doc] cargo (book) - [doc] clippy (book) - [doc] embedded-book (book) - [doc] edition-guide (book) - [doc] style-guide (book) - [doc] rustc 1 -> releases 2 [build] rustc 0 -> RustInstaller 1 - [dist] docs [dist] src <> "); } @@ -2854,7 +2825,7 @@ mod snapshot { let ctx = TestCtx::new(); insta::assert_snapshot!( ctx.config("install") - .path("src") + .path("rust-src") .args(&[ // Using backslashes fails with `--set` "--set", &format!("install.prefix={}", ctx.normalized_dir()), @@ -2872,10 +2843,7 @@ mod snapshot { .render_with(RenderConfig { normalize_host: false }), @r" - [build] llvm - [build] rustc 0 -> rustc 1 [build] rustc 0 -> RustInstaller 1 - [dist] docs [dist] src <> "); } diff --git a/src/bootstrap/src/utils/change_tracker.rs b/src/bootstrap/src/utils/change_tracker.rs index 25c0963aa4191..922d969ec1f35 100644 --- a/src/bootstrap/src/utils/change_tracker.rs +++ b/src/bootstrap/src/utils/change_tracker.rs @@ -671,4 +671,9 @@ pub const CONFIG_CHANGE_HISTORY: &[ChangeInfo] = &[ severity: ChangeSeverity::Warning, summary: "The `override-allocator` option has been renamed: The global setting is now `build.allocator` and the per-target setting is `target..allocator`. It can now be set to 'system' to explicitly request the system allocator.", }, + ChangeInfo { + change_id: 162423, + severity: ChangeSeverity::Warning, + summary: "You should now use `x install rust-src` instead of `x install src` to install the standard library source component. If you want to install it as part of a custom `build.tools` set, include `rust-src` in `build.tools.", + }, ];