Error: toolchain 'stable-x86_64-apple-darwin' does not have a binary `rustfmt`

I started rustup updateto update my toolchain and saw two warnings:

warning: tool `rustfmt` is already installed, remove it from `/Users/<username>/.cargo/bin`, then run `rustup update` to have rustup manage this tool.
warning: tool `cargo-fmt` is already installed, remove it from `/Users/<username>/.cargo/bin`, then run `rustup update` to have rustup manage this tool.

I followed the instructions in the warning messages and then tried to start rustfmtagain. I got an error

error: toolchain 'stable-x86_64-apple-darwin' does not have the binary rustfmt`

What went wrong and how can I fix it?

+17
source share
3 answers

, , Rustup rustfmt rustfmt. , , cargo install. rustfmt , Rustup .

Rustup rustfmt, . :

  1. Rustup , warning: tool rustfmt is already installed. Cargo, . cargo uninstall rustfmt ( rustfmt-nightly ) .
  2. rustup update rustfmt rustfmt cargo-fmt.
  3. rustfmt-preview , . , stable . , , , :
$ rustup component add rustfmt-preview

rustfmt :

$ rustup run stable rustfmt --version

rustfmt 0.99.4-stable (1c40881 2018-08-27)

rustfmt Rustup, . PR (β„– 1305 β„– 1310), .

+16

, rustfmt-preview *-apple-darwin.

:

rustup component add rustfmt-preview --toolchain stable-x86_64-apple-darwin

, :)

+16
$ rustup run stable rustfmt --version
error: 'toolchain 'stable-x86_64-pc-windows-msvc' does not have th'e binary 'rustfmt.exe'

$ rustup component remove rustfmt-preview --toolchain=stable-x86_64-pc-windows-msvc
info: removing component 'rustfmt-preview'
warning: during uninstall component rustfmt-preview-x86_64-pc-windows-msvc was not found

$ rustup component add rustfmt-preview --toolchain=stable-x86_64-pc-windows-msvc
info: downloading component 'rustfmt-preview'
info: installing component 'rustfmt-preview'

$ rustup run stable rustfmt --version
rustfmt 0.99.1-stable (da17b689 2018-08-04)

https://users.rust-lang.org/t/problem-with-rustfmt-on-stable/15165/7

0

All Articles