@@ -110,6 +110,42 @@ This is just a subset of the full rustc build. The **full** rustc build
110
110
- Build libstd with stage2 compiler.
111
111
- Build librustdoc and a bunch of other things.
112
112
113
+ ### Build different stages
114
+
115
+ ./x.py build --stage 0
116
+
117
+ # Stage 1 is typically enough to test out all of your changes
118
+ # to the compiler
119
+ ./x.py build --stage 1
120
+
121
+ # Equivalent to ./x.py build
122
+ ./x.py build --stage 2
123
+
124
+ You can pass the --stage flag with what stage you want to build to.
125
+ It is recommended that you build to Stage 1 as this is enough to know
126
+ your changes can successfully compile and should let you run tests
127
+ with your changes.
128
+
129
+ ### Build specific components
130
+
131
+ Build only the libcore library
132
+
133
+ ` ./x.py build src/libcore `
134
+
135
+ Build the libcore and libproc_macro library only
136
+
137
+ ` ./x.py build src/libcore src/libproc_macro `
138
+
139
+ Build only libcore up to Stage 1
140
+
141
+ ` ./x.py build src/libcore --stage 1 `
142
+
143
+ Sometimes you might just want to test if the part you’re working on can
144
+ compile. Using these commands you can test that it compiles before doing
145
+ a bigger build to make sure it works with the compiler. As shown before
146
+ you can also pass flags at the end such as --stage.
147
+
148
+
113
149
### Creating a rustup toolchain
114
150
115
151
Once you have successfully built rustc, you will have created a bunch
@@ -121,8 +157,8 @@ you will likely need to build at some point; for example, if you want
121
157
to run the entire test suite).
122
158
123
159
``` bash
124
- > rustup toolchain link stage1 build/< host-triple> /stage1
125
- > rustup toolchain link stage2 build/< host-triple> /stage2
160
+ rustup toolchain link stage1 build/< host-triple> /stage1
161
+ rustup toolchain link stage2 build/< host-triple> /stage2
126
162
```
127
163
128
164
Now you can run the rustc you built with. If you run with ` -vV ` , you
@@ -173,3 +209,12 @@ This allows you to do "jump-to-def" with whatever functions were around when
173
209
you last built, which is ridiculously useful.
174
210
175
211
[ etags ] : https://github.com/nikomatsakis/rust-etags
212
+
213
+ ### Cleaning out build directories
214
+
215
+ Sometimes you need to start fresh, but this is normally not the case.
216
+ If you need to run this then rustbuild is most likely not acting right and
217
+ you should file a bug as to what is going wrong. If you do need to clean
218
+ everything up then you only need to run one command!
219
+
220
+ ` ./x.py clean `
0 commit comments