Skip to content

Commit 7e0d43d

Browse files
committed
[WIP] Address review feedback (round 2)
1 parent 330fecd commit 7e0d43d

File tree

3 files changed

+65
-6
lines changed

3 files changed

+65
-6
lines changed

Diff for: content/inside-rust/stage0-std-redesign.md renamed to content/inside-rust/index.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,18 @@ team_url = "https://www.rust-lang.org/governance/teams/infra#team-bootstrap"
1414

1515
We are reworking how the stage 0 bootstrap sequence works (the sequence used to build a stage 1 compiler).
1616

17-
- Before: a stage 0 (possibly beta) compiler is used to build the in-tree std, which in turn is used to build the stage 1 compiler.
18-
- After: a stage 0 (possibly beta) compiler and a precompiled stage 0 std is instead used to build the stage 1 compiler.
17+
- Before: a stage 0 (beta by default) compiler is used to build the in-tree std, which in turn is used to build the stage 1 compiler.
18+
- After: a stage 0 (beta by default) compiler and a precompiled stage 0 std is instead used to build the stage 1 compiler.
1919

20-
Notably, this means:
20+
Notably, this means that after the stage 0 rework implementation PR [redesign stage 0 std #119899](https://github.com/rust-lang/rust/pull/119899) lands:
2121

2222
- `./x {build,test,check} library --stage 0` becomes no-op, as stage 0 std is no longer the built in-tree std, and the minimum supported stage to build std is now `1`.
2323
- Consequently, default (test, check, bench) stage values in the library profile are no longer `0`, but instead defaults to `1`.
24-
- `cfg(bootstrap)` is no longer needed for library development. In (very) rare cases, `cfg(bootstrap)` may be needed in the compiler for dogfooding unstable library features.
24+
- Some additional `cfg(bootstrap)` usages may be needed in the compiler sources for dogfooding unstable library features.
2525

2626
## Motivation
2727

28-
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 possibly-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.
28+
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.
2929

3030
This was [originally proposed by @jyn514 in the MCP rust-lang/compiler-team#619](https://github.com/rust-lang/compiler-team/issues/619).
3131

@@ -41,7 +41,7 @@ See the *Recommended config: have `compiletest` instead depend on precompiled st
4141

4242
## What does this mean for a typical compiler workflow?
4343

44-
- If unstable library features are being dogfooded, in rare cases `cfg(bootstrap)` may now be needed in compiler sources.
44+
- If unstable library features are being dogfooded, some additional `cfg(bootstrap)` usages may now be needed in compiler sources.
4545

4646
### Caveat: `libtest` changes
4747

Diff for: content/inside-rust/stage0-redesign/index.md

+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
+++
2+
path = "inside-rust/9999/12/31/redesigning-stage-0-std"
3+
title = "Redesigning stage 0 std"
4+
authors = ["Jieyou Xu"]
5+
6+
[extra]
7+
team = "Bootstrap"
8+
team_url = "https://www.rust-lang.org/governance/teams/infra#team-bootstrap"
9+
+++
10+
11+
# Redesigning stage 0 std
12+
13+
## Summary
14+
15+
We are reworking how the stage 0 bootstrap sequence works (the sequence used to build a stage 1 compiler).
16+
17+
- Before: a stage 0 (beta by default) compiler is used to build the in-tree std, which in turn is used to build the stage 1 compiler.
18+
- After: a stage 0 (beta by default) compiler and a precompiled stage 0 std is instead used to build the stage 1 compiler.
19+
20+
![Difference in stage 0 bootstrap sequence](stage0-redesign-diff.svg)
21+
22+
Notably, this means that after the stage 0 rework implementation PR [redesign stage 0 std #119899](https://github.com/rust-lang/rust/pull/119899) lands:
23+
24+
- `./x {build,test,check} library --stage 0` becomes no-op, as stage 0 std is no longer the built in-tree std, and the minimum supported stage to build std is now `1`.
25+
- Consequently, default (test, check, bench) stage values in the library profile are no longer `0`, but instead defaults to `1`.
26+
- Some additional `cfg(bootstrap)` usages may be needed in the compiler sources for dogfooding unstable library features.
27+
28+
## Motivation
29+
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.
31+
32+
This was [originally proposed by @jyn514 in the MCP rust-lang/compiler-team#619](https://github.com/rust-lang/compiler-team/issues/619).
33+
34+
## What does this mean for a typical library workflow?
35+
36+
- 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.
37+
- 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`.
38+
- `cfg(bootstrap)` should no longer be needed for library sources.
39+
40+
### Caveat: `libtest` changes
41+
42+
See the *Recommended config: have `compiletest` instead depend on precompiled stage 0 libtest* section below.
43+
44+
## What does this mean for a typical compiler workflow?
45+
46+
- If unstable library features are being dogfooded, some additional `cfg(bootstrap)` usages may now be needed in compiler sources.
47+
48+
### Caveat: `libtest` changes
49+
50+
See the *Recommended config: have `compiletest` instead depend on precompiled stage 0 libtest* section below.
51+
52+
## Recommended config: have `compiletest` instead depend on precompiled stage 0 libtest
53+
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.

Diff for: content/inside-rust/stage0-redesign/stage0-redesign-diff.svg

+3
Loading

0 commit comments

Comments
 (0)