@@ -273,51 +273,15 @@ lets you use `cargo fmt`.
273
273
[ the section on vscode ] : suggested.md#configuring-rust-analyzer-for-rustc
274
274
[ the section on rustup ] : how-to-build-and-run.md?highlight=rustup#creating-a-rustup-toolchain
275
275
276
- ## Faster builds with ` --keep-stage ` .
277
-
278
- Sometimes just checking whether the compiler builds is not enough. A common
279
- example is that you need to add a ` debug! ` statement to inspect the value of
280
- some state or better understand the problem. In that case, you don't really need
281
- a full build. By bypassing bootstrap's cache invalidation, you can often get
282
- these builds to complete very fast (e.g., around 30 seconds). The only catch is
283
- this requires a bit of fudging and may produce compilers that don't work (but
284
- that is easily detected and fixed).
285
-
286
- The sequence of commands you want is as follows:
287
-
288
- - Initial build: ` ./x build library `
289
- - As [ documented previously] , this will build a functional stage1 compiler as
290
- part of running all stage0 commands (which include building a ` std `
291
- compatible with the stage1 compiler) as well as the first few steps of the
292
- "stage 1 actions" up to "stage1 (sysroot stage1) builds std".
293
- - Subsequent builds: ` ./x build library --keep-stage 1 `
294
- - Note that we added the ` --keep-stage 1 ` flag here
295
-
296
- [ documented previously ] : ./how-to-build-and-run.md#building-the-compiler
297
-
298
- As mentioned, the effect of ` --keep-stage 1 ` is that we just _ assume_ that the
299
- old standard library can be re-used. If you are editing the compiler, this is
300
- almost always true: you haven't changed the standard library, after all. But
301
- sometimes, it's not true: for example, if you are editing the "metadata" part of
302
- the compiler, which controls how the compiler encodes types and other states
303
- into the ` rlib ` files, or if you are editing things that wind up in the metadata
304
- (such as the definition of the MIR).
305
-
306
- ** The TL;DR is that you might get weird behavior from a compile when using
307
- ` --keep-stage 1 ` ** -- for example, strange [ ICEs] ( ../appendix/glossary.html#ice )
308
- or other panics. In that case, you should simply remove the ` --keep-stage 1 `
309
- from the command and rebuild. That ought to fix the problem.
310
-
311
- You can also use ` --keep-stage 1 ` when running tests. Something like this:
312
-
313
- - Initial test run: ` ./x test tests/ui `
314
- - Subsequent test run: ` ./x test tests/ui --keep-stage 1 `
315
-
316
- ### Iterating the standard library with ` --keep-stage `
317
-
318
- If you are making changes to the standard library, you can use `./x build
319
- --keep-stage 0 library` to iteratively rebuild the standard library without
320
- rebuilding the compiler.
276
+ ## Faster Builds with CI-rustc
277
+
278
+ If you are not working on the compiler, you often don't need to build the compiler tree.
279
+ For example, you can skip building the compiler and only build the ` library ` tree or the
280
+ tools under ` src/tools ` . To achieve that, you have to enable this by setting the ` download-rustc `
281
+ option in your configuration. This tells bootstrap to use the latest nightly compiler for ` stage > 0 `
282
+ steps, meaning it will have two precompiled compilers: stage0 compiler and ` download-rustc ` compiler
283
+ for ` stage > 0 ` steps. This way, it will never need to build the in-tree compiler. As a result, your
284
+ build time will be significantly reduced by not building the in-tree compiler.
321
285
322
286
## Using incremental compilation
323
287
0 commit comments