From 29674fcaa3d8c9ef9adfaf80b3c5ca2658fd5380 Mon Sep 17 00:00:00 2001 From: Goetz Markgraf Date: Sun, 25 Aug 2024 16:01:03 +0200 Subject: [PATCH 1/3] update documentation on how to install toolchain and components --- README.md | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/README.md b/README.md index b68a942e463..dcac1a35922 100644 --- a/README.md +++ b/README.md @@ -151,6 +151,31 @@ for more info. To run rustfmt after this, use `cargo run --bin rustfmt -- filename`. See the notes above on running rustfmt. +All command should be run in the project's root directory. + +### Update 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: + +``` +[toolchain] +channel = "nightly-2024-08-17" +components = ["llvm-tools", "rustc-dev"] +``` + +According to this content, install the toolchain with `rustup install`: + +``` +rustup install nightly-2024-08-17 +``` + +and the components with `rustup component add` + +``` +rustup component add llvm-tools +rustup component add rustc-dev +``` ## Configuring Rustfmt From b398f1b2d4d50aa5183a88cd75f67bf1be815a26 Mon Sep 17 00:00:00 2001 From: Goetz Markgraf Date: Thu, 29 Aug 2024 21:22:49 +0200 Subject: [PATCH 2/3] change docs to troubleshoot a case of corrupt toolchains --- README.md | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index dcac1a35922..84c8f0bc69b 100644 --- a/README.md +++ b/README.md @@ -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 From 8efc3289f7338b5499308daa8ee50d30f5e12c8e Mon Sep 17 00:00:00 2001 From: Goetz Markgraf Date: Thu, 29 Aug 2024 21:26:47 +0200 Subject: [PATCH 3/3] delete a wrong line --- README.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/README.md b/README.md index 84c8f0bc69b..4ed106bd973 100644 --- a/README.md +++ b/README.md @@ -151,8 +151,6 @@ for more info. To run rustfmt after this, use `cargo run --bin rustfmt -- filename`. See the notes above on running rustfmt. -All command should be run in the project's root directory. - ### Troubleshooting the toolchain This project uses a pinned toolchain with specific components, as indicated in