D:\Program Files\Microsoft Visual Studio 14.0>rustup update
info: syncing channel updates for 'stable-x86_64-pc-windows-msvc'
info: downloading component 'rustc'
38.1 MiB / 38.1 MiB (100 %) 3.6 MiB/s ETA: 0 s
info: downloading component 'rust-std'
54.3 MiB / 54.3 MiB (100 %) 3.8 MiB/s ETA: 0 s
info: downloading component 'cargo'
info: downloading component 'rust-docs'
11.5 MiB / 11.5 MiB (100 %) 3.2 MiB/s ETA: 0 s
info: installing component 'rustc'
info: installing component 'rust-std'
info: installing component 'cargo'
info: installing component 'rust-docs'
info: syncing channel updates for 'nightly-x86_64-pc-windows-msvc'
info: downloading component 'rustc'
39.9 MiB / 39.9 MiB (100 %) 3.2 MiB/s ETA: 0 s
info: downloading component 'rust-std'
58.6 MiB / 58.6 MiB (100 %) 2.0 MiB/s ETA: 0 s
info: downloading component 'cargo'
3.1 MiB / 3.1 MiB (100 %) 713.1 KiB/s ETA: 0 s
info: downloading component 'rust-docs'
12.8 MiB / 12.8 MiB (100 %) 2.1 MiB/s ETA: 0 s
info: downloading component 'rust-analysis'
597.7 KiB / 597.7 KiB (100 %) 201.0 KiB/s ETA: 0 s
info: downloading component 'rls'
4.0 MiB / 4.0 MiB (100 %) 777.8 KiB/s ETA: 0 s
info: downloading component 'rust-src'
3.1 MiB / 3.1 MiB (100 %) 680.3 KiB/s ETA: 0 s
info: downloading component 'rust-std' for 'i686-pc-windows-msvc'
55.0 MiB / 55.0 MiB (100 %) 3.8 MiB/s ETA: 0 s
info: installing component 'rustc'
info: installing component 'rust-std'
info: installing component 'cargo'
info: installing component 'rust-docs'
info: installing component 'rust-analysis'
info: installing component 'rls'
info: installing component 'rust-src'
info: installing component 'rust-std' for 'i686-pc-windows-msvc'
warning: could not delete temp file: D:\Program Files\.multirust\tmp\kb_tvk27ylo
b7xg9_file
info: checking for self-updates
info: downloading self-update
stable-x86_64-pc-windows-msvc updated - (error reading rustc version)
nightly-x86_64-pc-windows-msvc updated - rustc 1.20.0-nightly (3bfc18a96 2017-
06-29)
D:\Program Files\Microsoft Visual Studio 14.0>error: could not remove 'rustup-bi
n' file: 'C:\Users\me\.cargo\bin\rustup.exe'
info: caused by: Access is denied. (os error 5)
info: backtrace:
stack backtrace:
0: 0x62b6d6 - <no info>
1: 0x6294cc - <no info>
2: 0x527bf6 - <no info>
3: 0x530963 - <no info>
4: 0x429e12 - <no info>
5: 0x434c0c - <no info>
6: 0x4336f0 - <no info>
7: 0x703cb6 - <no info>
8: 0x7012a1 - <no info>
9: 0x43668c - <no info>
10: 0x4013e2 - <no info>
11: 0x76b37c04 - BaseThreadInitThunk
12: 0x775bab8f - RtlInitializeExceptionChain
And then it just hangs forever.
On my system it turned out that some instance of rustup.exe never actually terminated, even though its parent terminal was closed. As a result, windows kept the .exe locked.
I terminated rustup.exe from Task Manager and tried again, this time it worked fine.
For others running into this problem--I just realized that my VS Code, which had the rust language service installed, was running rustup.exe--so closing VS Code fixed it in my case!
I could not find any rust related process running on my system. I was able to update rustup by simply removing rustup.exe and downloading and running rustup-init.exe from the official website.
https://www.rust-lang.org/en-US/install.html
After that, running rustup update prompted me to also remove cargo-fmt and rustfmt, which were then reinstalled and the error is gone.
Suggested fix: try taskkill /F /IM "rls.exe"
rls.exe it's the language server, might be used by editors (including vscode)
Most helpful comment
For others running into this problem--I just realized that my VS Code, which had the rust language service installed, was running
rustup.exe--so closing VS Code fixed it in my case!