rustup: rustup component add rust-analyzer-preview does not add rust-analyzer executable to ~/.cargo/bin
Problem
I can install rust-analyzer using rustup component add rust-analyzer-preview but it is not added to ~/.cargo/bin like all other components (clippy, rustfmt, …) and therefore not in the path and not executable.
Steps
Possible Solution(s)
Notes
Output of rustup --version: rustup 1.22.1 (b01adbbc3 2020-07-08)
Output of rustup show:
Default host: x86_64-unknown-linux-gnu
rustup home: /home/user/.rustup
installed toolchains
--------------------
stable-x86_64-unknown-linux-gnu
beta-x86_64-unknown-linux-gnu
nightly-2020-03-19-x86_64-unknown-linux-gnu
nightly-x86_64-unknown-linux-gnu (default)
1.37.0-x86_64-unknown-linux-gnu
installed targets for active toolchain
--------------------------------------
wasm32-unknown-unknown
x86_64-unknown-linux-gnu
active toolchain
----------------
nightly-x86_64-unknown-linux-gnu (default)
rustc 1.46.0-nightly (5db778aff 2020-07-09)
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 12
- Comments: 18 (3 by maintainers)
Now that the rust-analyzer is officially announced as default LS, will the binary be installed to default location in next release?
This is the expected behaviour at this point. #2408 added the proxy but I’m considering if it ought to be in
TOOLSorDUP_TOOLSbecause people have installed it via other means before now. For now, as per people who have talked about it, you can runrust-analyzerviarustup run nightly rust-analyzerwhich you can always set up as a shell alias if you want, or a small shell script if you so desire.The next release of
rustupwill contain the proxy either way.Will we eventually get this working out of the box?
According to the rust-lang blog post from Sept 22, 2022, rust-analyzer is now available via rustup.
The following works for me:
According to the blog post, “The next release of rustup will provide a built-in proxy so that running the executable
rust-analyzerwill launch the appropriate version.”Note that this change was backed out in 1.23 because
rust-analyzerisn’t stable yet: https://github.com/rust-lang/rustup/pull/2408#issuecomment-734899954I don’t think it’s appropriate for this bug to be closed when the feature it requests is accepted but not yet delivered.
Works like a charm. Sry I didnt see your message sooner. In the next release it should be part of the path automatically already tho. This above is just temporarily necessary before that.
I see. Feel free to close.
Maybe we could get
rustup run default ...added? I was surprised to find that that doesn’t already work.@zackw Nice tip! Only
"$@"is missing at the end to work with--versionor similar arguments.My complete version of
~/.cargo/bin/rust-analyzer:@lesleyrs This wrapper script may help, put it in
$HOME/.local/binor some other directory on your PATH and chmod +x it:I love this, I also got it running on helix with a custom
rustup run stable rust-analyzercommand, but I am confused about the version. Why does the --version show the version of rustc and not the version of the real rust-analyzer?