Skip to content

Commit 259d47c

Browse files
committed
improve comments and docs
Signed-off-by: onur-ozkan <[email protected]>
1 parent 622cccf commit 259d47c

File tree

9 files changed

+27
-28
lines changed

9 files changed

+27
-28
lines changed

src/bootstrap/defaults/config.library.toml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
# These defaults are meant for contributors to the standard library and documentation.
22
[build]
3-
# When building the standard library, you almost never want to build the compiler itself.
43
build-stage = 1
54
test-stage = 1
65
bench-stage = 1
@@ -10,8 +9,10 @@ bench-stage = 1
109
incremental = true
1110
# Make the compiler and standard library faster to build, at the expense of a ~20% runtime slowdown.
1211
lto = "off"
13-
# Download rustc by default for library profile if compiler-affecting
14-
# directories are not modified. For CI this is disabled.
12+
# When building the standard library, you almost never want to build the compiler itself.
13+
#
14+
# If compiler-affecting directories are not modified, use precompiled rustc to speed up
15+
# library development by skipping compiler builds.
1516
download-rustc = "if-unchanged"
1617

1718
[llvm]

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ impl Step for Std {
6666
let compiler = builder.compiler(builder.top_stage, builder.config.build);
6767

6868
if builder.top_stage == 0 {
69-
// Reuse the beta compiler's libstd
69+
// Reuse the stage0 libstd
7070
builder.ensure(compile::Std::new(compiler, target));
7171
return;
7272
}

src/bootstrap/src/core/build_steps/compile.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1032,7 +1032,7 @@ impl Step for Rustc {
10321032
let compiler = self.compiler;
10331033
let target = self.target;
10341034

1035-
// NOTE: the ABI of the beta compiler is different from the ABI of the downloaded compiler,
1035+
// NOTE: the ABI of the stage0 compiler is different from the ABI of the downloaded compiler,
10361036
// so its artifacts can't be reused.
10371037
if builder.download_rustc() && compiler.stage != 0 {
10381038
trace!(stage = compiler.stage, "`download_rustc` requested");
@@ -1787,9 +1787,9 @@ impl Step for Sysroot {
17871787
t!(fs::create_dir_all(&sysroot));
17881788

17891789
// In some cases(see https://github.com/rust-lang/rust/issues/109314), when the stage0
1790-
// compiler relies on more recent version of LLVM than the beta compiler, it may not
1790+
// compiler relies on more recent version of LLVM than the stage0 compiler, it may not
17911791
// be able to locate the correct LLVM in the sysroot. This situation typically occurs
1792-
// when we upgrade LLVM version while the beta compiler continues to use an older version.
1792+
// when we upgrade LLVM version while the stage0 compiler continues to use an older version.
17931793
//
17941794
// Make sure to add the correct version of LLVM into the stage0 sysroot.
17951795
if compiler.stage == 0 {

src/bootstrap/src/core/build_steps/test.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1570,7 +1570,7 @@ impl Step for Compiletest {
15701570

15711571
if builder.top_stage == 0 && env::var("COMPILETEST_FORCE_STAGE0").is_err() {
15721572
eprintln!("\
1573-
ERROR: `--stage 0` runs compiletest on the beta compiler, not your local changes, and will almost always cause tests to fail
1573+
ERROR: `--stage 0` runs compiletest on the stage0 (precompiled) compiler, not your local changes, and will almost always cause tests to fail
15741574
HELP: to test the compiler, use `--stage 1` instead
15751575
HELP: to test the standard library, use `--stage 0 library/std` instead
15761576
NOTE: if you're sure you want to do this, please open an issue as to why. In the meantime, you can override this with `COMPILETEST_FORCE_STAGE0=1`."
@@ -1598,9 +1598,9 @@ NOTE: if you're sure you want to do this, please open an issue as to why. In the
15981598
// NOTE: Only stage 1 is special cased because we need the rustc_private artifacts to match the
15991599
// running compiler in stage 2 when plugins run.
16001600
let (stage, stage_id) = if suite == "ui-fulldeps" && compiler.stage == 1 {
1601-
// At stage 0 (stage - 1) we are using the beta compiler. Using `self.target` can lead
1602-
// finding an incorrect compiler path on cross-targets, as the stage 0 beta compiler is
1603-
// always equal to `build.build` in the configuration.
1601+
// At stage 0 (stage - 1) we are using the stage0 compiler. Using `self.target` can lead
1602+
// finding an incorrect compiler path on cross-targets, as the stage 0 is always equal to
1603+
// `build.build` in the configuration.
16041604
let build = builder.build.build;
16051605
compiler = builder.compiler(compiler.stage - 1, build);
16061606
let test_stage = compiler.stage + 1;
@@ -1694,7 +1694,7 @@ NOTE: if you're sure you want to do this, please open an issue as to why. In the
16941694
}
16951695

16961696
if mode == "rustdoc-json" {
1697-
// Use the beta compiler for jsondocck
1697+
// Use the stage0 compiler for jsondocck
16981698
let json_compiler = compiler.with_stage(0);
16991699
cmd.arg("--jsondocck-path")
17001700
.arg(builder.ensure(tool::JsonDocCk { compiler: json_compiler, target }).tool_path);

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,7 @@ mod defaults {
394394
first(cache.all::<tool::ErrorIndex>()),
395395
&[tool::ErrorIndex { compiler: Compiler::new(1, a) }]
396396
);
397-
// docs should be built with the beta compiler, not with the stage0 artifacts.
397+
// docs should be built with the stage0 compiler, not with the stage0 artifacts.
398398
// recall that rustdoc is off-by-one: `stage` is the compiler rustdoc is _linked_ to,
399399
// not the one it was built by.
400400
assert_eq!(

src/bootstrap/src/core/download.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -663,7 +663,7 @@ impl Config {
663663
}
664664
};
665665

666-
// For the beta compiler, put special effort into ensuring the checksums are valid.
666+
// For the stage0 compiler, put special effort into ensuring the checksums are valid.
667667
let checksum = if should_verify {
668668
let error = format!(
669669
"src/stage0 doesn't contain a checksum for {url}. \

src/doc/rustc-dev-guide/src/building/bootstrapping/what-bootstrapping-does.md

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -66,13 +66,12 @@ The stage0 compiler is by default the very recent _beta_ `rustc` compiler and it
6666
associated dynamic libraries, which `./x.py` will download for you. (You can
6767
also configure `./x.py` to change stage0 to something else.)
6868

69-
The stage0 compiler is then used only to compile [`src/bootstrap`] and [`compiler/rustc`].
70-
When assembling the libraries and binaries that will become the stage1 `rustc` compiler,
71-
the freshly compiled `rustc` and beta `std` are used.
69+
The precompiled stage0 compiler is then used only to compile [`src/bootstrap`] and [`compiler/rustc`]
70+
with precompiled stage0 std.
7271

73-
Note that to build the stage1 compiler we use the precompiled beta compiler and beta std from stage0.
74-
Therefore, to use a compiler with a std that is freshly built from the tree, you need to build the
75-
stage2 compiler.
72+
Note that to build the stage1 compiler we use the precompiled stage0 compiler and std.
73+
Therefore, to use a compiler with a std that is freshly built from the tree, you need to
74+
build the stage2 compiler.
7675

7776
There are two concepts at play here: a compiler (with its set of dependencies) and its
7877
'target' or 'object' libraries (`std` and `rustc`). Both are staged, but in a staggered manner.
@@ -87,7 +86,7 @@ The rustc source code is then compiled with the `stage0` compiler to produce the
8786

8887
### Stage 2: the truly current compiler
8988

90-
We then rebuild our `stage1` compiler with in-tree std to produce the `stage2`
89+
We then rebuild the compiler using `stage1` compiler with in-tree std to produce the `stage2`
9190
compiler.
9291

9392
The `stage1` compiler itself was built by precompiled `stage0` compiler and std
@@ -194,8 +193,8 @@ include, but are not limited to:
194193
without building `rustc` from source ('build with `stage0`, then test the
195194
artifacts'). If you're working on the standard library, this is normally the
196195
test command you want.
197-
- `./x build --stage 0` means to build with the beta `rustc`.
198-
- `./x doc --stage 0` means to document using the beta `rustdoc`.
196+
- `./x build --stage 0` means to build with the stage0 `rustc`.
197+
- `./x doc --stage 0` means to document using the stage0 `rustdoc`.
199198

200199
#### Examples of what *not* to do
201200

@@ -442,6 +441,6 @@ compiler itself uses to run. These aren't actually used by artifacts the new
442441
compiler generates. This step also copies the `rustc` and `rustdoc` binaries we
443442
generated into `build/$HOST/stage/bin`.
444443

445-
The `stage1/bin/rustc` is a fully functional compiler built with the beta compiler and std.
446-
To use a compiler built entirely from source with the in-tree compiler and std, you need to build
447-
the stage2 compiler, which is compiled using the stage1 compiler and std.
444+
The `stage1/bin/rustc` is a fully functional compiler built with stage0 (precompiled) compiler and std.
445+
To use a compiler built entirely from source with the in-tree compiler and std, you need to build the
446+
stage2 compiler, which is compiled using the stage1 (in-tree) compiler and std.

src/doc/rustc-dev-guide/src/building/how-to-build-and-run.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,6 @@ you will likely need to build at some point; for example, if you want
269269
to run the entire test suite).
270270

271271
```bash
272-
rustup toolchain link stage0 build/host/stage0-sysroot # beta compiler + beta std
273272
rustup toolchain link stage1 build/host/stage1
274273
rustup toolchain link stage2 build/host/stage2
275274
```

src/doc/rustc-dev-guide/src/building/new-target.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ Look for existing targets to use as examples.
8585
After adding your target to the `rustc_target` crate you may want to add
8686
`core`, `std`, ... with support for your new target. In that case you will
8787
probably need access to some `target_*` cfg. Unfortunately when building with
88-
stage0 (the beta compiler), you'll get an error that the target cfg is
88+
stage0 (a precompiled compiler), you'll get an error that the target cfg is
8989
unexpected because stage0 doesn't know about the new target specification and
9090
we pass `--check-cfg` in order to tell it to check.
9191

0 commit comments

Comments
 (0)