Open
Description
Problem you are trying to solve
It would be nice if Rustup itself could show the paths of where Rust components (eg. rustc
, rust_src
, etc.) are installed.
Solution you'd like
Add a command to show path of Rust components (if installed).
$ rustup which rust_src
/path/to/folder/where/installed/rust_src
Notes
No response
Metadata
Metadata
Assignees
Type
Projects
Milestone
Relationships
Development
No branches or pull requests
Activity
rbtcollins commentedon Aug 13, 2023
Components aren't installed into isolated directories - they all exist under the toolchain root.
If you want the path to a binary,
rustup which rustc
already exists.Possibly documentation could be improved here.
sohang3112 commentedon Aug 14, 2023
@rbtcollins How can I find the path to installed Rust sources?
rbtcollins commentedon Aug 20, 2023
You can see the files that rust-src includes by
cat ~/.rustup/toolchains/<toolchain-name>/lib/rustlib/manifest-rust-src
.sohang3112 commentedon Apr 19, 2024
@rbtcollins
rustup which rust-src
should show path to sources of the default toolchain (stable or nightly). Similarly,rustup which clippy
andrustup which rust-docs
should also work.[-]Show installed path of components[/-][+]Show installed path of Rust sources[/+][-]Show installed path of Rust sources[/-][+]Show installed path of Rust components: sources, docs & Clippy[/+]rami3l commentedon Apr 19, 2024
@rbtcollins I believe we have
rustup doc --path
for this.sohang3112 commentedon Apr 20, 2024
@rami3l TIL about
rustup doc --path
- is this mentioned in the documentation? Also are there similar commands to find paths of Rust sources and Clippy?rami3l commentedon Apr 20, 2024
@sohang3112 May I ask what you are using these paths for?
Not yet, but there probably should be. It's already in the
--help
string though.Yes. Please note that
clippy-driver
is the real name ofclippy
, this is clearly documented in the Clippy User Guide.So for the moment being:
If you don't like that hack, there's a more stable alternative to it:
$ echo "$(rustup show home)/toolchains/$(rustup show active-toolchain | awk '{print $1;}')"
I agree that the user experience here is awfully inconsistent and could use some improvements, doc-wise or impl-wise.
rami3l commentedon Apr 20, 2024
@rbtcollins Moving forwards I suggest we either:
rustup which --prefix
which gives~/.rustup/toolchains/<toolchain-name>/bin
and let the user handle the rest.rustup component list --verbose
which will add a path to lines likerustc-aarch64-apple-darwin (installed)
, and will print the path next to each component onrustup component list --installed --verbose
.rustup show active-toolchain --verbose
which will do something similar to 2) but just for a single toolchain.In any case, this should be scheduled after #3225 and #3596. The actual subcommand can be debated. We can afford to have true aliases as in #3596.
rami3l commentedon Apr 20, 2024
@sohang3112 Thanks a lot for your support!
... but you haven't answered my question yet:
Your original motivation is also very important in deciding the way forward.
sohang3112 commentedon Apr 20, 2024
@rami3l I originally started looking for the path to Rust sources when VS Code wasn't able to find Rust sources (I think it had something to do with some things not working for Rust in VS Code: Go to Definition, hovering to show function, etc. - I don't remember the exact details now). VS Code Rust extension gave an error that it couldn't find Rust sources.
sohang3112 commentedon Jul 23, 2024
@rami3l Is there any update on this issue?
6 remaining items