Rust Nightly & rls Package Issues

Particularly with VSCode, you might run into issues with having a working version of rls (stands for Rust Language Server).

You might see this:

# rustup component add rls

error: component 'rls' for target 'x86_64-unknown-linux-gnu' is unavailable for download for channel 'nightly'
Sometimes not all components are available in any given nightly. If you don't need the component, you can remove it with:

    rustup component remove --toolchain nightly --target x86_64-unknown-linux-gnu rls

Basically, nightly doesn't always have a version of rls that is supported.

Explanation From the Devs

It explains the problem on the official rls repo:

The development of rustc's internals is quite fast paced. Downstream projects that rely on nightly internals, particularly clippy, can break fairly often because of this. When such breakages occur the nightly release will be missing rls. [...] rustup will warn if the update is missing any components you currently have. This means you can no longer accidentally update to a no-rls release. Once rls is available again it'll update.

Solution

Check out https://rust-lang.github.io/rustup-components-history/. Choose your rust target in the dropdowns below.

Specifically look at the “Last available” column. That'll be the date that the package was available – the rls row would be the one to pay attention to.

Using that date, replace the letters in this command:

rustup install nightly-20YY-MM-DD # ex: rustup install nightly-2022-04-13

Then switch to that as the default and then install those packages on nightly:

rustup default nightly-20YY-MM-DD
rustup component add rls rust-analysis rust-src

That fixed it for me, so hope that helps!

Now your #![feature(type_ascription)] statements and others should work just fine with IDE debugging support!