expand compilation stages

This commit is contained in:
Ehsan M.Kermani 2018-04-22 16:34:32 -07:00 committed by Who? Me?!
parent ed758ee494
commit 38a21e9ea6
1 changed files with 15 additions and 8 deletions

View File

@ -2,7 +2,7 @@
The compiler is built using a tool called `x.py`. You will need to
have Python installed to run it. But before we get to that, if you're going to
be hacking on rustc, you'll want to tweak the configuration of the compiler.
be hacking on `rustc`, you'll want to tweak the configuration of the compiler.
The default configuration is oriented towards running the compiler as a user,
not a developer.
@ -55,13 +55,20 @@ compiler to compile the newer version. In particular, the newer version of the
compiler, `libstd`, and other tooling may use some unstable features
internally. The result is the compiling `rustc` is done in stages.
- **Stage 0:** the stage0 compiler is the current _beta_ compiler; we
download this binary from the internet.
- **Stage 1:** the code in your clone is then compiled with the stage
0 compiler to produce the stage 1 compiler.
- **Stage 2:** the code in your clone is then compiled with the stage
1 compiler *again* to produce the stage 2 compiler (i.e. it builds
itself).
- **Stage 0:** the stage0 compiler can be your existing (perhaps older version of)
Rust compiler, the current _beta_ compiler or you may download the binary
from the internet
- **Stage 1:** the code in your clone (for new version)
is then compiled with the stage0
compiler to produce the stage1 compiler.
However, it was built with an older compiler (stage0),
so to optimize the stage1 compiler we go to next stage
- **Stage 2:** we rebuild our stage1 compiler with itself
to produce the stage2 compiler (i.e. it builds
itself) to have all the _latest optimizations_
- _(Optional)_ **Stage 3**: to sanity check of our new compiler, we can build it again
with stage2 compiler which must be identical to itself,
unless something has broken
For hacking, often building the stage 1 compiler is enough, but for
final testing and release, the stage 2 compiler is used.