Skip to content

Commit cfe78d9

Browse files
authored
Rollup merge of #141970 - onur-ozkan:skip-stage1-std, r=Kobzol
implement new `x` flag: `--skip-std-check-if-no-download-rustc` One of our developers (``@RalfJung)`` [reported](https://rust-lang.zulipchat.com/#narrow/channel/326414-t-infra.2Fbootstrap/topic/Surprising.20stages.20for.20check.20build.20after.20stage.20reorg/with/521925606)[#t-infra/bootstrap > Surprising stages for check build after stage reorg](https://rust-lang.zulipchat.com/#narrow/channel/326414-t-infra.2Fbootstrap/topic/Surprising.20stages.20for.20check.20build.20after.20stage.20reorg/with/521925606) that working on both the compiler and the library simultaneously with RA enabled is extremely difficult because checking library creates a heavy load on machines (by building stage1 compiler) on each modification. `--skip-std-check-if-no-download-rustc` flag is intended to reduce this heavy load on their IDE integration as much as possible. Fixes: #141955
2 parents 0ea49dc + c843bec commit cfe78d9

File tree

13 files changed

+217
-48
lines changed

13 files changed

+217
-48
lines changed

src/bootstrap/src/core/build_steps/check.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,13 @@ impl Step for Std {
7777
}
7878

7979
fn run(self, builder: &Builder<'_>) {
80+
if !builder.download_rustc() && builder.config.skip_std_check_if_no_download_rustc {
81+
eprintln!(
82+
"WARNING: `--skip-std-check-if-no-download-rustc` flag was passed and `rust.download-rustc` is not available. Skipping."
83+
);
84+
return;
85+
}
86+
8087
builder.require_submodule("library/stdarch", None);
8188

8289
let stage = self.custom_stage.unwrap_or(builder.top_stage);

src/bootstrap/src/core/config/config.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -423,6 +423,11 @@ pub struct Config {
423423

424424
/// Cache for determining path modifications
425425
pub path_modification_cache: Arc<Mutex<HashMap<Vec<&'static str>, PathFreshness>>>,
426+
427+
/// Skip checking the standard library if `rust.download-rustc` isn't available.
428+
/// This is mostly for RA as building the stage1 compiler to check the library tree
429+
/// on each code change might be too much for some computers.
430+
pub skip_std_check_if_no_download_rustc: bool,
426431
}
427432

428433
#[derive(Debug, Default, Clone, Copy, PartialEq, Eq)]
@@ -1507,6 +1512,7 @@ impl Config {
15071512
config.enable_bolt_settings = flags.enable_bolt_settings;
15081513
config.bypass_bootstrap_lock = flags.bypass_bootstrap_lock;
15091514
config.is_running_on_ci = flags.ci.unwrap_or(CiEnv::is_ci());
1515+
config.skip_std_check_if_no_download_rustc = flags.skip_std_check_if_no_download_rustc;
15101516

15111517
// Infer the rest of the configuration.
15121518

src/bootstrap/src/core/config/flags.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,11 @@ pub struct Flags {
182182
/// Make bootstrap to behave as it's running on the CI environment or not.
183183
#[arg(global = true, long, value_name = "bool")]
184184
pub ci: Option<bool>,
185+
/// Skip checking the standard library if `rust.download-rustc` isn't available.
186+
/// This is mostly for RA as building the stage1 compiler to check the library tree
187+
/// on each code change might be too much for some computers.
188+
#[arg(global = true, long)]
189+
pub skip_std_check_if_no_download_rustc: bool,
185190
}
186191

187192
impl Flags {

src/bootstrap/src/utils/change_tracker.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -416,4 +416,9 @@ pub const CONFIG_CHANGE_HISTORY: &[ChangeInfo] = &[
416416
severity: ChangeSeverity::Warning,
417417
summary: "Stage0 library no longer matches the in-tree library, which means stage1 compiler now uses the beta library.",
418418
},
419+
ChangeInfo {
420+
change_id: 141970,
421+
severity: ChangeSeverity::Info,
422+
summary: "Added new bootstrap flag `--skip-std-check-if-no-download-rustc` that skips std checks when download-rustc is unavailable. Mainly intended for developers to reduce RA overhead.",
423+
},
419424
];

src/doc/rustc-dev-guide/src/building/suggested.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,14 @@ always overrides the inner ones.
5959

6060
## Configuring `rust-analyzer` for `rustc`
6161

62+
### Checking the "library" tree
63+
64+
Checking the "library" tree requires a stage1 compiler, which can be a heavy process on some computers.
65+
For this reason, bootstrap has a flag called `--skip-std-check-if-no-download-rustc` that skips checking the
66+
"library" tree if `rust.download-rustc` isn't available. If you want to avoid putting a heavy load on your computer
67+
with `rust-analyzer`, you can add the `--skip-std-check-if-no-download-rustc` flag to your `./x check` command in
68+
the `rust-analyzer` configuration.
69+
6270
### Project-local rust-analyzer setup
6371

6472
`rust-analyzer` can help you check and format your code whenever you save a

src/etc/completions/x.fish

Lines changed: 24 additions & 1 deletion
Large diffs are not rendered by default.

src/etc/completions/x.ps1

Lines changed: 23 additions & 0 deletions
Large diffs are not rendered by default.

src/etc/completions/x.py.fish

Lines changed: 24 additions & 1 deletion
Large diffs are not rendered by default.

src/etc/completions/x.py.ps1

Lines changed: 23 additions & 0 deletions
Large diffs are not rendered by default.

src/etc/completions/x.py.sh

Lines changed: 23 additions & 23 deletions
Large diffs are not rendered by default.

src/etc/completions/x.py.zsh

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ _x.py() {
5151
'--llvm-profile-generate[generate PGO profile with llvm built for rustc]' \
5252
'--enable-bolt-settings[Enable BOLT link flags]' \
5353
'--skip-stage0-validation[Skip stage0 compiler validation]' \
54+
'--skip-std-check-if-no-download-rustc[Skip checking the standard library if \`rust.download-rustc\` isn'\''t available. This is mostly for RA as building the stage1 compiler to check the library tree on each code change might be too much for some computers]' \
5455
'-h[Print help (see more with '\''--help'\'')]' \
5556
'--help[Print help (see more with '\''--help'\'')]' \
5657
'::paths -- paths for the subcommand:_files' \
@@ -102,6 +103,7 @@ _arguments "${_arguments_options[@]}" : \
102103
'--llvm-profile-generate[generate PGO profile with llvm built for rustc]' \
103104
'--enable-bolt-settings[Enable BOLT link flags]' \
104105
'--skip-stage0-validation[Skip stage0 compiler validation]' \
106+
'--skip-std-check-if-no-download-rustc[Skip checking the standard library if \`rust.download-rustc\` isn'\''t available. This is mostly for RA as building the stage1 compiler to check the library tree on each code change might be too much for some computers]' \
105107
'-h[Print help (see more with '\''--help'\'')]' \
106108
'--help[Print help (see more with '\''--help'\'')]' \
107109
'*::paths -- paths for the subcommand:_files' \
@@ -146,6 +148,7 @@ _arguments "${_arguments_options[@]}" : \
146148
'--llvm-profile-generate[generate PGO profile with llvm built for rustc]' \
147149
'--enable-bolt-settings[Enable BOLT link flags]' \
148150
'--skip-stage0-validation[Skip stage0 compiler validation]' \
151+
'--skip-std-check-if-no-download-rustc[Skip checking the standard library if \`rust.download-rustc\` isn'\''t available. This is mostly for RA as building the stage1 compiler to check the library tree on each code change might be too much for some computers]' \
149152
'-h[Print help (see more with '\''--help'\'')]' \
150153
'--help[Print help (see more with '\''--help'\'')]' \
151154
'*::paths -- paths for the subcommand:_files' \
@@ -196,6 +199,7 @@ _arguments "${_arguments_options[@]}" : \
196199
'--llvm-profile-generate[generate PGO profile with llvm built for rustc]' \
197200
'--enable-bolt-settings[Enable BOLT link flags]' \
198201
'--skip-stage0-validation[Skip stage0 compiler validation]' \
202+
'--skip-std-check-if-no-download-rustc[Skip checking the standard library if \`rust.download-rustc\` isn'\''t available. This is mostly for RA as building the stage1 compiler to check the library tree on each code change might be too much for some computers]' \
199203
'-h[Print help (see more with '\''--help'\'')]' \
200204
'--help[Print help (see more with '\''--help'\'')]' \
201205
'*::paths -- paths for the subcommand:_files' \
@@ -239,6 +243,7 @@ _arguments "${_arguments_options[@]}" : \
239243
'--llvm-profile-generate[generate PGO profile with llvm built for rustc]' \
240244
'--enable-bolt-settings[Enable BOLT link flags]' \
241245
'--skip-stage0-validation[Skip stage0 compiler validation]' \
246+
'--skip-std-check-if-no-download-rustc[Skip checking the standard library if \`rust.download-rustc\` isn'\''t available. This is mostly for RA as building the stage1 compiler to check the library tree on each code change might be too much for some computers]' \
242247
'-h[Print help (see more with '\''--help'\'')]' \
243248
'--help[Print help (see more with '\''--help'\'')]' \
244249
'*::paths -- paths for the subcommand:_files' \
@@ -284,6 +289,7 @@ _arguments "${_arguments_options[@]}" : \
284289
'--llvm-profile-generate[generate PGO profile with llvm built for rustc]' \
285290
'--enable-bolt-settings[Enable BOLT link flags]' \
286291
'--skip-stage0-validation[Skip stage0 compiler validation]' \
292+
'--skip-std-check-if-no-download-rustc[Skip checking the standard library if \`rust.download-rustc\` isn'\''t available. This is mostly for RA as building the stage1 compiler to check the library tree on each code change might be too much for some computers]' \
287293
'-h[Print help (see more with '\''--help'\'')]' \
288294
'--help[Print help (see more with '\''--help'\'')]' \
289295
'*::paths -- paths for the subcommand:_files' \
@@ -329,6 +335,7 @@ _arguments "${_arguments_options[@]}" : \
329335
'--llvm-profile-generate[generate PGO profile with llvm built for rustc]' \
330336
'--enable-bolt-settings[Enable BOLT link flags]' \
331337
'--skip-stage0-validation[Skip stage0 compiler validation]' \
338+
'--skip-std-check-if-no-download-rustc[Skip checking the standard library if \`rust.download-rustc\` isn'\''t available. This is mostly for RA as building the stage1 compiler to check the library tree on each code change might be too much for some computers]' \
332339
'-h[Print help (see more with '\''--help'\'')]' \
333340
'--help[Print help (see more with '\''--help'\'')]' \
334341
'*::paths -- paths for the subcommand:_files' \
@@ -386,6 +393,7 @@ _arguments "${_arguments_options[@]}" : \
386393
'--llvm-profile-generate[generate PGO profile with llvm built for rustc]' \
387394
'--enable-bolt-settings[Enable BOLT link flags]' \
388395
'--skip-stage0-validation[Skip stage0 compiler validation]' \
396+
'--skip-std-check-if-no-download-rustc[Skip checking the standard library if \`rust.download-rustc\` isn'\''t available. This is mostly for RA as building the stage1 compiler to check the library tree on each code change might be too much for some computers]' \
389397
'-h[Print help (see more with '\''--help'\'')]' \
390398
'--help[Print help (see more with '\''--help'\'')]' \
391399
'*::paths -- paths for the subcommand:_files' \
@@ -433,6 +441,7 @@ _arguments "${_arguments_options[@]}" : \
433441
'--llvm-profile-generate[generate PGO profile with llvm built for rustc]' \
434442
'--enable-bolt-settings[Enable BOLT link flags]' \
435443
'--skip-stage0-validation[Skip stage0 compiler validation]' \
444+
'--skip-std-check-if-no-download-rustc[Skip checking the standard library if \`rust.download-rustc\` isn'\''t available. This is mostly for RA as building the stage1 compiler to check the library tree on each code change might be too much for some computers]' \
436445
'-h[Print help (see more with '\''--help'\'')]' \
437446
'--help[Print help (see more with '\''--help'\'')]' \
438447
'*::paths -- paths for the subcommand:_files' \
@@ -477,6 +486,7 @@ _arguments "${_arguments_options[@]}" : \
477486
'--llvm-profile-generate[generate PGO profile with llvm built for rustc]' \
478487
'--enable-bolt-settings[Enable BOLT link flags]' \
479488
'--skip-stage0-validation[Skip stage0 compiler validation]' \
489+
'--skip-std-check-if-no-download-rustc[Skip checking the standard library if \`rust.download-rustc\` isn'\''t available. This is mostly for RA as building the stage1 compiler to check the library tree on each code change might be too much for some computers]' \
480490
'-h[Print help (see more with '\''--help'\'')]' \
481491
'--help[Print help (see more with '\''--help'\'')]' \
482492
'*::paths -- paths for the subcommand:_files' \
@@ -521,6 +531,7 @@ _arguments "${_arguments_options[@]}" : \
521531
'--llvm-profile-generate[generate PGO profile with llvm built for rustc]' \
522532
'--enable-bolt-settings[Enable BOLT link flags]' \
523533
'--skip-stage0-validation[Skip stage0 compiler validation]' \
534+
'--skip-std-check-if-no-download-rustc[Skip checking the standard library if \`rust.download-rustc\` isn'\''t available. This is mostly for RA as building the stage1 compiler to check the library tree on each code change might be too much for some computers]' \
524535
'-h[Print help (see more with '\''--help'\'')]' \
525536
'--help[Print help (see more with '\''--help'\'')]' \
526537
'*::paths -- paths for the subcommand:_files' \
@@ -564,6 +575,7 @@ _arguments "${_arguments_options[@]}" : \
564575
'--llvm-profile-generate[generate PGO profile with llvm built for rustc]' \
565576
'--enable-bolt-settings[Enable BOLT link flags]' \
566577
'--skip-stage0-validation[Skip stage0 compiler validation]' \
578+
'--skip-std-check-if-no-download-rustc[Skip checking the standard library if \`rust.download-rustc\` isn'\''t available. This is mostly for RA as building the stage1 compiler to check the library tree on each code change might be too much for some computers]' \
567579
'-h[Print help (see more with '\''--help'\'')]' \
568580
'--help[Print help (see more with '\''--help'\'')]' \
569581
'*::paths -- paths for the subcommand:_files' \
@@ -607,6 +619,7 @@ _arguments "${_arguments_options[@]}" : \
607619
'--llvm-profile-generate[generate PGO profile with llvm built for rustc]' \
608620
'--enable-bolt-settings[Enable BOLT link flags]' \
609621
'--skip-stage0-validation[Skip stage0 compiler validation]' \
622+
'--skip-std-check-if-no-download-rustc[Skip checking the standard library if \`rust.download-rustc\` isn'\''t available. This is mostly for RA as building the stage1 compiler to check the library tree on each code change might be too much for some computers]' \
610623
'-h[Print help (see more with '\''--help'\'')]' \
611624
'--help[Print help (see more with '\''--help'\'')]' \
612625
'*::paths -- paths for the subcommand:_files' \
@@ -651,6 +664,7 @@ _arguments "${_arguments_options[@]}" : \
651664
'--llvm-profile-generate[generate PGO profile with llvm built for rustc]' \
652665
'--enable-bolt-settings[Enable BOLT link flags]' \
653666
'--skip-stage0-validation[Skip stage0 compiler validation]' \
667+
'--skip-std-check-if-no-download-rustc[Skip checking the standard library if \`rust.download-rustc\` isn'\''t available. This is mostly for RA as building the stage1 compiler to check the library tree on each code change might be too much for some computers]' \
654668
'-h[Print help (see more with '\''--help'\'')]' \
655669
'--help[Print help (see more with '\''--help'\'')]' \
656670
'*::paths -- paths for the subcommand:_files' \
@@ -694,6 +708,7 @@ _arguments "${_arguments_options[@]}" : \
694708
'--llvm-profile-generate[generate PGO profile with llvm built for rustc]' \
695709
'--enable-bolt-settings[Enable BOLT link flags]' \
696710
'--skip-stage0-validation[Skip stage0 compiler validation]' \
711+
'--skip-std-check-if-no-download-rustc[Skip checking the standard library if \`rust.download-rustc\` isn'\''t available. This is mostly for RA as building the stage1 compiler to check the library tree on each code change might be too much for some computers]' \
697712
'-h[Print help (see more with '\''--help'\'')]' \
698713
'--help[Print help (see more with '\''--help'\'')]' \
699714
'::profile -- Either the profile for `bootstrap.toml` or another setup action. May be omitted to set up interactively:_files' \
@@ -739,6 +754,7 @@ _arguments "${_arguments_options[@]}" : \
739754
'--llvm-profile-generate[generate PGO profile with llvm built for rustc]' \
740755
'--enable-bolt-settings[Enable BOLT link flags]' \
741756
'--skip-stage0-validation[Skip stage0 compiler validation]' \
757+
'--skip-std-check-if-no-download-rustc[Skip checking the standard library if \`rust.download-rustc\` isn'\''t available. This is mostly for RA as building the stage1 compiler to check the library tree on each code change might be too much for some computers]' \
742758
'-h[Print help (see more with '\''--help'\'')]' \
743759
'--help[Print help (see more with '\''--help'\'')]' \
744760
'*::paths -- paths for the subcommand:_files' \
@@ -784,6 +800,7 @@ _arguments "${_arguments_options[@]}" : \
784800
'--llvm-profile-generate[generate PGO profile with llvm built for rustc]' \
785801
'--enable-bolt-settings[Enable BOLT link flags]' \
786802
'--skip-stage0-validation[Skip stage0 compiler validation]' \
803+
'--skip-std-check-if-no-download-rustc[Skip checking the standard library if \`rust.download-rustc\` isn'\''t available. This is mostly for RA as building the stage1 compiler to check the library tree on each code change might be too much for some computers]' \
787804
'-h[Print help (see more with '\''--help'\'')]' \
788805
'--help[Print help (see more with '\''--help'\'')]' \
789806
'*::paths -- paths for the subcommand:_files' \
@@ -827,6 +844,7 @@ _arguments "${_arguments_options[@]}" : \
827844
'--llvm-profile-generate[generate PGO profile with llvm built for rustc]' \
828845
'--enable-bolt-settings[Enable BOLT link flags]' \
829846
'--skip-stage0-validation[Skip stage0 compiler validation]' \
847+
'--skip-std-check-if-no-download-rustc[Skip checking the standard library if \`rust.download-rustc\` isn'\''t available. This is mostly for RA as building the stage1 compiler to check the library tree on each code change might be too much for some computers]' \
830848
'-h[Print help (see more with '\''--help'\'')]' \
831849
'--help[Print help (see more with '\''--help'\'')]' \
832850
'::paths -- paths for the subcommand:_files' \
@@ -882,6 +900,7 @@ _arguments "${_arguments_options[@]}" : \
882900
'--llvm-profile-generate[generate PGO profile with llvm built for rustc]' \
883901
'--enable-bolt-settings[Enable BOLT link flags]' \
884902
'--skip-stage0-validation[Skip stage0 compiler validation]' \
903+
'--skip-std-check-if-no-download-rustc[Skip checking the standard library if \`rust.download-rustc\` isn'\''t available. This is mostly for RA as building the stage1 compiler to check the library tree on each code change might be too much for some computers]' \
885904
'-h[Print help (see more with '\''--help'\'')]' \
886905
'--help[Print help (see more with '\''--help'\'')]' \
887906
'*::paths -- paths for the subcommand:_files' \
@@ -928,6 +947,7 @@ _arguments "${_arguments_options[@]}" : \
928947
'--llvm-profile-generate[generate PGO profile with llvm built for rustc]' \
929948
'--enable-bolt-settings[Enable BOLT link flags]' \
930949
'--skip-stage0-validation[Skip stage0 compiler validation]' \
950+
'--skip-std-check-if-no-download-rustc[Skip checking the standard library if \`rust.download-rustc\` isn'\''t available. This is mostly for RA as building the stage1 compiler to check the library tree on each code change might be too much for some computers]' \
931951
'-h[Print help (see more with '\''--help'\'')]' \
932952
'--help[Print help (see more with '\''--help'\'')]' \
933953
'*::paths -- paths for the subcommand:_files' \
@@ -974,6 +994,7 @@ _arguments "${_arguments_options[@]}" : \
974994
'--llvm-profile-generate[generate PGO profile with llvm built for rustc]' \
975995
'--enable-bolt-settings[Enable BOLT link flags]' \
976996
'--skip-stage0-validation[Skip stage0 compiler validation]' \
997+
'--skip-std-check-if-no-download-rustc[Skip checking the standard library if \`rust.download-rustc\` isn'\''t available. This is mostly for RA as building the stage1 compiler to check the library tree on each code change might be too much for some computers]' \
977998
'-h[Print help (see more with '\''--help'\'')]' \
978999
'--help[Print help (see more with '\''--help'\'')]' \
9791000
'*::paths -- paths for the subcommand:_files' \
@@ -1020,6 +1041,7 @@ _arguments "${_arguments_options[@]}" : \
10201041
'--llvm-profile-generate[generate PGO profile with llvm built for rustc]' \
10211042
'--enable-bolt-settings[Enable BOLT link flags]' \
10221043
'--skip-stage0-validation[Skip stage0 compiler validation]' \
1044+
'--skip-std-check-if-no-download-rustc[Skip checking the standard library if \`rust.download-rustc\` isn'\''t available. This is mostly for RA as building the stage1 compiler to check the library tree on each code change might be too much for some computers]' \
10231045
'-h[Print help (see more with '\''--help'\'')]' \
10241046
'--help[Print help (see more with '\''--help'\'')]' \
10251047
':benchmark-id -- Identifier to associate benchmark results with:_default' \
@@ -1064,6 +1086,7 @@ _arguments "${_arguments_options[@]}" : \
10641086
'--llvm-profile-generate[generate PGO profile with llvm built for rustc]' \
10651087
'--enable-bolt-settings[Enable BOLT link flags]' \
10661088
'--skip-stage0-validation[Skip stage0 compiler validation]' \
1089+
'--skip-std-check-if-no-download-rustc[Skip checking the standard library if \`rust.download-rustc\` isn'\''t available. This is mostly for RA as building the stage1 compiler to check the library tree on each code change might be too much for some computers]' \
10671090
'-h[Print help (see more with '\''--help'\'')]' \
10681091
'--help[Print help (see more with '\''--help'\'')]' \
10691092
':base -- The name of the base artifact to be compared:_default' \

0 commit comments

Comments
 (0)