Skip to content

Commit eeca375

Browse files
authored
Update docs to match the new x.py defaults (#813)
1 parent e20ac5d commit eeca375

9 files changed

+66
-86
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ git submodule update --remote src/doc/rustc-dev-guide
132132
git add -u
133133
git commit -m "Update rustc-dev-guide"
134134
# Note that you can use -i, which is short for --incremental, in the following command
135-
./x.py test --incremental --stage 1 src/doc/rustc-dev-guide # This is optional and should succeed anyway
135+
./x.py test --incremental src/doc/rustc-dev-guide # This is optional and should succeed anyway
136136
# Open a PR in rust-lang/rust
137137
```
138138

src/building/compiler-documenting.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,14 @@ since documentation is more about the content.
99

1010
## Document everything
1111

12+
This uses the beta rustdoc, which usually but not always has the same output
13+
as stage 1 rustdoc.
14+
1215
```bash
1316
./x.py doc
1417
```
1518

16-
## If you want to avoid the whole Stage 2 build
19+
## If you want to be sure that the links behave the same as on CI
1720

1821
```bash
1922
./x.py doc --stage 1

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

+12-32
Original file line numberDiff line numberDiff line change
@@ -62,19 +62,6 @@ debug = true
6262
# compiler.
6363
codegen-units = 0
6464

65-
# Debuginfo level for most of Rust code, corresponds to the `-C debuginfo=N` option of `rustc`.
66-
# `0` - no debug info
67-
# `1` - line tables only - sufficient to generate backtraces that include line
68-
# information and inlined functions, set breakpoints at source code
69-
# locations, and step through execution in a debugger.
70-
# `2` - full debug info with variable and type information
71-
# Can be overridden for specific subsets of Rust code (rustc, std or tools).
72-
# Debuginfo for tests run with compiletest is not controlled by this option
73-
# and needs to be enabled separately with `debuginfo-level-tests`.
74-
#
75-
# Defaults to 2 if debug is true
76-
debuginfo-level = 1
77-
7865
# Whether to always use incremental compilation when building rustc
7966
incremental = true
8067

@@ -147,10 +134,9 @@ To read more about the bootstrap process, [read this chapter][bootstrap].
147134

148135
## Building the Compiler
149136

150-
To build a compiler, run `./x.py build`. This will do the whole bootstrapping
151-
process described above, producing a usable compiler toolchain from the source
152-
code you have checked out. This takes a long time, so it is not usually what
153-
you want to actually run (more on this later).
137+
To build a compiler, run `./x.py build`. This will build up to the stage1 compiler,
138+
including `rustdoc`, producing a usable compiler toolchain from the source
139+
code you have checked out.
154140

155141
Note that building will require a relatively large amount of storage space.
156142
You may want to have upwards of 10 or 15 gigabytes available to build the compiler.
@@ -190,7 +176,7 @@ Once you've created a config.toml, you are now ready to run
190176
probably the best "go to" command for building a local rust:
191177

192178
```bash
193-
./x.py build -i --stage 1 src/libstd
179+
./x.py build -i src/libstd
194180
```
195181

196182
This may *look* like it only builds `libstd`, but that is not the case.
@@ -220,8 +206,8 @@ there is a (hacky) workaround. See [the section on "recommended
220206
workflows"](./suggested.md) below.
221207

222208
Note that this whole command just gives you a subset of the full `rustc`
223-
build. The **full** `rustc` build (what you get if you just say `./x.py
224-
build`) has quite a few more steps:
209+
build. The **full** `rustc` build (what you get if you say `./x.py build
210+
--stage 2 src/rustc`) has quite a few more steps:
225211

226212
- Build `librustc` and `rustc` with the stage1 compiler.
227213
- The resulting compiler here is called the "stage2" compiler.
@@ -244,12 +230,6 @@ Build the libcore and libproc_macro library only
244230
./x.py build src/libcore src/libproc_macro
245231
```
246232

247-
Build only libcore up to Stage 1
248-
249-
```bash
250-
./x.py build src/libcore --stage 1
251-
```
252-
253233
Sometimes you might just want to test if the part you’re working on can
254234
compile. Using these commands you can test that it compiles before doing
255235
a bigger build to make sure it works with the compiler. As shown before
@@ -296,16 +276,16 @@ Here are a few other useful `x.py` commands. We'll cover some of them in detail
296276
in other sections:
297277

298278
- Building things:
299-
- `./x.py build --stage 1` – builds everything using the stage 1 compiler,
279+
- `./x.py build` – builds everything using the stage 1 compiler,
300280
not just up to `libstd`
301-
- `./x.py build` – builds the stage2 compiler
281+
- `./x.py build --stage 2` – builds the stage2 compiler
302282
- Running tests (see the [section on running tests](../tests/running.html) for
303283
more details):
304-
- `./x.py test --stage 1 src/libstd` – runs the `#[test]` tests from `libstd`
305-
- `./x.py test --stage 1 src/test/ui` – runs the `ui` test suite
306-
- `./x.py test --stage 1 src/test/ui/const-generics` - runs all the tests in
284+
- `./x.py test src/libstd` – runs the `#[test]` tests from `libstd`
285+
- `./x.py test src/test/ui` – runs the `ui` test suite
286+
- `./x.py test src/test/ui/const-generics` - runs all the tests in
307287
the `const-generics/` subdirectory of the `ui` test suite
308-
- `./x.py test --stage 1 src/test/ui/const-generics/const-types.rs` - runs
288+
- `./x.py test src/test/ui/const-generics/const-types.rs` - runs
309289
the single test `const-types.rs` from the `ui` test suite
310290

311291
### Cleaning out build directories

src/building/suggested.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -58,13 +58,13 @@ don't work (but that is easily detected and fixed).
5858

5959
The sequence of commands you want is as follows:
6060

61-
- Initial build: `./x.py build -i --stage 1 src/libstd`
61+
- Initial build: `./x.py build -i src/libstd`
6262
- As [documented above](#command), this will build a functional
6363
stage1 compiler as part of running all stage0 commands (which include
6464
building a `libstd` compatible with the stage1 compiler) as well as the
6565
first few steps of the "stage 1 actions" up to "stage1 (sysroot stage1)
6666
builds libstd".
67-
- Subsequent builds: `./x.py build -i --stage 1 src/libstd --keep-stage 1`
67+
- Subsequent builds: `./x.py build -i src/libstd --keep-stage 1`
6868
- Note that we added the `--keep-stage 1` flag here
6969

7070
As mentioned, the effect of `--keep-stage 1` is that we just *assume* that the
@@ -84,8 +84,8 @@ rebuild. That ought to fix the problem.
8484

8585
You can also use `--keep-stage 1` when running tests. Something like this:
8686

87-
- Initial test run: `./x.py test -i --stage 1 src/test/ui`
88-
- Subsequent test run: `./x.py test -i --stage 1 src/test/ui --keep-stage 1`
87+
- Initial test run: `./x.py test -i src/test/ui`
88+
- Subsequent test run: `./x.py test -i src/test/ui --keep-stage 1`
8989

9090
## Fine-tuning optimizations
9191

src/contributing.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -361,12 +361,12 @@ You can find documentation style guidelines in [RFC 1574][rfc1574].
361361

362362
[rfc1574]: https://github.com/rust-lang/rfcs/blob/master/text/1574-more-api-documentation-conventions.md#appendix-a-full-conventions-text
363363

364-
In many cases, you don't need a full `./x.py doc`, which will build the entire
365-
stage 2 compiler and compile the various books published on
364+
In many cases, you don't need a full `./x.py doc --stage 2`, which will build
365+
the entire stage 2 compiler and compile the various books published on
366366
[doc.rust-lang.org][docs]. When updating documentation for the standard library,
367-
first try `./x.py doc --stage 0 src/libstd`. If that fails, or if you need to
368-
see the output from the latest version of `rustdoc`, use `--stage 1` instead of
369-
`--stage 0`. Results should appear in `build/$TARGET/crate-docs`.
367+
first try `./x.py doc src/libstd`. If that fails, or if you need to
368+
see the output from the latest version of `rustdoc`, add `--stage 1`.
369+
Results should appear in `build/$TARGET/crate-docs`.
370370

371371
[docs]: https://doc.rust-lang.org
372372

src/getting-started.md

+20-22
Original file line numberDiff line numberDiff line change
@@ -175,19 +175,19 @@ should still read the rest of the section:
175175
| Command | When to use it |
176176
| --- | --- |
177177
| `x.py check` | Quick check to see if things compile; rust-analyzer can run this automatically for you |
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 |
182-
| `x.py test --stage 1 --bless [--keep-stage 1]` | Run the test suite using the stage1 compiler _and_ update expected test output. |
183-
| `x.py build` | Do a full 2-stage build. You almost never want to do this. |
184-
| `x.py test` | Do a full 2-stage build and run all tests. You almost never want to do this. |
178+
| `x.py build --stage 0 [src/libstd]` | Build only the standard library, without building the compiler |
179+
| `x.py build 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 --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 [--keep-stage 1]` | Run the test suite using the stage1 compiler |
182+
| `x.py test --bless [--keep-stage 1]` | Run the test suite using the stage1 compiler _and_ update expected test output. |
183+
| `x.py build --stage 2 src/rustc` | Do a full 2-stage build. You almost never want to do this. |
184+
| `x.py test --stage 2` | Do a full 2-stage build and run all tests. You almost never want to do this. |
185185

186186
To do a full 2-stage build of the whole compiler, you should run this (after
187187
updating `config.toml` as mentioned above):
188188

189189
```sh
190-
./x.py build
190+
./x.py build --stage 2 src/rustc
191191
```
192192

193193
In the process, this will also necessarily build the standard libraries, and it
@@ -203,10 +203,10 @@ For most contributions, you only need to build stage 1, which saves a lot of tim
203203

204204
```sh
205205
# Build the compiler (stage 1)
206-
./x.py build --stage 1 src/libstd
206+
./x.py build src/libstd
207207

208208
# Subsequent builds
209-
./x.py build --stage 1 --keep-stage 1 src/libstd
209+
./x.py build --keep-stage 1 src/libstd
210210
```
211211

212212
This will take a while, especially the first time. Be wary of accidentally
@@ -228,17 +228,17 @@ different test suites [in this chapter][testing].
228228

229229
```sh
230230
# First build
231-
./x.py test --stage 1 src/test/ui
231+
./x.py test src/test/ui
232232

233233
# Subsequent builds
234-
./x.py test --stage 1 src/test/ui --keep-stage 1
234+
./x.py test src/test/ui --keep-stage 1
235235
```
236236

237237
If your changes impact test output, you can use `--bless` to automatically
238238
update the `.stderr` files of the affected tests:
239239

240240
```sh
241-
./x.py test --stage 1 src/test/ui --keep-stage 1 --bless
241+
./x.py test src/test/ui --keep-stage 1 --bless
242242
```
243243

244244
While working on the compiler, it can be helpful to see if the code just
@@ -290,7 +290,7 @@ planning to use a recently added nightly feature. Instead, you can just build
290290
stage 0, which uses the current beta compiler.
291291

292292
```sh
293-
./x.py build --stage 0 src/libstd
293+
./x.py build --stage 0
294294
```
295295

296296
```sh
@@ -303,17 +303,15 @@ stage 0, which uses the current beta compiler.
303303

304304
`rustdoc` uses `rustc` internals (and, of course, the standard library), so you
305305
will have to build the compiler and `std` once before you can build `rustdoc`.
306-
As before, you can use `./x.py build` to do this.
307-
308-
However, in practice, stage 1 should be sufficient. The first time you build,
306+
As before, you can use `./x.py build` to do this. The first time you build,
309307
the stage-1 compiler will also be built.
310308

311309
```sh
312310
# First build
313-
./x.py build --stage 1 src/tools/rustdoc
311+
./x.py build
314312

315313
# Subsequent builds
316-
./x.py build --stage 1 --keep-stage 1 src/tools/rustdoc
314+
./x.py build --keep-stage 1
317315
```
318316

319317
As with the compiler, you can do a fast check build:
@@ -326,13 +324,13 @@ Rustdoc has two types of tests: content tests and UI tests.
326324

327325
```sh
328326
# Content tests
329-
./x.py test --stage 1 src/test/rustdoc
327+
./x.py test src/test/rustdoc
330328

331329
# UI tests
332-
./x.py test --stage 1 src/test/rustdoc-ui
330+
./x.py test src/test/rustdoc-ui
333331

334332
# Both at once
335-
./x.py test --stage 1 src/test/rustdoc src/test/rustdoc-ui
333+
./x.py test src/test/rustdoc src/test/rustdoc-ui
336334
```
337335

338336
### Contributing code to other Rust projects

src/queries/profiling.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ address [issue 42678](https://github.com/rust-lang/rust/issues/42678).
2020
Compile the compiler, up to at least stage 1:
2121

2222
```
23-
python x.py --stage 1
23+
x.py build src/libstd
2424
```
2525

2626
### 2. Run `rustc`, with flags

src/rustdoc.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ does is call the `main()` that's in this crate's `lib.rs`, though.)
3030

3131
## Cheat sheet
3232

33-
* Use `./x.py build --stage 1 src/libstd src/tools/rustdoc` to make a usable
33+
* Use `./x.py build` to make a usable
3434
rustdoc you can run on other projects.
3535
* Add `src/libtest` to be able to use `rustdoc --test`.
3636
* If you've used `rustup toolchain link local /path/to/build/$TARGET/stage1`
@@ -41,7 +41,7 @@ does is call the `main()` that's in this crate's `lib.rs`, though.)
4141
* The completed docs will be available in `build/$TARGET/doc/std`, though the
4242
bundle is meant to be used as though you would copy out the `doc` folder to
4343
a web server, since that's where the CSS/JS and landing page are.
44-
* Use `x.py test --stage 1 src/test/rustdoc*` to run the tests using a stage1 rustdoc.
44+
* Use `x.py test src/test/rustdoc*` to run the tests using a stage1 rustdoc.
4545
* See [rustdoc internals] for more information about tests.
4646
* Most of the HTML printing code is in `html/format.rs` and `html/render.rs`.
4747
It's in a bunch of `fmt::Display` implementations and supplementary

src/tests/running.md

+17-18
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ you will almost never want to use! – is as follows:
77
./x.py test
88
```
99

10-
This will build the full stage 2 compiler and then run the whole test
10+
This will build the stage 1 compiler and then run the whole test
1111
suite. You probably don't want to do this very often, because it takes
1212
a very long time, and anyway bors / travis will do it for you. (Often,
1313
I will run this command in the background after opening a PR that I
@@ -29,35 +29,34 @@ If you are building gdb from source, you will need to configure with
2929
## Running a subset of the test suites
3030

3131
When working on a specific PR, you will usually want to run a smaller
32-
set of tests, and with a stage 1 build. For example, a good "smoke
33-
test" that can be used after modifying rustc to see if things are
34-
generally working correctly would be the following:
32+
set of tests. For example, a good "smoke test" that can be used after
33+
modifying rustc to see if things are generally working correctly would be the
34+
following:
3535

3636
```bash
37-
./x.py test --stage 1 src/test/{ui,compile-fail}
37+
./x.py test src/test/{ui,compile-fail}
3838
```
3939

40-
This will run the `ui` and `compile-fail` test suites,
41-
and only with the stage 1 build. Of course, the choice of test suites
42-
is somewhat arbitrary, and may not suit the task you are doing. For
43-
example, if you are hacking on debuginfo, you may be better off with
44-
the debuginfo test suite:
40+
This will run the `ui` and `compile-fail` test suites. Of course, the choice
41+
of test suites is somewhat arbitrary, and may not suit the task you are
42+
doing. For example, if you are hacking on debuginfo, you may be better off
43+
with the debuginfo test suite:
4544

4645
```bash
47-
./x.py test --stage 1 src/test/debuginfo
46+
./x.py test src/test/debuginfo
4847
```
4948

5049
If you only need to test a specific subdirectory of tests for any
5150
given test suite, you can pass that directory to `x.py test`:
5251

5352
```bash
54-
./x.py test --stage 1 src/test/ui/const-generics
53+
./x.py test src/test/ui/const-generics
5554
```
5655

5756
Likewise, you can test a single file by passing its path:
5857

5958
```bash
60-
./x.py test --stage 1 src/test/ui/const-generics/const-test.rs
59+
./x.py test src/test/ui/const-generics/const-test.rs
6160
```
6261

6362
### Run only the tidy script
@@ -81,7 +80,7 @@ Likewise, you can test a single file by passing its path:
8180
### Run tests on the standard library using a stage 1 compiler
8281

8382
```bash
84-
> ./x.py test src/libstd --stage 1
83+
> ./x.py test src/libstd
8584
```
8685

8786
By listing which test suites you want to run you avoid having to run
@@ -99,7 +98,7 @@ you may pass the full file path to achieve this, or alternatively one
9998
may invoke `x.py` with the `--test-args` option:
10099

101100
```bash
102-
./x.py test --stage 1 src/test/ui --test-args issue-1234
101+
./x.py test src/test/ui --test-args issue-1234
103102
```
104103

105104
Under the hood, the test runner invokes the standard rust test runner
@@ -114,7 +113,7 @@ making a new test, you can pass `--bless` to the test subcommand. E.g.
114113
if some tests in `src/test/ui` are failing, you can run
115114

116115
```text
117-
./x.py test --stage 1 src/test/ui --bless
116+
./x.py test src/test/ui --bless
118117
```
119118

120119
to automatically adjust the `.stderr`, `.stdout` or `.fixed` files of
@@ -130,7 +129,7 @@ exists in the test file. For example, you can run all the tests in
130129
`src/test/ui` as `check-pass`:
131130

132131
```bash
133-
./x.py test --stage 1 src/test/ui --pass check
132+
./x.py test src/test/ui --pass check
134133
```
135134

136135
By passing `--pass $mode`, you can reduce the testing time. For each
@@ -144,7 +143,7 @@ You can further enable the `--incremental` flag to save additional
144143
time in subsequent rebuilds:
145144

146145
```bash
147-
./x.py test --stage 1 src/test/ui --incremental --test-args issue-1234
146+
./x.py test src/test/ui --incremental --test-args issue-1234
148147
```
149148

150149
If you don't want to include the flag with every command, you can

0 commit comments

Comments
 (0)