Skip to content

Commit f880b1b

Browse files
committed
address a bunch of review comments
1 parent d90acc8 commit f880b1b

File tree

1 file changed

+31
-4
lines changed

1 file changed

+31
-4
lines changed

src/getting-started.md

+31-4
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,20 @@ things up.
163163

164164
### Building and Testing `rustc`
165165

166+
Here is a summary of the different commands for reference, but you probably
167+
should still read the rest of the section:
168+
169+
| Command | When to use it |
170+
| --- | --- |
171+
| `x.py check` | Quick check to see if things compile; rust-analyzer can run this automatically for you |
172+
| `x.py build --stage 1` | Build just the 1st stage of the compiler; this is faster than building stage 2 and usually good enough |
173+
| `x.py build --stage 1 --keep-stage 1` | Build the 1st stage of the compiler and skips rebuilding the library; this is useful after you've done an ordinary stage1 build to skip compilation time, but it can cause weird problems. (Just do a regular build to resolve.) |
174+
| `x.py test --stage 1` | Run the test suite using the stage1 compiler (first build) |
175+
| `x.py test --stage 1 --keep-stage 1` | Run the test suite using the stage1 compiler (subsequent builds) |
176+
| `x.py test --stage 1 --bless [--keep-stage 1]` | Run the test suite using the stage1 compiler _and_ update expected test output. |
177+
| `x.py build` | Do a full 2-stage build. You almost never want to do this. |
178+
| `x.py test` | Do a full 2-stage build and run all tests. You almost never want to do this. |
179+
166180
To do a full 2-stage build of the whole compiler, you should run this (after
167181
updating `config.toml` as mentioned above):
168182

@@ -206,14 +220,21 @@ different test suites [in this chapter][testing].
206220
[uitests]: ./tests/adding.html#ui
207221
[testing]: https://rustc-dev-guide.rust-lang.org/tests/intro.html
208222

209-
```
223+
```sh
210224
# First build
211225
./x.py test --stage 1 src/test/ui
212226

213227
# Subsequent builds
214228
./x.py test --stage 1 src/test/ui --keep-stage 1
215229
```
216230

231+
If your changes impact test output, you can use `--bless` to automatically
232+
update the `.stderr` files of the affected tests:
233+
234+
```sh
235+
./x.py test --stage 1 src/test/ui --keep-stage 1 --bless
236+
```
237+
217238
While working on the compiler, it can be helpful to see if the code just
218239
compiles (similar to `cargo check`) without actually building it. You can do
219240
this with:
@@ -223,7 +244,9 @@ this with:
223244
```
224245

225246
This command is really fast (relative to the other commands). It usually
226-
completes in a couple of minutes on my laptop.
247+
completes in a couple of minutes on my laptop. **A common workflow when working
248+
on the compiler is to make changes and repeatedly check with `./x.py check`.
249+
Then, run the tests as shown above when you think things should work.**
227250

228251
Finally, the CI ensures that the codebase is using consistent style. To format
229252
the code:
@@ -447,10 +470,14 @@ relatively lightweight mechanism for getting feedback on large changes to the
447470
compiler (as opposed to a full RFC or a design meeting with the team).
448471

449472
Example of things that might require MCPs include major refactorings, changes
450-
to important types, or important changes to how the compiler does something.
473+
to important types, or important changes to how the compiler does something, or
474+
smaller user-facing changes.
451475

452476
**When in doubt, ask on [zulip][z]. It would be a shame to put a lot of work
453-
into a PR that ends up not getting merged!**
477+
into a PR that ends up not getting merged!** [See this document][mcpinfo] for
478+
more info on MCPs.
479+
480+
[mcpinfo]: https://forge.rust-lang.org/compiler/mcp.html
454481

455482
### Performance
456483

0 commit comments

Comments
 (0)