Skip to content

Commit f196779

Browse files
jyn514mark-i-m
authored andcommitted
Improve getting-started guide
- Clean up wording - Suggest `build --stage 1 src/libstd`, which doesn't recompile rustc twice unnecessarily - Fix rustdoc globs which only work on Linux - Add suggestion for `build --stage 0 src/libstd` - Suggest `-j1` for very slow builds - Suggesting letting CI run tests when using a slow machine
1 parent d3e682e commit f196779

File tree

1 file changed

+18
-12
lines changed

1 file changed

+18
-12
lines changed

src/getting-started.md

+18-12
Original file line numberDiff line numberDiff line change
@@ -83,12 +83,18 @@ you use your system's LLVM ([see below][configsec]).
8383

8484
Like `cargo`, the build system will use as many cores as possible. Sometimes
8585
this can cause you to run low on memory. You can use `-j` to adjust the number
86-
concurrent jobs.
86+
concurrent jobs. If a full build takes more than ~45 minutes to an hour,
87+
you are probably spending most of the time swapping memory in and out;
88+
try using `-j1`.
8789

88-
Also, if you don't have too much free disk space, you may want to turn off
90+
On a slow machine, the build times for rustc are very painful. Consider using
91+
`./x.py check` instead of a full build and letting the automated tests run
92+
when you push to GitHub.
93+
94+
If you don't have too much free disk space, you may want to turn off
8995
incremental compilation ([see below][configsec]). This will make
90-
compilation take longer, but will save a ton of space from the incremental
91-
caches.
96+
compilation take longer (especially after a rebase),
97+
but will save a ton of space from the incremental caches.
9298

9399
### Cloning
94100

@@ -169,10 +175,10 @@ should still read the rest of the section:
169175
| Command | When to use it |
170176
| --- | --- |
171177
| `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) |
178+
| `x.py build --stage 0 src/libstd` | Build only the standard library, without building the compiler |
179+
| `x.py build --stage 1 src/libstd` | Build just the 1st stage of the compiler, along with the standard library; this is faster than building stage 2 and usually good enough |
180+
| `x.py build --stage 1 --keep-stage 1 src/libstd` | Build the 1st stage of the compiler and skips rebuilding the standard 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.) |
181+
| `x.py test --stage 1 [--keep-stage 1]` | Run the test suite using the stage1 compiler |
176182
| `x.py test --stage 1 --bless [--keep-stage 1]` | Run the test suite using the stage1 compiler _and_ update expected test output. |
177183
| `x.py build` | Do a full 2-stage build. You almost never want to do this. |
178184
| `x.py test` | Do a full 2-stage build and run all tests. You almost never want to do this. |
@@ -197,10 +203,10 @@ For most contributions, you only need to build stage 1, which saves a lot of tim
197203

198204
```sh
199205
# Build the compiler (stage 1)
200-
./x.py build --stage 1
206+
./x.py build --stage 1 src/libstd
201207

202208
# Subsequent builds
203-
./x.py build --stage 1 --keep-stage 1
209+
./x.py build --stage 1 --keep-stage 1 src/libstd
204210
```
205211

206212
This will take a while, especially the first time. Be wary of accidentally
@@ -281,7 +287,7 @@ the stage-2 compiler, which of course requires a 2-stage build, described above
281287

282288
In practice, though, you don't need to build the compiler unless you are
283289
planning to use a recently added nightly feature. Instead, you can just build
284-
stage 0 (i.e. which basically just uses the current beta compiler).
290+
stage 0, which uses the current beta compiler.
285291

286292
```sh
287293
./x.py build --stage 0 src/libstd
@@ -326,7 +332,7 @@ Rustdoc has two types of tests: content tests and UI tests.
326332
./x.py test --stage 1 src/test/rustdoc-ui
327333

328334
# Both at once
329-
./x.py test --stage 1 src/test/rustdoc*
335+
./x.py test --stage 1 src/test/rustdoc src/test/rustdoc-ui
330336
```
331337

332338
### Contributing code to other Rust projects

0 commit comments

Comments
 (0)