Skip to content

update README.md on how to install toolchain and components #6294

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

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Prev Previous commit
Next Next commit
change docs to troubleshoot a case of corrupt toolchains
  • Loading branch information
Goetz Markgraf committed Aug 29, 2024
commit b398f1b2d4d50aa5183a88cd75f67bf1be815a26
34 changes: 17 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -153,29 +153,29 @@ notes above on running rustfmt.

All command should be run in the project's root directory.

### Update Toolchain
### Troubleshooting the toolchain

Make sure to have installed the correct toolchain and all components.
The needed parts can be found in the file `rust-toolchain`. For example:
This project uses a pinned toolchain with specific components, as indicated in
[`rust-toolchain`](https://github.com/rust-lang/rustfmt/blob/master/rust-toolchain).
The toolchain hat the name 'nightly-YYYY-MM-DD'.

```
[toolchain]
channel = "nightly-2024-08-17"
components = ["llvm-tools", "rustc-dev"]
```
If your compiler complains that it cannot find dependencies like `rustc_*`, you might have
a wrong or corrupted toolchain. Here's what you can do:

According to this content, install the toolchain with `rustup install`:
Check the active toolchain by running `rustup show` in the project directory. It should
list all installed toolchains, including the one indicated in `rust-toolchain`. The same
should be given as 'active toolchain' with the hint that it was overridden by the
`rust-toolchain` file.

```
rustup install nightly-2024-08-17
```
Make sure that you don't have a directory override. You can remove it with
`rustup override unset`.

and the components with `rustup component add`
If the build still fails, try to completly remove the given toolchain with
`rustup toolchain uninstall nightly-YYYY-MM-DD`. The next `cargo build` should
download and install it correctly.

```
rustup component add llvm-tools
rustup component add rustc-dev
```
Additional documentation can be found here:
[Rustup Book, Chapter Overrides](https://rust-lang.github.io/rustup/overrides.html).

## Configuring Rustfmt

Expand Down
Loading