You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This rearranges the README a little, since I felt like the current
organization was a little awkward. This hopefully has a little more of a
better organization.
Copy file name to clipboardExpand all lines: README.md
+35-34Lines changed: 35 additions & 34 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,33 +3,22 @@
3
3
This document is the primary reference for the Rust programming
4
4
language.
5
5
6
-
## Dependencies
6
+
## Contributor docs
7
7
8
-
- Nightly Rust
9
-
-[mdbook](https://rust-lang.github.io/mdBook/)
8
+
There are several pages for those working on the reference:
10
9
11
-
## Installing dependencies
12
-
13
-
First, ensure that you have a recent copy of the nightly Rust compiler
14
-
installed, as this is needed in order to run the tests:
15
-
16
-
```sh
17
-
rustup toolchain install nightly
18
-
```
19
-
20
-
Now, ensure you have `mdbook` installed, as this is needed in order to
21
-
build the Reference:
22
-
23
-
```sh
24
-
cargo install --locked mdbook
25
-
```
10
+
*[Authoring guide](https://github.com/rust-lang/reference/blob/master/docs/authoring.md): Guidelines for writing content.
11
+
*[Review policy](https://github.com/rust-lang/reference/blob/master/docs/review-policy.md): Guidelines for reviewers.
12
+
*[Grammar](https://github.com/rust-lang/reference/blob/master/docs/grammar.md): How the grammar syntax works.
13
+
*[Attribute template](https://github.com/rust-lang/reference/blob/master/docs/attribute-template.md): The standard template for documenting an attribute.
Now change your current directory to the working directory:
30
+
### Installing mdbook
42
31
43
-
```sh
44
-
cd reference
45
-
```
32
+
The Reference is built using [mdbook].
46
33
47
-
To test all of the code examples in the Reference, run:
34
+
First, ensure that you have a recent copy of the nightly Rust compiler installed, as this is needed in order to run the tests:
48
35
49
36
```sh
50
-
mdbook test
37
+
rustup toolchain install nightly
38
+
rustup override set nightly
51
39
```
52
40
53
-
For authors, consider using the server functionality which supports automatic reload.
54
-
55
-
To build the Reference locally (in `book/`) and open it in a web
56
-
browser, run:
41
+
Now, ensure you have `mdbook` installed, as this is needed in order to build the Reference:
57
42
58
43
```sh
59
-
SPEC_RELATIVE=0 mdbook build --open
44
+
cargo install --locked mdbook
60
45
```
61
46
62
-
This will open a browser with a websocket live-link to automatically reload whenever the source is updated.
47
+
[mdbook]: https://rust-lang.github.io/mdBook/
63
48
64
-
You can also use mdbook's live webserver option, which will automatically rebuild the book and reload your web browser whenever a source file is modified:
49
+
### Running mdbook
65
50
66
-
```sh
67
-
SPEC_RELATIVE=0 mdbook serve --open
68
-
```
51
+
`mdbook` provides a variety of different commands and options to help you work on the book:
52
+
53
+
*`mdbook build --open`: Build the book and open it in a web browser.
54
+
*`mdbook serve --open`: Launches a web server on localhost. It also automatically rebuilds the book whenever any file changes and automatically reloads your web browser.
55
+
56
+
The book contents are driven by a `SUMMARY.md` file, and every file must be linked there. See <https://rust-lang.github.io/mdBook/> for its usage.
69
57
70
58
### `SPEC_RELATIVE`
71
59
72
60
The `SPEC_RELATIVE=0` environment variable makes links to the standard library go to <https://doc.rust-lang.org/> instead of being relative, which is useful when viewing locally since you normally don't have a copy of the standard library.
73
61
62
+
```sh
63
+
SPEC_RELATIVE=0 mdbook serve --open
64
+
```
65
+
74
66
The published site at <https://doc.rust-lang.org/reference/> (or local docs using `rustup doc`) does not set this, which means it will use relative links which supports offline viewing and links to the correct version (for example, links in <https://doc.rust-lang.org/1.81.0/reference/> will stay within the 1.81.0 directory).
75
67
76
68
### `SPEC_DENY_WARNINGS`
@@ -80,3 +72,12 @@ The `SPEC_DENY_WARNINGS=1` environment variable will turn all warnings generated
80
72
### `SPEC_RUST_ROOT`
81
73
82
74
The `SPEC_RUST_ROOT` can be used to point to the directory of a checkout of <https://github.com/rust-lang/rust>. This is used by the test-linking feature so that it can find tests linked to reference rules. If this is not set, then the tests won't be linked.
75
+
76
+
## Running tests
77
+
78
+
There are several different kinds of tests you can run (these are enforced on CI):
79
+
80
+
*`mdbook test`: This will run the inline Rust codeblocks (internally it uses `rustdoc` to do this).
81
+
*`cargo xtask style-check`: This will validate some style checks (see [authoring guide](docs/authoring.md)).
82
+
*`cargo xtask linkcheck`: This will validate that markdown links aren't broken.
0 commit comments