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