Skip to content

Commit 3670d25

Browse files
committed
Auto merge of #162423 - davidv1992:install-rust-src, r=Kobzol
Rename the src install build step to rust-src. This avoids installing the src component from the command line also triggering installing 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.
2 parents 6eeff9a + abcb978 commit 3670d25

5 files changed

Lines changed: 11 additions & 38 deletions

File tree

‎bootstrap.example.toml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -431,7 +431,7 @@
431431
# "rust-analyzer",
432432
# "rust-analyzer-proc-macro-srv",
433433
# "analysis",
434-
# "src",
434+
# "rust-src",
435435
# "wasm-component-ld",
436436
# "miri", "cargo-miri" # for dev/nightly channels
437437
#]

‎src/bootstrap/src/core/build_steps/install.rs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -324,12 +324,12 @@ impl CommandLineStep for Src {
324324
const IS_HOST: bool = true;
325325

326326
fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
327-
run.path("src")
327+
run.alias("rust-src")
328328
}
329329

330330
fn is_default_step(builder: &Builder<'_>) -> bool {
331331
let config = &builder.config;
332-
config.extended && config.tools.as_ref().is_none_or(|t| t.contains("src"))
332+
config.extended && config.tools.as_ref().is_none_or(|t| t.contains("rust-src"))
333333
}
334334

335335
fn make_run(run: RunConfig<'_>) {

‎src/bootstrap/src/core/builder/tests.rs‎

Lines changed: 2 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -2798,7 +2798,7 @@ mod snapshot {
27982798
let ctx = TestCtx::new();
27992799
insta::assert_snapshot!(
28002800
ctx.config("install")
2801-
.path("src")
2801+
.path("rust-src")
28022802
.args(&[
28032803
// Using backslashes fails with `--set`
28042804
"--set", &format!("install.prefix={}", ctx.normalized_dir()),
@@ -2815,36 +2815,7 @@ mod snapshot {
28152815
.render_with(RenderConfig {
28162816
normalize_host: false
28172817
}), @r"
2818-
[build] llvm <x86_64-unknown-linux-gnu>
2819-
[build] rustc 0 <x86_64-unknown-linux-gnu> -> rustc 1 <x86_64-unknown-linux-gnu>
2820-
[build] rustc 1 <x86_64-unknown-linux-gnu> -> std 1 <x86_64-unknown-linux-gnu>
2821-
[build] rustc 0 <x86_64-unknown-linux-gnu> -> UnstableBookGen 1 <x86_64-unknown-linux-gnu>
2822-
[build] rustc 0 <x86_64-unknown-linux-gnu> -> Rustbook 1 <x86_64-unknown-linux-gnu>
2823-
[doc] unstable-book (book) <x86_64-unknown-linux-gnu>
2824-
[doc] book (book) <x86_64-unknown-linux-gnu>
2825-
[doc] book/first-edition (book) <x86_64-unknown-linux-gnu>
2826-
[doc] book/second-edition (book) <x86_64-unknown-linux-gnu>
2827-
[doc] book/2018-edition (book) <x86_64-unknown-linux-gnu>
2828-
[build] rustdoc 1 <x86_64-unknown-linux-gnu>
2829-
[doc] rustc 1 <x86_64-unknown-linux-gnu> -> standalone 2 <x86_64-unknown-linux-gnu>
2830-
[doc] rustc 1 <x86_64-unknown-linux-gnu> -> std 1 <x86_64-unknown-linux-gnu> crates=[alloc,compiler_builtins,core,panic_abort,panic_unwind,proc_macro,rustc-std-workspace-core,std,std_detect,sysroot,test,unwind]
2831-
[build] rustc 1 <x86_64-unknown-linux-gnu> -> rustc 2 <x86_64-unknown-linux-gnu>
2832-
[build] rustc 1 <x86_64-unknown-linux-gnu> -> error-index 2 <x86_64-unknown-linux-gnu>
2833-
[doc] rustc 1 <x86_64-unknown-linux-gnu> -> error-index 2 <x86_64-unknown-linux-gnu>
2834-
[doc] nomicon (book) <x86_64-unknown-linux-gnu>
2835-
[doc] rustc 1 <x86_64-unknown-linux-gnu> -> reference (book) 2 <x86_64-unknown-linux-gnu>
2836-
[doc] rustdoc (book) <x86_64-unknown-linux-gnu>
2837-
[doc] rust-by-example (book) <x86_64-unknown-linux-gnu>
2838-
[build] rustc 0 <x86_64-unknown-linux-gnu> -> LintDocs 1 <x86_64-unknown-linux-gnu>
2839-
[doc] rustc (book) <x86_64-unknown-linux-gnu>
2840-
[doc] cargo (book) <x86_64-unknown-linux-gnu>
2841-
[doc] clippy (book) <x86_64-unknown-linux-gnu>
2842-
[doc] embedded-book (book) <x86_64-unknown-linux-gnu>
2843-
[doc] edition-guide (book) <x86_64-unknown-linux-gnu>
2844-
[doc] style-guide (book) <x86_64-unknown-linux-gnu>
2845-
[doc] rustc 1 <x86_64-unknown-linux-gnu> -> releases 2 <x86_64-unknown-linux-gnu>
28462818
[build] rustc 0 <x86_64-unknown-linux-gnu> -> RustInstaller 1 <x86_64-unknown-linux-gnu>
2847-
[dist] docs <x86_64-unknown-linux-gnu>
28482819
[dist] src <>
28492820
");
28502821
}
@@ -2854,7 +2825,7 @@ mod snapshot {
28542825
let ctx = TestCtx::new();
28552826
insta::assert_snapshot!(
28562827
ctx.config("install")
2857-
.path("src")
2828+
.path("rust-src")
28582829
.args(&[
28592830
// Using backslashes fails with `--set`
28602831
"--set", &format!("install.prefix={}", ctx.normalized_dir()),
@@ -2872,10 +2843,7 @@ mod snapshot {
28722843
.render_with(RenderConfig {
28732844
normalize_host: false
28742845
}), @r"
2875-
[build] llvm <x86_64-unknown-linux-gnu>
2876-
[build] rustc 0 <x86_64-unknown-linux-gnu> -> rustc 1 <x86_64-unknown-linux-gnu>
28772846
[build] rustc 0 <x86_64-unknown-linux-gnu> -> RustInstaller 1 <x86_64-unknown-linux-gnu>
2878-
[dist] docs <x86_64-unknown-linux-gnu>
28792847
[dist] src <>
28802848
");
28812849
}

‎src/bootstrap/src/utils/change_tracker.rs‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -671,4 +671,9 @@ pub const CONFIG_CHANGE_HISTORY: &[ChangeInfo] = &[
671671
severity: ChangeSeverity::Warning,
672672
summary: "The `override-allocator` option has been renamed: The global setting is now `build.allocator` and the per-target setting is `target.<target>.allocator`. It can now be set to 'system' to explicitly request the system allocator.",
673673
},
674+
ChangeInfo {
675+
change_id: 162423,
676+
severity: ChangeSeverity::Warning,
677+
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.",
678+
},
674679
];

‎src/ci/docker/host-x86_64/test-x86_64-fuchsia/install-rust-for-fuchsia.sh‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ set -ex
55
# Build the components of Rust that are needed by the Fuchsia build system.
66
python3 ../x.py install \
77
--target=$TARGETS \
8-
compiler/rustc library/std clippy rustfmt src
8+
compiler/rustc library/std clippy rustfmt rust-src
99

1010
# The Fuchsia build system requires that shared libraries that are used inside Fuchsia are stripped,
1111
# so use `llvm-objcopy` to remove the debug symbols and strip the libraries, but keeping the

0 commit comments

Comments
 (0)