|
1 | 1 | # Building documentation
|
2 | 2 |
|
3 |
| -You might want to build documentation of the various components |
4 |
| -available like the standard library. There’s two ways to go about this. |
5 |
| -You can run rustdoc directly on the file to make sure the HTML is |
6 |
| -correct, which is fast. Alternatively, you can build the documentation |
7 |
| -as part of the build process through `x.py`. Both are viable methods |
8 |
| -since documentation is more about the content. |
| 3 | +You can run `rustdoc` directly on a file to make sure the HTML is correct, |
| 4 | +which runs quickly. |
| 5 | +A more conventional way is using `/x.py doc`. |
9 | 6 |
|
10 |
| -## Document everything |
| 7 | +- Document everything |
11 | 8 |
|
12 |
| -This uses the beta rustdoc, which usually but not always has the same output |
13 |
| -as stage 1 rustdoc. |
| 9 | + This uses `rustdoc` from the beta toolchain, |
| 10 | + so will produce (slightly) different output to stage 1 rustdoc, |
| 11 | + as `rustdoc` is under active development: |
14 | 12 |
|
15 |
| -```bash |
16 |
| -./x.py doc |
17 |
| -``` |
| 13 | + ```bash |
| 14 | + ./x.py doc |
| 15 | + ``` |
18 | 16 |
|
19 |
| -## If you want to be sure that the links behave the same as on CI |
| 17 | + If you want to be sure the documentation looks the same as on CI: |
20 | 18 |
|
21 |
| -```bash |
22 |
| -./x.py doc --stage 1 |
23 |
| -``` |
| 19 | + ```bash |
| 20 | + ./x.py doc --stage 1 |
| 21 | + ``` |
24 | 22 |
|
25 |
| -First the compiler and rustdoc get built to make sure everything is okay |
26 |
| -and then it documents the files. |
| 23 | + First, |
| 24 | + the compiler and rustdoc get built to make sure everything is okay, |
| 25 | + and then it documents the files. |
27 | 26 |
|
28 |
| -## Document specific components |
| 27 | +- Much like running individual tests or building specific components, |
| 28 | + you can build just the documentation you want: |
29 | 29 |
|
30 |
| -```bash |
31 |
| -./x.py doc src/doc/book |
32 |
| -./x.py doc src/doc/nomicon |
33 |
| -./x.py doc src/doc/book library |
34 |
| -``` |
| 30 | + ```bash |
| 31 | + ./x.py doc src/doc/book |
| 32 | + ./x.py doc src/doc/nomicon |
| 33 | + ./x.py doc compiler library |
| 34 | + ``` |
35 | 35 |
|
36 |
| -Much like individual tests or building certain components you can build only |
37 |
| - the documentation you want. |
| 36 | +- Document internal rustc items |
38 | 37 |
|
39 |
| -## Document internal rustc items |
| 38 | + Compiler documentation is not built by default. |
| 39 | + To enable it, modify "config.toml": |
40 | 40 |
|
41 |
| -Compiler documentation is not built by default. To enable it, modify config.toml: |
| 41 | + ```toml |
| 42 | + [build] |
| 43 | + compiler-docs = true |
| 44 | + ``` |
42 | 45 |
|
43 |
| -```toml |
44 |
| -[build] |
45 |
| -compiler-docs = true |
46 |
| -``` |
| 46 | + Note that when enabled, |
| 47 | + documentation for internal compiler items will also be built. |
47 | 48 |
|
48 |
| -Note that when enabled, |
49 |
| -documentation for internal compiler items will also be built. |
| 49 | + NOTE: The documentation for the compiler is found at [this link]. |
50 | 50 |
|
51 |
| -### Compiler Documentation |
52 |
| - |
53 |
| -The documentation for the Rust components are found at [rustc doc]. |
54 |
| - |
55 |
| -[rustc doc]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ |
| 51 | +[this link]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ |
0 commit comments