Skip to content

Commit 81b8df4

Browse files
committed
Add rust-toolchain.toml and revise README
We spent a lot of text in the README describing how to use the nightly Rust compiler with this project. Let's instead add a `rust-toolchain.toml` file so that the nightly compiler is used automatically, and let's redraft the README in that light. With this revision, we'll add a section on installing dependencies in which we'll describe how to ensure that the nightly compiler is installed and up to date and how to install `mdbook`. When describing how to clone the project, we'll suggest that people clone the URL ending in `.git`. This is what GitHub recommends, and it removes a level of redirection which sometimes matters. For people who want to download a ZIP file rather than using `git`, we'll provide a direct link rather than simply referencing the GitHub page. When describing how to build the book, we'll suggesting passing `--open` to `mdbook`, as this is usually what people will want, and it will save a step. Along with these changes, we include some general copyediting.
1 parent 1a23297 commit 81b8df4

File tree

2 files changed

+30
-32
lines changed

2 files changed

+30
-32
lines changed

README.md

Lines changed: 28 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -10,58 +10,54 @@ what we have for now.
1010

1111
## Dependencies
1212

13-
- rustc (the Rust compiler).
14-
- [mdbook](https://rust-lang.github.io/mdBook/) (use `cargo install
15-
mdbook` to install it).
16-
- rust nightly (you would be required to set your Rust version to the
17-
nightly version to make sure all tests pass).
13+
- Nightly Rust
14+
- [mdbook](https://rust-lang.github.io/mdBook/)
1815

19-
## Build steps
16+
## Installing dependencies
2017

21-
To build the project, follow the steps given below:
18+
First, ensure that you have a recent copy of the nightly Rust compiler
19+
installed, as this is needed in order to run the tests:
2220

23-
Clone the project by downloading the ZIP from the [GitHub
24-
page](https://github.com/rust-lang/reference) or run the following
25-
command:
26-
27-
```
28-
git clone https://github.com/rust-lang/reference
21+
```sh
22+
rustup toolchain install nightly
2923
```
3024

31-
Change the directory to the downloaded repository:
25+
Now, ensure you have `mdbook` installed, as this is needed in order to
26+
build the Reference:
3227

3328
```sh
34-
cd reference
29+
cargo install --locked mdbook
3530
```
3631

37-
To run the tests, you would need to set the Rust version to the nightly
38-
release. You can do this by executing the following command:
32+
## Building
33+
34+
To build the Reference, first clone the project:
3935

40-
```shell
41-
rustup override set nightly
36+
```sh
37+
git clone https://github.com/rust-lang/reference.git
4238
```
4339

44-
This will set the nightly version only for your the current project.
40+
(Alternatively, if you don't want to use `git`, [download][] a ZIP file
41+
of the project, extract it using your preferred tool, and rename the
42+
top-level directory to `reference`.)
4543

46-
If you wish to set Rust nightly for all your projects, you can run the
47-
command:
44+
[download]: https://github.com/rust-lang/reference/archive/refs/heads/master.zip
4845

49-
```shell
50-
rustup default nightly
46+
Now change your current directory to the working directory:
47+
48+
```sh
49+
cd reference
5150
```
5251

53-
Now, run the following command to test the code snippets to catch
54-
compilation errors:
52+
To test all of the code examples in the Reference, run:
5553

56-
```shell
54+
```sh
5755
mdbook test
5856
```
5957

60-
61-
To generate a local instance of the book, run:
58+
To build the Reference locally (in `build/`) and open it in a web
59+
browser, run:
6260

6361
```sh
64-
mdbook build
62+
mdbook build --open
6563
```
66-
67-
The generated HTML will be in the `book` folder.

rust-toolchain.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[toolchain]
2+
channel = "nightly"

0 commit comments

Comments
 (0)