Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add rust-toolchain.toml and revise README #1474

Merged
merged 2 commits into from
Feb 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 30 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# The Rust Language Reference

This document is the primary reference for the Rust programming language.
This document is the primary reference for the Rust programming
language.

This document is not normative. It may include details that are specific
to `rustc` itself, and should not be taken as a specification for the
Expand All @@ -9,52 +10,54 @@ what we have for now.

## Dependencies

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

## Build steps
## Installing dependencies

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

Clone the project by downloading the ZIP from the [GitHub page](https://github.com/rust-lang/reference) or
run the following command:

```
git clone https://github.com/rust-lang/reference
```sh
rustup toolchain install nightly
```

Change the directory to the downloaded repository:
Now, ensure you have `mdbook` installed, as this is needed in order to
build the Reference:

```sh
cd reference
cargo install --locked mdbook
```

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:
## Building

To build the Reference, first clone the project:

```shell
rustup override set nightly
```sh
git clone https://github.com/rust-lang/reference.git
```

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

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

```shell
rustup default nightly
Now change your current directory to the working directory:

```sh
cd reference
```

Now, run the following command to test the code snippets to catch compilation errors:
To test all of the code examples in the Reference, run:

```shell
```sh
mdbook test
```


To generate a local instance of the book, run:
To build the Reference locally (in `build/`) and open it in a web
browser, run:

```sh
mdbook build
mdbook build --open
```

The generated HTML will be in the `book` folder.
2 changes: 2 additions & 0 deletions rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[toolchain]
channel = "nightly"