rustup: Confusing "toolchain does not support components" message when it's not installed

When a toolchain specified in rust-toolchain file is not installed, the output is as follows:

$ cargo clippy
error: process didn't exit successfully: `rustc -vV` (exit code: 1)
--- stderr
error: 'rustc' is not installed for the toolchain '1.40.0-x86_64-unknown-linux-gnu'
To install, run `rustup component add rustc --toolchain 1.40.0-x86_64-unknown-linux-gnu`

Following the suggestion doesn’t help:

$ rustup component add rustc --toolchain 1.40.0-x86_64-unknown-linux-gnu
error: toolchain '1.40.0-x86_64-unknown-linux-gnu' does not support components

The correct suggestion would be rustup install 1.40.0, which helps.

$ rustup --version
rustup 1.20.2 (2019-10-16)

About this issue

  • Original URL
  • State: open
  • Created 5 years ago
  • Reactions: 7
  • Comments: 15 (6 by maintainers)

Most upvoted comments

Yep. That will mean you have a stable toolchain.

You may also need to run rustup default stable afterwards so that rustup knows which toolchain to use when rust-toolchain files are not around.