Description
Context
As you must've noticed the RLS and Clippy are not shipped with nightly builds for quite a few releases now. This happens when a change lands to the Rust compiler and a tool cannot be built or its test fail when using the currently built compiler. Currently, the RLS explicitly depends (in Cargo sense) on Clippy, which means that whenever Clippy cannot build, the RLS also fails the build and is thus not included in the nightlies.
In practice, there's a lot more breakage involved for the Clippy since it uses rustc internals quite heavily (e.g. directly inspects AST/HIR structures), while the problem is sidestepped by the RLS by relying on the internal Rust librustc_save_analysis
library doing all the heavy lifting and outputting relevant information to JSON.
While specifically the current breakage requires more work/coordination (caused by moving libtest out of tree, please help with #59440 if you know how!) and has caused more fallout than typical breakages, and regardless of the fact that we don't guarantee component availability for the nightly channel, I'd like us to try our best and ship RLS if possible, even without Clippy support.
Implementation
Implementation-wise I believe this can be done by running Clippy tool test first and if it's detected as failed by rustbuild, then it will try to build RLS in the --no-default-features
mode (Clippy support is gated by the only default clippy
feature). When RLS is built without Clippy support, we can warn the user on start up that that version has no Clippy support enabled because it's not available in that build.
Alternatives
Create a separate rustup-complete
channel that's only released with all the tools
While this may be a somewhat viable or desired idea:
- IIRC the current breakage lasts for 1-2 weeks now which is the 1/3 of a version release cycle (...which makes it more of a
fortnightly
release) - requires more infrastructure/implementation effort in the rustup/rustbuild
- doesn't solve the case for the regular
nightly
release, which is often the case for people actively working on the compiler or related tooling (hurts contributability)
Do nothing
We just 🤷♂️ and tell people to move off nightly or pin to a specific nightly release.
That's not great because there's still a fair chunk of the ecosystem that's bound to nightly features. If we make them pin to a specific release, then there's UX/discoverability issue.
Right now, when the user either tries to update the preexisting toolchain or install a fresh one with RLS, they fail with an uninformative "rls
component is unavailable" message. Then, they need to either learn about or navigate to https://rust-lang.github.io/rustup-components-history/ to learn which was the most recent toolchain with RLS shipped (even then, right now it's impossible since the history shows "missing" for the last 8 ones) or find and use a script that parses the recent nightly build manifests and finds the most recent one. And that's for every tool breakage, which can happen quite often.
Thoughts?