Skip to content

Commit d9d7d95

Browse files
committed
Rearrange the README a little
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.
1 parent 89f67b3 commit d9d7d95

File tree

1 file changed

+35
-34
lines changed

1 file changed

+35
-34
lines changed

README.md

Lines changed: 35 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -3,33 +3,22 @@
33
This document is the primary reference for the Rust programming
44
language.
55

6-
## Dependencies
6+
## Contributor docs
77

8-
- Nightly Rust
9-
- [mdbook](https://rust-lang.github.io/mdBook/)
8+
There are several pages for those working on the reference:
109

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.
2614

2715
## Building
2816

2917
To build the Reference, first clone the project:
3018

3119
```sh
3220
git clone https://github.com/rust-lang/reference.git
21+
cd reference
3322
```
3423

3524
(Alternatively, if you don't want to use `git`, [download][] a ZIP file
@@ -38,39 +27,42 @@ top-level directory to `reference`.)
3827

3928
[download]: https://github.com/rust-lang/reference/archive/refs/heads/master.zip
4029

41-
Now change your current directory to the working directory:
30+
### Installing mdbook
4231

43-
```sh
44-
cd reference
45-
```
32+
The Reference is built using [mdbook].
4633

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:
4835

4936
```sh
50-
mdbook test
37+
rustup toolchain install nightly
38+
rustup override set nightly
5139
```
5240

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:
5742

5843
```sh
59-
SPEC_RELATIVE=0 mdbook build --open
44+
cargo install --locked mdbook
6045
```
6146

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/
6348

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
6550

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.
6957

7058
### `SPEC_RELATIVE`
7159

7260
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.
7361

62+
```sh
63+
SPEC_RELATIVE=0 mdbook serve --open
64+
```
65+
7466
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).
7567

7668
### `SPEC_DENY_WARNINGS`
@@ -80,3 +72,12 @@ The `SPEC_DENY_WARNINGS=1` environment variable will turn all warnings generated
8072
### `SPEC_RUST_ROOT`
8173

8274
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.
83+
* `cargo xtask test-all`: Runs all tests.

0 commit comments

Comments
 (0)