-
Notifications
You must be signed in to change notification settings - Fork 897
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
rustup component list
on custom toolchain should work
#1570
Comments
Well actually, it's called by the VSCode RLS plugin |
What would you expect |
Ideally it'd list what components of the toolchain were present just as non-custom toolchains do-- e.g. my prebuilt toolchain dir for Fuchsia includes all of the following:
I don't know how feasible this is, but essentially I want using a custom toolchain to "just work" with other existing tools just like using a rustup-provided toolchain would. |
Okay, so this is partially plausible. The issue I have is that E.g. $ rustup show proxies --toolchain fuchsia
rustc
rustdoc
cargo
rust-lldb
rust-gdb
rls
cargo-clippy
clippy-driver
cargo-miri
rustfmt
cargo-fmt vs. a hypothetical stage 1 which only had rustc rustdoc, rustfmt and cargo: $ rustup show proxies --toolchain stage1
rustc
rustdoc
cargo
rust-lldb (missing)
rust-gdb (missing)
rls (missing)
cargo-clippy (missing)
clippy-driver (missing)
cargo-miri (missing)
rustfmt
cargo-fmt Would that kind of thing satisfy? I don't want to fake components if I can avoid it. |
I think the biggest use case here is tools like Ideally I'd say that "does this toolchain have these components?" would be a special-case command but either way you wind up with the chicken-and-egg problem of having to first check whether Given that custom toolchains require explicit installation I don't know that it'd be terribly confusing to at least make A downside to adding some new command here is that we'd have to go and fix all the tools that invoke |
We've recently been putting in work which actually makes this harder (but makes it better in the codebase) perhaps we could make it warn if it's not a dist toolchain and then return an empty list on stdout rather than erroring though. @rbtcollins what do you think? |
Custom toolchains are an edge case, and I'm not surprised that supporting them properly would require introducing some additional complexities. However, they're a perfectly valid (and, as more industry adoption occurs, increasingly widespread) usecase, and I think it's important that our tools support them properly. |
So uhm. At a high level doing 'component add' on a custom toolchain is flat out impossible - the whole definition of a custom toolchain is one that doesn't implement the interface for installing components. So IDE's that want to work with custom builds of toolchains will need to be coded to understand that installing additional components is a bespoke operation for those custom builds (e.g. tell the user to do it, rather than complaining). Our concept of 'component installed' is actually listing metadata, not interrogating installed files; I think perhaps rls-vscode is heading in the wrong direction here, and should instead be trying to execute the thing it needs, rather than querying whether it is installed first. Now, the question is what does useful output for a component list on a custom toolchain look like. I think its a category error to give an empty list: code that tries a list then an add will proceed to the add step inappropriately, and we will then have to debug and work back to the cause (that the toolchain is custom). I think more machine readable output would help, in particular I'd like to start doing yaml or perhaps JSON error codes for things like vscode, so that UI tweaks don't destabilise higher level tools. |
Fully agree on this. I'd argue that JSON is the de facto standard for machine readable data in cases like this (for better or worse) and given that If you do implement this the biggest design decision I think you should make up front is whether JSON output means "one JSON object written to stdout per invocation" or "a series of JSON objects written to stdout per invocation, one per line". You could make an argument either way.
Writing a single JSON object per invocation would mean that you could define a JSON schema for each command's output (which is super nice to have in documentation). Either way you'd want to define what JSON output means when errors occur etc. Do JSON formatted errors get written? To |
@luser yes, all of those things. Thanks for the pointers to the cargo behaviours, I think matching those as a baseline is a good idea; rustup too has N>1 status message to send, so the design domain is very similar. |
@cramertj My current thoughts on custom toolchains is that they tend to be used primarily by compiler/stdlib devs and as such don't need component support. Instead we need to make it easier for those devs to publish channels which can then be installed from, supporting the combination of components which the devs wish to publish. Such custom dist channel support will need some deep changed to rustup but would, IMO, be much better than a superficial fascia overtop custom toolchains to fake up components. |
Hi, sorry, I know this is not a critical issue, but although I agree with Kinnison I don't know if there are any steps to happen or if this is going to stay locked here for a very long time 😞 |
I did start to write up a starter-for-ten on how custom toolchain providers might present channels and how Rustup might consume them coherently - https://hackmd.io/X_xhHKHnRnycDDJURv2M4A?view - it is still a very basic idea though. If @Nassiel wanted to participate in design and possibly subsequent implementation, we can arrange conversations. |
Hi @kinnison sure, any discord where we can chat? |
The rust discord has a wg-tools folder and wg-rustup is part of that. |
Currently this outputs
This is called by RLS so it's needed to use the RLS with custom toolchains.
The text was updated successfully, but these errors were encountered: