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