Skip to content

Commit e4c4156

Browse files
committed
Merge branch 'patch-1' of github.com:hbina/rustc-guide into patch-1
2 parents b3aa636 + cdf5301 commit e4c4156

File tree

8 files changed

+637
-42
lines changed

8 files changed

+637
-42
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ invoke this link checker, otherwise it will emit a warning saying it couldn't
3939
be found.
4040

4141
```bash
42-
> cargo install mdbook-linkcheck
42+
cargo install mdbook-linkcheck
4343
```
4444

4545
You will need `mdbook` version `>= 0.2`. `linkcheck` will be run automatically

src/closure.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ Let's say the above is the content of a file called `immut.rs`. If we compile
3535
`immut.rs` using the following command. The [`-Zdump-mir=all`][dump-mir] flag will cause
3636
`rustc` to generate and dump the [MIR][mir] to a directory called `mir_dump`.
3737
```console
38-
> rustc +stage1 immut.rs -Zdump-mir=all
38+
rustc +stage1 immut.rs -Zdump-mir=all
3939
```
4040

4141
[mir]: ./mir/index.md
@@ -145,7 +145,7 @@ codebase. For closures specifically, set the `RUST_LOG` env variable as below an
145145
output in a file:
146146

147147
```console
148-
> RUST_LOG=rustc_typeck::check::upvar rustc +stage1 -Zdump-mir=all \
148+
RUST_LOG=rustc_typeck::check::upvar rustc +stage1 -Zdump-mir=all \
149149
<.rs file to compile> 2> <file where the output will be dumped>
150150
```
151151

src/compiler-documenting.md

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# Documenting rustc
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.
9+
10+
## Document everything
11+
12+
```bash
13+
./x.py doc
14+
```
15+
16+
## If you want to avoid the whole Stage 2 build
17+
18+
```bash
19+
./x.py doc --stage 1
20+
```
21+
22+
First the compiler and rustdoc get built to make sure everything is okay
23+
and then it documents the files.
24+
25+
## Document specific components
26+
27+
```bash
28+
./x.py doc src/doc/book
29+
./x.py doc src/doc/nomicon
30+
./x.py doc src/doc/book src/libstd
31+
```
32+
33+
Much like individual tests or building certain components you can build only
34+
the documentation you want.
35+
36+
## Document internal rustc items
37+
38+
Compiler documentation is not built by default. There's a flag in
39+
config.toml for achieving the same.
40+
But, when enabled, compiler documentation does include internal items.
41+
42+
Next open up config.toml and make sure these two lines are set to true:
43+
44+
```bash
45+
docs = true
46+
compiler-docs = true
47+
```
48+
49+
When you want to build the compiler docs as well run this command:
50+
51+
```bash
52+
./x.py doc
53+
```
54+
55+
This will see that the docs and compiler-docs options are set to true
56+
and build the normally hidden compiler docs!
57+
58+
### Compiler Documentation
59+
60+
The documentation for the rust components are found at [rustc doc].
61+
62+
[rustc doc]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc/

src/hir.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ You can view the HIR representation of your code by passing the
1515
`-Zunpretty=hir-tree` flag to rustc:
1616

1717
```bash
18-
> cargo rustc -- -Zunpretty=hir-tree
18+
cargo rustc -- -Zunpretty=hir-tree
1919
```
2020

2121
### Out-of-band storage and the `Crate` type

0 commit comments

Comments
 (0)