Skip to content

Commit c7f1fe6

Browse files
committed
Prefer --keep-stage-std for compiler rebuilds
1 parent 259e207 commit c7f1fe6

File tree

2 files changed

+10
-16
lines changed

2 files changed

+10
-16
lines changed

src/building/how-to-build-and-run.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ You will probably find that building the stage1 `std` is a bottleneck for you,
249249
but fear not, there is a (hacky) workaround...
250250
see [the section on avoiding rebuilds for std][keep-stage].
251251

252-
[keep-stage]: ./suggested.md#faster-builds-with---keep-stage
252+
[keep-stage]: ./suggested.md#faster-rebuilds-with---keep-stage-std
253253

254254
Sometimes you don't need a full build. When doing some kind of
255255
"type-based refactoring", like renaming a method, or changing the

src/building/suggested.md

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ steps, meaning it will have two precompiled compilers: stage0 compiler and `down
306306
for `stage > 0` steps. This way, it will never need to build the in-tree compiler. As a result, your
307307
build time will be significantly reduced by not building the in-tree compiler.
308308

309-
## Faster builds with `--keep-stage`.
309+
## Faster rebuilds with `--keep-stage-std`
310310

311311
Sometimes just checking whether the compiler builds is not enough. A common
312312
example is that you need to add a `debug!` statement to inspect the value of
@@ -319,32 +319,26 @@ that is easily detected and fixed).
319319
The sequence of commands you want is as follows:
320320

321321
- Initial build: `./x build library`
322-
- As [documented previously], this will build a functional stage1 compiler as
323-
part of running all stage0 commands (which include building a `std`
324-
compatible with the stage1 compiler) as well as the first few steps of the
325-
"stage 1 actions" up to "stage1 (sysroot stage1) builds std".
326-
- Subsequent builds: `./x build library --keep-stage 1`
327-
- Note that we added the `--keep-stage 1` flag here
322+
- Subsequent builds: `./x build library --keep-stage-std=1`
323+
- Note that we added the `--keep-stage-std=1` flag here
328324

329-
[documented previously]: ./how-to-build-and-run.md#building-the-compiler
330-
331-
As mentioned, the effect of `--keep-stage 1` is that we just _assume_ that the
325+
As mentioned, the effect of `--keep-stage-std=1` is that we just _assume_ that the
332326
old standard library can be re-used. If you are editing the compiler, this is
333-
almost always true: you haven't changed the standard library, after all. But
327+
often true: you haven't changed the standard library, after all. But
334328
sometimes, it's not true: for example, if you are editing the "metadata" part of
335329
the compiler, which controls how the compiler encodes types and other states
336330
into the `rlib` files, or if you are editing things that wind up in the metadata
337331
(such as the definition of the MIR).
338332

339333
**The TL;DR is that you might get weird behavior from a compile when using
340-
`--keep-stage 1`** -- for example, strange [ICEs](../appendix/glossary.html#ice)
341-
or other panics. In that case, you should simply remove the `--keep-stage 1`
334+
`--keep-stage-std=1`** -- for example, strange [ICEs](../appendix/glossary.html#ice)
335+
or other panics. In that case, you should simply remove the `--keep-stage-std=1`
342336
from the command and rebuild. That ought to fix the problem.
343337

344-
You can also use `--keep-stage 1` when running tests. Something like this:
338+
You can also use `--keep-stage-std=1` when running tests. Something like this:
345339

346340
- Initial test run: `./x test tests/ui`
347-
- Subsequent test run: `./x test tests/ui --keep-stage 1`
341+
- Subsequent test run: `./x test tests/ui --keep-stage-std=1`
348342

349343
## Using incremental compilation
350344

0 commit comments

Comments
 (0)