@@ -49,11 +49,12 @@ use-jemalloc = false
49
49
50
50
### Running x.py and building a stage1 compiler
51
51
52
- One thing to keep in mind is that ` rustc ` is a _ bootstrapping_ compiler. That
53
- is, since ` rustc ` is written in Rust, we need to use an older version of the
54
- compiler to compile the newer version. In particular, the newer version of the
55
- compiler, ` libstd ` , and other tooling may use some unstable features
56
- internally. The result is the compiling ` rustc ` is done in stages:
52
+ One thing to keep in mind is that ` rustc ` is a _ bootstrapping_
53
+ compiler. That is, since ` rustc ` is written in Rust, we need to use an
54
+ older version of the compiler to compile the newer version. In
55
+ particular, the newer version of the compiler, ` libstd ` , and other
56
+ tooling may use some unstable features internally. The result is that
57
+ compiling ` rustc ` is done in stages:
57
58
58
59
- ** Stage 0:** the stage0 compiler is usually the current _ beta_ compiler
59
60
(` x.py ` will download it for you); you can configure ` x.py ` to use something
@@ -73,10 +74,11 @@ internally. The result is the compiling `rustc` is done in stages:
73
74
with stage1.)
74
75
- ** Stage 2:** we rebuild our stage1 compiler with itself to produce
75
76
the stage2 compiler (i.e. it builds itself) to have all the _ latest
76
- optimizations_ .
77
+ optimizations_ . (By default, we copy the stage1 libraries for use by
78
+ the stage2 compiler, since they ought to be identical.)
77
79
- _ (Optional)_ ** Stage 3** : to sanity check of our new compiler, we
78
- can build it again with stage2 compiler which must be identical to
79
- itself , unless something has broken.
80
+ can build the libraries with the stage2 compiler. The result ought
81
+ to be identical to before , unless something has broken.
80
82
81
83
For hacking, often building the stage 1 compiler is enough, but for
82
84
final testing and release, the stage 2 compiler is used.
@@ -86,7 +88,7 @@ It is, in particular, very useful when you're doing some kind of
86
88
"type-based refactoring", like renaming a method, or changing the
87
89
signature of some function.
88
90
89
- <a name =command >
91
+ <a name =command ></ a >
90
92
91
93
Once you've created a config.toml, you are now ready to run
92
94
` x.py ` . There are a lot of options here, but let's start with what is
@@ -104,8 +106,8 @@ What this command does is the following:
104
106
- This produces the stage1 compiler
105
107
- Build libstd using the stage1 compiler (cannot use incremental)
106
108
107
- This final product (stage1 compiler + libs build using that compiler)
108
- is what you need to build other rust programs.
109
+ This final product (stage1 compiler + libs built using that compiler)
110
+ is what you need to build other rust programs.
109
111
110
112
Note that the command includes the ` -i ` switch. This enables incremental
111
113
compilation. This will be used to speed up the first two steps of the process:
@@ -125,7 +127,7 @@ Note that this whole command just gives you a subset of the full rustc
125
127
build. The ** full** rustc build (what you get if you just say `./x.py
126
128
build`) has quite a few more steps:
127
129
128
- - Build librustc rustc with the stage1 compiler.
130
+ - Build librustc and rustc with the stage1 compiler.
129
131
- The resulting compiler here is called the "stage2" compiler.
130
132
- Build libstd with stage2 compiler.
131
133
- Build librustdoc and a bunch of other things with the stage2 compiler.
@@ -168,7 +170,7 @@ release: 1.25.0-dev
168
170
LLVM version: 4.0
169
171
```
170
172
171
- <a name =workflow >
173
+ <a name =workflow ></ a >
172
174
173
175
### Suggested workflows for faster builds of the compiler
174
176
@@ -188,7 +190,7 @@ refactoring commits and only run the tests at some later time. You can
188
190
then use ` git bisect ` to track down ** precisely** which commit caused
189
191
the problem. A nice side-effect of this style is that you are left
190
192
with a fairly fine-grained set of commits at the end, all of which
191
- build and pass testes . This often helps reviewing.
193
+ build and pass tests . This often helps reviewing.
192
194
193
195
** Incremental builds with ` --keep-stage ` .** Sometimes just checking
194
196
whether the compiler builds is not enough. A common example is that
@@ -216,7 +218,7 @@ encodes types and other states into the `rlib` files, or if you are editing
216
218
things that wind up in the metadata (such as the definition of the MIR).
217
219
218
220
** The TL;DR is that you might get weird behavior from a compile when
219
- using ` --keep-stage 1 ` ** -- for example, strange ICEs or other
221
+ using ` --keep-stage 1 ` ** -- for example, strange [ ICEs] ( appendix/glossary.html ) or other
220
222
panics. In that case, you should simply remove the ` --keep-stage 1 `
221
223
from the command and rebuild. That ought to fix the problem.
222
224
0 commit comments