Skip to content

Commit dbd84f8

Browse files
committed
[WIP] Address review feedback (round 3)
1 parent 222f4fe commit dbd84f8

File tree

1 file changed

+23
-13
lines changed
  • content/inside-rust/stage0-redesign

1 file changed

+23
-13
lines changed

content/inside-rust/stage0-redesign/index.md

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -25,32 +25,42 @@ Notably, this means that after [redesign stage 0 std #119899](https://github.com
2525
- Consequently, default (test, check, bench) stage values in the library profile are no longer `0`, but instead defaults to `1`.
2626
- Some additional `cfg(bootstrap)` usages may be needed in the compiler sources for dogfooding unstable library features.
2727

28-
## Motivation
28+
## Comparison of common invocations
2929

30-
The previous stage 0 bootstrapping sequence was a source of endless confusion for compiler, library and bootstrap contributors alike, because std had to support being built by *both* a previous beta rustc and in-tree rustc, with `cfg(bootstrap)` in std sources necessary to distinguish between them. By adjusting the stage 0 bootstrap sequence to instead use a precompiled stage 0 std instead of building the in-tree std, we hope to (1) simplify library development workflow to no longer need `cfg(bootstrap)` and (2) enable simplifying some bootstrap logic related to building in-tree std in stage 0.
30+
For `profile = "library"`:
3131

32-
This was [originally proposed by @jyn514 in the MCP rust-lang/compiler-team#619](https://github.com/rust-lang/compiler-team/issues/619).
32+
| Invocation | Before stage 0 std redesign | After stage 0 std redesign |
33+
|--------------------------------------------|-------------------------------------------------------------|----------------------------------------------------------|
34+
| `./x {check,build,test} library` | Checks/builds/tests in-tree library | Check/build/tests stage 1 library |
35+
| `./x {check,build,test} library --stage 0` | Checks/builds/tests in-tree library | No-op in case of build, checks/tests precompiled library |
36+
| `./x {check,build,test} library --stage 1` | Builds in-tree library, checks/builds/tests stage 1 library | Check/build/tests stage 1 library |
37+
38+
For `profile = "compiler"`:
39+
40+
| Invocation | Before stage 0 std redesign | After stage 0 std redesign |
41+
|--------------------------------------------|-------------------------------------------------------------|----------------------------------------------------------|
42+
| `./x check library` | Checks in-tree library | Check/build/tests stage 1 library |
43+
| `./x {build,test} library` | Builds in-tree library, builds/tests stage 1 library | Check/build/tests stage 1 library |
44+
| `./x {check,build,test} library --stage 0` | Checks/builds/tests in-tree library | No-op in case of build, checks/tests precompiled library |
45+
| `./x {check,build,test} library --stage 1` | Builds in-tree library, checks/builds/tests stage 1 library | Check/build/tests stage 1 library |
46+
47+
For `profile = "tools"`, by default not affected if `download-rustc` is enabled.
3348

3449
## What does this mean for a typical library workflow?
3550

3651
- Crucially, `./x {build,test,check} library --stage 0` becomes no-op and are no longer supported. Building the in-tree std now requires a stage 1 compiler.
3752
- Consequently, library contributors are *strongly* encouraged to enable `rust.download-rustc = "if-unchanged"` to avoid having to build a stage 1 compiler. Note that this is the default for `profile = "library"`, but you may need to specify it manually if you don't use a `profile`.
3853
- `cfg(bootstrap)` should no longer be needed for library sources.
3954

40-
### Caveat: `libtest` changes
41-
42-
See the *Recommended config: have `compiletest` instead depend on precompiled stage 0 libtest* section below.
43-
4455
## What does this mean for a typical compiler workflow?
4556

4657
- If unstable library features are being dogfooded, some additional `cfg(bootstrap)` usages may now be needed in compiler sources.
4758

48-
### Caveat: `libtest` changes
59+
## Why are we making this change?
4960

50-
See the *Recommended config: have `compiletest` instead depend on precompiled stage 0 libtest* section below.
61+
The previous stage 0 bootstrapping sequence was a source of endless confusion for compiler, library and bootstrap contributors alike, because std had to support being built by *both* a previous beta rustc and in-tree rustc, with `cfg(bootstrap)` in std sources necessary to distinguish between them. By adjusting the stage 0 bootstrap sequence to instead use a precompiled stage 0 std instead of building the in-tree std, we hope to:
5162

52-
## Recommended config: have `compiletest` instead depend on precompiled stage 0 libtest
63+
1. Simplify library development workflow to no longer need `cfg(bootstrap)`, and
64+
2. Enable simplifying some bootstrap logic related to building in-tree std in stage 0.
5365

54-
`compiletest` currently depends on in-tree libtest. For workflows that involve building the compiler, this can cause `compiletest` rebuilds if stage 1 library is rebuilt as a consequence of compiler changes. If you don't intend to change libtest, you can [specify `build.compiletest-use-stage0-libtest = true` to instead have `compiletest` depend on precompiled stage 0 libtest](https://github.com/rust-lang/rust/pull/139386). That way, compiler test iterations can avoid rebuilding `compiletest` unnecessarily. This is already the default unless the `dist` profile is used.
55-
56-
Note that some CI jobs have `build.compiletest-use-stage0-libtest = true` set while others have `build.compiletest-use-stage0-libtest = false`, meaning that libtest programmatic API changes can require adding `cfg(bootstrap)`/`cfg(not(bootstrap))` to `compiletest`'s libtest API use sites. However, in practice we expect this to be very rare.
66+
This was [originally proposed by @jyn514 in the MCP rust-lang/compiler-team#619](https://github.com/rust-lang/compiler-team/issues/619).

0 commit comments

Comments
 (0)