rust-lang / rls

Repository for the Rust Language Server (aka RLS)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

RLS missing on latest nightly

sophiajt opened this issue · comments

It's in the title. Looks like you can't install rls-preview anymore (or even rls) with the latest nightly.

Duplicate of #611

For those who made it here looking for a workaround, the most recent toolchain I found which still has rls-preview is nightly-2017-12-21.

$ rustup toolchain install nightly-2017-12-21
$ rustup component add rls-preview --toolchain nightly-2017-12-21

Then in your VSCode user settings:

  "rust-client.channel": "nightly-2017-12-21"

It's annoying, so I wrote a simple script to help you find the latest nightly version containing rls-preview, have a try🤪

https://gist.github.com/crazymousethief/5748ab45fa8ac2034e198d023eb336e5

or just do this

sh -c "$(curl -fsSL https://gist.githubusercontent.com/crazymousethief/5748ab45fa8ac2034e198d023eb336e5/raw)"

To ease the pain, one can use @alexheretic's script to see if the new version contains the rls component: rust-lang/rustup#1301 (comment)

@crazymousethief ah, you were faster! 😉
Attaching the script from the linked comment:

#!/usr/bin/env bash
# Update rust nightly as long as rls is included
if curl https://static.rust-lang.org/dist/channel-rust-nightly.toml 2>/dev/null | grep -q 'rls-preview' 
then
  rustup update nightly
else
  echo 'latest nightly is missing rls' >&2
  exit 1
fi

@Xanewok Wow, thanks, I will use it for the next upgrade🎉

seeing same issue with windows. when will the core rustup issue get fixed?

Hopefully the rls and rustfmt will be included in today's nightly, as per rust-lang-nursery/rust-toolstate@ac83be8

rls-preview component should be available in the 2017-12-30 nightly build (https://static.rust-lang.org/dist/channel-rust-nightly.toml)!

You can check the nightly RLS status over at https://rust-lang-nursery.github.io/rust-toolstate/ (thanks @kennytm!).
There's also a state-changing commit next to the tool listed, so if it's currently listed as failing, fetching and using a toolchain from day before will likely be enough.

Closing this as there's no way we can 'fix' the issue instead of somehow always guaranteeing that the tool builds with every commit in Rust CI. The information here should be enough to help users with what to do when the rls component is missing in nightly.

I guess it is not easy to just bundle the last working one, compiled against the old compiler?

Well, that's actually a fair point. I imagine tool can't be broken for more than few days, so possible desync between current nightly compiler and the one rls has last successfully built against won't be much of an issue.
@nrc @kennytm is this something we might consider doing/worth the work?

I don't think it is that easy. When loading, the dynamic linker looks for a specific library. Even if nothing changed, I think it would still count as a different library, but stuff would change (even if it is not API the RLS uses) and that means the RLS executable wouldn't be able to find the ABI it needs.

Closing this as there's no way we can 'fix' the issue instead of somehow always guaranteeing that the tool builds with every commit in Rust CI.

@Xanewok Considering that rls is supposed to become part of the standard set of components managed by rustup, why is this an unreasonable thing to do? But, thank you for making that website! It's nice to have somewhere to look.

I don't think it is that easy. When loading, the dynamic linker looks for a specific library

Well, the older RLS could bundle its copy of the old old library too. I don't know how easy or hard would that be to do and it would make the rls component significantly bigger. Not saying that's worth it, though.

Has it disappeared from Nightly again?

Nope. As linked above, there is a website that shows whether RLS was in the latest nightly or not. I just confirmed locally that RLS is part of the latest nightly, if you follow the instructions to install it.

ok thanks @coder543 looks like i must have uninstalled it, i reinstalled it and its working now

Gone again for rustc 1.30.0-nightly (63d66494a 2018-08-23) and rustc 1.30.0-nightly (d41f21f11 2018-08-24).

To get back into a working state, do the following:
rustup toolchain install nightly-2018-08-19
(I found the previous nightly by counting down from the date of the latest nightly until I found an existing previous nightly. Please holler if you know of a better way involving less trial & error. The only resource I'm aware of is https://static.rust-lang.org/dist/index.html )

List the installed toolchains to find the platform-specific name of the just installed toolchain:
rustup toolchain list
In my case, the correct value would be nightly-2018-08-19-x86_64-apple-darwin.

Set default to that toolchain:
rustup default nightly-2018-08-19-x86_64-apple-darwin

Install RLS for that toolchain:
rustup component add rls-preview rust-analysis rust-src

Leaving this step-by-step instruction here because this issue shows up when you google the problem.

Yep it has disappeared again on linux too, just like the old days. My understanding was that rust releases would be blocked on rls now, so this shouldn't happen. Hopefully this is just a mistake.

Nice to see my atom ide-rust code still handling this case well. But I'm less impressed with rustup update printing a warning that rls is missing then just updating anyway :/.

@huxi I've tried to downgrade nightly and now I'm getting command 'rls.restart' not found. Do you know why that might happen? Thanks!

@Kane-Sendgrid If this is an error in an IDE like VS Code then it might help to restart the IDE. Not aware of this error in particular but had some errors like that in the past after upgrading. Restarting the IDE helped.

@huxi yeah, that comes from IDE (vs code), rls works separately, I guess I'll try to bug plugin team (restart doesn't help).

Thanks!

RLS is present again in today's nightly. Sorry for the disruption.

😐

$ rustup component add rls-preview
error: toolchain 'nightly-x86_64-apple-darwin' does not contain component 'rls-preview' for target 'x86_64-apple-darwin'

$ rustc --version
rustc 1.30.0-nightly (7061b2775 2018-08-28)
commented

I also thought it was supposed to block if components were not available but now this horrible thing happened:

❯ rustup update
info: syncing channel updates for 'nightly-x86_64-apple-darwin'
info: latest update on 2018-08-29, rust version 1.30.0-nightly (7061b2775 2018-08-28)
warning: component 'clippy-preview' is not available anymore on target 'x86_64-apple-darwin'
warning: component 'rls-preview' is not available anymore on target 'x86_64-apple-darwin'

and it continued to remove my old install and 'update' to something that is obviously useless.

Suddenly I get the same error after trying to update the toolchains (everything was up to date though):
toolchain 'nightly-x86_64-apple-darwin' does not contain component 'rls-preview' for target 'x86_64-apple-darwin'

Should be back again today and we're looking into why the update went badly

@nrc Could you please make sure we can make sure we always have rls, clippy and so on included?

commented

Thanks for fixing it so quickly. I think the best case is for rustup to just refuse to do the update if currently added components are not available. This could be overridden by a --force, or even require the user to remove the component first before updating. That way you can be certain an existing working install won't be trashed.

Could you please make sure we can make sure we always have rls, clippy and so on included?

We were doing this, but the tools were breaking so often that we didn't get a nightly for more than a week, so we had to change to issuing nightlies without broken tools.

I think the best case is for rustup to just refuse to do the update if currently added components are not available. This could be overridden by a --force

This is what should happen, but we've had a few teething troubles. Hopefully they are all resolved now.

commented
error: component 'rls-preview' for 'x86_64-apple-darwin' is unavailable for download

error: component 'clippy-preview' for 'x86_64-apple-darwin' is unavailable for download

rustc 1.30.0-nightly (28bcffead 2018-09-01)
info: syncing channel updates for 'stable-x86_64-unknown-linux-gnu'
info: syncing channel updates for 'nightly-x86_64-unknown-linux-gnu'
info: latest update on 2018-09-02, rust version 1.30.0-nightly (28bcffead 2018-09-01)
error: some components unavailable for download: 'rls-preview', 'clippy-preview'

       stable-x86_64-unknown-linux-gnu unchanged - rustc 1.28.0 (9634041f0 2018-07-30)
  nightly-x86_64-unknown-linux-gnu update failed - rustc 1.30.0-nightly (f8d34596f 2018-08-30)

(rustup 1.13.0)

So at least the update aborted this time, which is already better! :)

After a clean install of rustup and the toolchain:

$ rustup toolchain list
nightly-x86_64-unknown-linux-gnu (default)

$ rustup component add rls-preview --toolchain nightly-x86_64-unknown-linux-gnu
error: component 'rls-preview' for 'x86_64-unknown-linux-gnu' is unavailable for download

$ rustc --version
rustc 1.30.0-nightly (28bcffead 2018-09-01)

FYI; the current latest nightly containing RLS seems to be this one for me:

nightly-2018-09-01-x86_64-apple-darwin

There seems to be a new nightly out that fixes this: rust version 1.30.0-nightly (6e0f1cc15 2018-09-05)

Looks like the latest nightly for Mac is missing rls-preview, so I just had to install the one from yesterday:

rustup install nightly-2018-09-22
rustup default nightly-2018-09-22
rustup component add rls-preview rust-analysis rust-src
commented

I'm on 1.32 nightly. How do I get rls working in vscode again?

rustc 1.32.0-nightly (4a45578bc 2018-12-07) - toolchain without rls rustfmt and clippy?
In nightly list of components - rls, rustfmt and clippy not exists.

On these pages, you can see that the last nightly with rls-preview is 2018-12-06:
https://rust-lang-nursery.github.io/rust-toolstate/
https://mexus.github.io/rustup-components-history/

I believe the solution is to install that nightly until there is a more up-to-date nightly with rls-preview working.

Whats the reason rls keeps dropping out from nightly?

Whats the reason rls keeps dropping out from nightly?

Here's how I understand it. 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.

Rust can either not release a nightly when this happens, or release one without clippy & rls. They did follow the former strategy for a while, but now follow the latter to avoid blocking the rust nightly releases for over-long periods for people that don't need clippy/rls.

To mitigate the issues we have:

  • rustup will warn if the update is missing any components you currently have. This means you can no longer accidently update to a no-rls release. Once rls is available again it'll update.
  • rls, clippy are available on the stable channel. Meaning most developers installing for the first time should use stable.
  • However, if you need latest nightly rls you can use https://mexus.github.io/rustup-components-history/ to find and install a dated nightly release ie rustup install nightly-2018-12-06. Or use atom ide-rust which can pick out the latest for you automatically ;)

Thanks @alexheretic great answer

In case there is no nightly with desired components in the latest build list (e.g. now rls has been missing for many days) sometimes even running rustup toolchain install nightly -c ... may not help. In this case you can search through historical builds to find the date of the latest nightly that has your components. Here is the bash script:

#!/bin/bash
commitHash=$(curl https://raw.githubusercontent.com/rust-lang-nursery/rust-toolstate/master/history/linux.tsv 2> /dev/null \
| sed 1d | grep "\"rls\":\"test-pass\"" | grep "\"miri\":\"test-pass\"" \
| grep "\"rustfmt\":\"test-pass\"" | grep "\"rust-by-example\":\"test-pass\"" \
| grep "\"clippy-driver\":\"test-pass\"" | grep "\"reference\":\"test-pass\"" \
| head -n1 | cut -d$'\t' -f1)

commitDate=$(curl -X GET "https://api.github.com/repos/rust-lang/rust/commits/$commitHash" 2> /dev/null \
| python -c "import sys,json; print json.load(sys.stdin)['commit']['author']['date']")

date --date=$commitDate --iso-8601=date

It will return you e.g. date 2019-11-25 then you just have to install it by running:

$ rustup toolchain install nightly-2019-11-25

I had to remove the grep for rustfmt and clippy-driver to get correct results. Those entries disappeared a while ago from the history. After those changes the script does still work nicely, thank you!

#!/bin/bash
commitHash=$(curl https://raw.githubusercontent.com/rust-lang-nursery/rust-toolstate/master/history/linux.tsv 2> /dev/null \
| sed 1d | grep "\"rls\":\"test-pass\"" | grep "\"miri\":\"test-pass\"" \
| grep "\"rust-by-example\":\"test-pass\"" | grep "\"reference\":\"test-pass\"" \
| head -n1 | cut -d$'\t' -f1)

commitDate=$(curl -X GET "https://api.github.com/repos/rust-lang/rust/commits/$commitHash" 2> /dev/null \
| python -c "import sys,json; print json.load(sys.stdin)['commit']['author']['date']")

date --date=$commitDate --iso-8601=date