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

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

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Changes from 2 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
25 changes: 25 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is correct. You should be able to install the nightly toolchain and components from anywhere.

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

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have completly re-written the section.

### 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:
Copy link
Contributor

@ytmimi ytmimi Aug 28, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Make sure to have installed the correct toolchain and all components.
The needed parts can be found in the file `rust-toolchain`. For example:
rustfmt depends on compiler internals and therefore pins a specific version of the nightly compiler.
Make sure you've installed the correct nightly [toolchain](https://rust-lang.github.io/rustup/concepts/toolchains.html) and all [components](https://rust-lang.github.io/rustup/concepts/components.html) listed in rustfmt's [`rust-toolchain` file](https://github.com/rust-lang/rustfmt/blob/master/rust-toolchain).

It's probably worth mentioning this information before telling users to build rustfmt with cargo build or mention that they should follow these steps if they're having issues building.


```
[toolchain]
channel = "nightly-2024-08-17"
components = ["llvm-tools", "rustc-dev"]
```
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd prefer not to list the content of the rust-toolchain file inline. Instead, I'd rather linked out to the file [`rust-toolchain`](https://github.com/rust-lang/rustfmt/blob/master/rust-toolchain), and let users know that they need to install the exact nightly version of the compiler that rustfmt has pinned in its rust-toolchain file.


According to this content, install the toolchain with `rustup install`:

```
rustup install nightly-2024-08-17
```
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets point users to the rust-toolchain file to get the exact date:

Suggested change
```
rustup install nightly-2024-08-17
```
```
rustup install nightly-YYYY-MM-DD
```


and the components with `rustup component add`

```
rustup component add llvm-tools
rustup component add rustc-dev
```

## Configuring Rustfmt

Expand Down
Loading