Shims should give help message for how to add components
Problem you are trying to solve
If you try to run a shim from a toolchain that does not have that component, it's not immediatly obvious what the solution is to solve the Unknown binary error.
Solution you'd like
If the toolchain was added via rustup toolchain link, suggest building the component with x.py (oddly, this is the one that is already implemented)
If the toolchain was requested through +TOOLCHAIN or RUSTUP_TOOLCHAIN, emit a help message recommending rustup component add --toolchain TOOLCHAIN COMPONENT.
If the toolchain was the default toolchain, recommend rustup component add COMPONENT (could be merged with previous case for simplicity of implementation)
If the toolchain was from rust-toolchain or rust-toolchain.toml, recommend modifying the file or adding a dir override then adding the component to that toolchain.
Notes
The fact that this is handled for linked toolchains suggests it should probably be handled for other cases too.
The linked toolchain case needs to be checked first because it should always take priority.
Thanks for the report!
However this is weird to me since I believe we already have tests for that two cases you have mentioned:
https://github.com/rust-lang/rustup/blob/96bd8f2d0efa6d90f56beebc005729ab9909fac3/tests/suite/cli_misc.rs#L696-L734
... would you mind providing a minimal reproduction or at least some pointers so that we can figure out why that wasn't working for you?
I'm on 1.28.2, and I'm doing this with rust-analyzer +beta.
does the lint only show up on the default toolchain?
does the lint only show up on the default toolchain?
No, as seen in the second test case.
I'm on 1.28.2, and I'm doing this with
rust-analyzer +beta.
rust-analyzer is a bit particular because it is a DUP_TOOL meaning you can have a local installation that shadows our shim. What does which rust-analyzer say?
PS: Please note that this behavior will change soon with https://github.com/rust-lang/rustup/pull/4324 if you are indeed using our shim.