11# The Rust Language Reference
22
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.
45
56This document is not normative. It may include details that are specific
67to ` rustc ` itself, and should not be taken as a specification for the
@@ -9,52 +10,54 @@ what we have for now.
910
1011## Dependencies
1112
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/ )
1515
16- ## Build steps
16+ ## Installing dependencies
1717
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:
1920
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
2523```
2624
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:
2827
2928``` sh
30- cd reference
29+ cargo install --locked mdbook
3130```
3231
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:
3435
35- ``` shell
36- rustup override set nightly
36+ ``` sh
37+ git clone https://github.com/rust-lang/reference.git
3738```
3839
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 ` .)
4043
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
4245
43- ``` shell
44- rustup default nightly
46+ Now change your current directory to the working directory:
47+
48+ ``` sh
49+ cd reference
4550```
4651
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 :
4853
49- ``` shell
54+ ``` sh
5055mdbook test
5156```
5257
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:
5560
5661``` sh
57- mdbook build
62+ mdbook build --open
5863```
59-
60- The generated HTML will be in the ` book ` folder.
0 commit comments