Trying to install rustfmt correctly, but component rustfmt is still named rustfmt-preview after updating old nightly

The rustfmt Readme says I should run this command:

rustup component add rustfmt --toolchain nightly

But it doesn't work:

D:\projects>rustup component add rustfmt --toolchain nightly
error: toolchain 'nightly-x86_64-pc-windows-msvc' does not contain component 'ru
stfmt' for target 'x86_64-pc-windows-msvc'
info: backtrace:

stack backtrace:
   0:     0x7ff7f5d2c773 - <no info>
   1:     0x7ff7f5d2bbae - <no info>
   2:     0x7ff7f5d2b718 - <no info>
   3:     0x7ff7f5d2b4e3 - <no info>
   4:     0x7ff7f5977ddd - <no info>
   5:     0x7ff7f59765b8 - <no info>
   6:     0x7ff7f58f2bef - <no info>
   7:     0x7ff7f5905470 - <no info>
   8:     0x7ff7f590c2c6 - <no info>
   9:     0x7ff7f5d3bee7 - <no info>
  10:     0x7ff7f5d5a0a2 - <no info>
  11:     0x7ff7f5d34833 - <no info>
  12:     0x7ff7f590767a - <no info>
  13:     0x7ff7f5db1c64 - <no info>
  14:     0x7ffa648613d2 - BaseThreadInitThunk
D:\projects>rustup show
Default host: x86_64-pc-windows-msvc

installed toolchains
--------------------

stable-x86_64-pc-windows-msvc
nightly-2019-09-22-x86_64-pc-windows-msvc
nightly-2019-09-24-x86_64-pc-windows-msvc
nightly-x86_64-pc-windows-msvc (default)

installed targets for active toolchain
--------------------------------------

i686-pc-windows-msvc
wasm32-unknown-unknown
x86_64-pc-windows-msvc

active toolchain
----------------

nightly-x86_64-pc-windows-msvc (default)
rustc 1.40.0-nightly (37538aa13 2019-09-25)
D:\projects>rustup component list
cargo-x86_64-pc-windows-msvc (default)
llvm-tools-preview-x86_64-pc-windows-msvc
miri-preview-x86_64-pc-windows-msvc
rls-preview-x86_64-pc-windows-msvc
rust-analysis-x86_64-pc-windows-msvc (installed)
rust-docs-x86_64-pc-windows-msvc (default)
rust-src (installed)
rust-std-aarch64-apple-ios
rust-std-aarch64-fuchsia
rust-std-aarch64-linux-android
rust-std-aarch64-pc-windows-msvc
rust-std-aarch64-unknown-cloudabi
rust-std-aarch64-unknown-linux-gnu
rust-std-aarch64-unknown-linux-musl
rust-std-aarch64-unknown-redox
rust-std-arm-linux-androideabi
rust-std-arm-unknown-linux-gnueabi
rust-std-arm-unknown-linux-gnueabihf
rust-std-arm-unknown-linux-musleabi
rust-std-arm-unknown-linux-musleabihf
rust-std-armebv7r-none-eabi
rust-std-armebv7r-none-eabihf
rust-std-armv5te-unknown-linux-gnueabi
rust-std-armv5te-unknown-linux-musleabi
rust-std-armv7-apple-ios
rust-std-armv7-linux-androideabi
rust-std-armv7-unknown-linux-gnueabi
rust-std-armv7-unknown-linux-gnueabihf
rust-std-armv7-unknown-linux-musleabi
rust-std-armv7-unknown-linux-musleabihf
rust-std-armv7r-none-eabi
rust-std-armv7r-none-eabihf
rust-std-armv7s-apple-ios
rust-std-asmjs-unknown-emscripten
rust-std-i386-apple-ios
rust-std-i586-pc-windows-msvc
rust-std-i586-unknown-linux-gnu
rust-std-i586-unknown-linux-musl
rust-std-i686-apple-darwin
rust-std-i686-linux-android
rust-std-i686-pc-windows-gnu
rust-std-i686-pc-windows-msvc (installed)
rust-std-i686-unknown-freebsd
rust-std-i686-unknown-linux-gnu
rust-std-i686-unknown-linux-musl
rust-std-mips-unknown-linux-gnu
rust-std-mips-unknown-linux-musl
rust-std-mips64-unknown-linux-gnuabi64
rust-std-mips64el-unknown-linux-gnuabi64
rust-std-mipsel-unknown-linux-gnu
rust-std-mipsel-unknown-linux-musl
rust-std-mipsisa32r6-unknown-linux-gnu
rust-std-mipsisa32r6el-unknown-linux-gnu
rust-std-mipsisa64r6-unknown-linux-gnuabi64
rust-std-mipsisa64r6el-unknown-linux-gnuabi64
rust-std-nvptx64-nvidia-cuda
rust-std-powerpc-unknown-linux-gnu
rust-std-powerpc64-unknown-linux-gnu
rust-std-powerpc64le-unknown-linux-gnu
rust-std-riscv32i-unknown-none-elf
rust-std-riscv32imac-unknown-none-elf
rust-std-riscv32imc-unknown-none-elf
rust-std-riscv64gc-unknown-none-elf
rust-std-riscv64imac-unknown-none-elf
rust-std-s390x-unknown-linux-gnu
rust-std-sparc64-unknown-linux-gnu
rust-std-sparcv9-sun-solaris
rust-std-thumbv6m-none-eabi
rust-std-thumbv7em-none-eabi
rust-std-thumbv7em-none-eabihf
rust-std-thumbv7m-none-eabi
rust-std-thumbv7neon-linux-androideabi
rust-std-thumbv7neon-unknown-linux-gnueabihf
rust-std-thumbv8m.base-none-eabi
rust-std-thumbv8m.main-none-eabi
rust-std-thumbv8m.main-none-eabihf
rust-std-wasm32-unknown-emscripten
rust-std-wasm32-unknown-unknown (installed)
rust-std-wasm32-wasi
rust-std-x86_64-apple-darwin
rust-std-x86_64-apple-ios
rust-std-x86_64-fortanix-unknown-sgx
rust-std-x86_64-fuchsia
rust-std-x86_64-linux-android
rust-std-x86_64-pc-solaris
rust-std-x86_64-pc-windows-gnu
rust-std-x86_64-pc-windows-msvc (default)
rust-std-x86_64-rumprun-netbsd
rust-std-x86_64-sun-solaris
rust-std-x86_64-unknown-cloudabi
rust-std-x86_64-unknown-freebsd
rust-std-x86_64-unknown-linux-gnu
rust-std-x86_64-unknown-linux-gnux32
rust-std-x86_64-unknown-linux-musl
rust-std-x86_64-unknown-netbsd
rust-std-x86_64-unknown-redox
rustc-x86_64-pc-windows-msvc (default)
rustfmt-preview-x86_64-pc-windows-msvc

Why do I only have rustfmt-preview (and rls-preview and miri-preview)?
When I run rustup component list in my Windows virtual machine (rustc nightly as default), it shows rustfmt and rls in the list of components. Didn't both projects leave the preview phase behind?
Btw, I hadn't used this laptop since December, and I had an old nightly from like 2018-11-20 and I just updated my nightly to 2019-09-24 recently.
When I run rustup component add rustfmt-preview, it seems to install rustfmt:

D:\projects>rustup component add rustfmt-preview
info: downloading component 'rustfmt-preview'
  1.8 MiB /   1.8 MiB (100 %) 165.1 KiB/s ETA:   0 s
info: installing component 'rustfmt-preview'

D:\projects>cargo fmt --version
rustfmt 1.4.8-nightly (afb1ee1c 2019-09-08)

And it seems to be the latest version, but how can I install it the right way, under the right name (not preview)? (Same for RLS and miri. Btw, I noticed in my Windows virtual machine that miri doesn't appear in the components at all.)
It seems that even though my nightly got updated, the component names are still the old ones.
Maybe something else (that's more important than names) was also left over from the old nightly?

I want to ensure that all parts of my nightly (and other installed toolchains) are fully updated but without having to reinstall my whole rust installation and all my cargo-installed binaries, redownload & recompile all dependencies / repopulate cargo's registry and having to install VS2019.
(When installing rustup in my Windows virtual machine I noticed it now says I have to install VS2019 but on my real PC I'm still on VS2015 and my folder is still called .multirust from back in the day when I first installed multirust (in 2015) and I want to keep things working without reinstallation if possible.)

1 Like

Maybe rustup self update will help here?

I just did rustup self update, it still lists the preview names for the components.

D:\projects>rustup self update
info: checking for self-updates
info: downloading self-update
info: rustup updated successfully to 1.19.0

Shouldn't every rustup update nightly also cause a self-update anyway?
(When I just ran it again, it printed the same output. So it was already up-to-date before.)

Btw, even after I installed rustfmt-preview, only invocation through cargo fmt works, but calling rustfmt directly doesn't, which should work (I inferred this from the fact that the RustFmt Sublime package calls rustfmt directly, which fails. It only works when I override the path in its settings with "executable": ["D:\\Program Files\\.multirust\\toolchains\\nightly-x86_64-pc-windows-msvc\\bin\\rustfmt.exe"]).
My %HOME%\.cargo\bin folder does not have rustfmt.exe, I only have "D:\Program Files\.multirust\toolchains\nightly-x86_64-pc-windows-msvc\bin\rustfmt.exe" (and cargo-fmt.exe in the same folder).

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.