Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bootsrapping stages overview list #1555

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions src/building/bootstrapping.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,13 @@ rustc, then uses it to compile the new compiler.

## Stages of bootstrapping

### Overview

- Stage 0: the pre-compiled compiler
- Stage 1: from current code, by an earlier compiler
- Stage 2: the truly current compiler
- Stage 3: the same-result test
mightyiam marked this conversation as resolved.
Show resolved Hide resolved

Compiling `rustc` is done in stages. Here's a diagram, adapted from Joshua Nelson's
[talk on bootstrapping][rustconf22-talk] at RustConf 2022, with detailed explanations below.

Expand Down Expand Up @@ -47,7 +54,7 @@ graph TD
classDef with-s1c fill: lightgreen;
```

### Stage 0
### Stage 0: the pre-compiled compiler

The stage0 compiler is usually the current _beta_ `rustc` compiler
and its associated dynamic libraries,
Expand All @@ -61,11 +68,11 @@ a compiler (with its set of dependencies)
and its 'target' or 'object' libraries (`std` and `rustc`).
Both are staged, but in a staggered manner.

### Stage 1
### Stage 1: from current code, by an earlier compiler

The rustc source code is then compiled with the stage0 compiler to produce the stage1 compiler.

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

We then rebuild our stage1 compiler with itself to produce the stage2 compiler.

Expand All @@ -88,7 +95,7 @@ For development, you usually only want the `stage1` compiler,
which you can build with `./x.py build library`.
See [Building the Compiler](./how-to-build-and-run.html#building-the-compiler).

### Stage 3
### Stage 3: the same-result test

Stage 3 is optional. To sanity check our new compiler, we
can build the libraries with the stage2 compiler. The result ought
Expand Down