@@ -110,6 +110,42 @@ This is just a subset of the full rustc build. The **full** rustc build
110110- Build libstd with stage2 compiler.
111111- Build librustdoc and a bunch of other things.
112112
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+
113149### Creating a rustup toolchain
114150
115151Once 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
121157to run the entire test suite).
122158
123159``` 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
126162```
127163
128164Now 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
173209you last built, which is ridiculously useful.
174210
175211[ 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