You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Show installed path of Rust components: sources, docs & Clippy #3382
You can see the files that rust-src includes by cat ~/.rustup/toolchains/<toolchain-name>/lib/rustlib/manifest-rust-src.
@rbtcollinsrustup which rust-src should show path to sources of the default toolchain (stable or nightly). Similarly, rustup which clippy and rustup which rust-docs should also work.
@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?
Implement rustup which --prefix which gives ~/.rustup/toolchains/<toolchain-name>/bin and let the user handle the rest.
Implement something like rustup component list --verbose which will add a path to lines like rustc-aarch64-apple-darwin (installed), and will print the path next to each component on rustup component list --installed --verbose.
Implement 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 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 The plan is to finish this in the v1.28.0 release cycle, but as my life plans have suddenly changed and I'm now prioritizing my personal issues, I cannot give any guarantees on that. Please remember the Rustup project is fully run by volunteers and so far all team members are doing this as a hobby. If you'd like to work on this issue, please go ahead :)
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 rustcalready 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-srcshould show path to sources of the default toolchain (stable or nightly). Similarly,rustup which clippyandrustup which rust-docsshould 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 --pathfor 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
--helpstring though.Yes. Please note that
clippy-driveris 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 --prefixwhich gives~/.rustup/toolchains/<toolchain-name>/binand let the user handle the rest.rustup component list --verbosewhich 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 --verbosewhich 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?
rami3l commentedon Jul 24, 2024
@sohang3112 The plan is to finish this in the v1.28.0 release cycle, but as my life plans have suddenly changed and I'm now prioritizing my personal issues, I cannot give any guarantees on that. Please remember the Rustup project is fully run by volunteers and so far all team members are doing this as a hobby. If you'd like to work on this issue, please go ahead :)
sohang3112 commentedon Jul 24, 2024
Ok, I'll do that in a while. I'm new to Rust so I'll ask you if I have any questions.