1
1
# The Rust Language Reference
2
2
3
- This document is the primary reference for the Rust programming language.
3
+ This document is the primary reference for the Rust programming
4
+ language.
4
5
5
6
This document is not normative. It may include details that are specific
6
7
to ` rustc ` itself, and should not be taken as a specification for the
@@ -9,52 +10,54 @@ what we have for now.
9
10
10
11
## Dependencies
11
12
12
- - rustc (the Rust compiler).
13
- - [ mdbook] ( https://rust-lang.github.io/mdBook/ ) (use ` cargo install mdbook ` to install it).
14
- - rust nightly (you would be required to set your Rust version to the nightly version to make sure all tests pass)
13
+ - Nightly Rust
14
+ - [ mdbook] ( https://rust-lang.github.io/mdBook/ )
15
15
16
- ## Build steps
16
+ ## Installing dependencies
17
17
18
- 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:
19
20
20
- Clone the project by downloading the ZIP from the [ GitHub page] ( https://github.com/rust-lang/reference ) or
21
- run the following command:
22
-
23
- ```
24
- git clone https://github.com/rust-lang/reference
21
+ ``` sh
22
+ rustup toolchain install nightly
25
23
```
26
24
27
- 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:
28
27
29
28
``` sh
30
- cd reference
29
+ cargo install --locked mdbook
31
30
```
32
31
33
- To run the tests, you would need to set the Rust version to the nightly release. You can do this by executing the following command:
32
+ ## Building
33
+
34
+ To build the Reference, first clone the project:
34
35
35
- ``` shell
36
- rustup override set nightly
36
+ ``` sh
37
+ git clone https://github.com/rust-lang/reference.git
37
38
```
38
39
39
- 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 ` .)
40
43
41
- If you wish to set Rust nightly for all your projects, you can run the command:
44
+ [ download ] : https://github.com/rust-lang/reference/archive/refs/heads/master.zip
42
45
43
- ``` shell
44
- rustup default nightly
46
+ Now change your current directory to the working directory:
47
+
48
+ ``` sh
49
+ cd reference
45
50
```
46
51
47
- Now, run the following command to test the code snippets to catch compilation errors :
52
+ To test all of the code examples in the Reference, run :
48
53
49
- ``` shell
54
+ ``` sh
50
55
mdbook test
51
56
```
52
57
53
-
54
- 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:
55
60
56
61
``` sh
57
- mdbook build
62
+ mdbook build --open
58
63
```
59
-
60
- The generated HTML will be in the ` book ` folder.
0 commit comments