Stream: t-compiler/rust-analyzer

Topic: Nightlies stopped?


Kirill Bulatov (Sep 28 2020 at 10:25, on Zulip):

I think we did not have any nightly release in a couple of days or so, the latest version I have is rust-analyzer version: nightly (277488b) and it does not propose to upgrade.

Is this the release action?
https://github.com/rust-analyzer/rust-analyzer/actions/runs/275766826

matklad (Sep 28 2020 at 10:28, on Zulip):

Yeah, the latest chalk upgrade didn't went well

Kirill Bulatov (Jan 13 2021 at 08:30, on Zulip):

I have no nightly updates for me again, does anybody experience the same?

I have the "nightly" channel set in the settings, but no updates happen when I open any of the Rust projects: I have to manually reinstall the extension to trigger an update.
And even after the reinstall, no automatic updates happen next day.

Kirill Bulatov (Jan 13 2021 at 08:41, on Zulip):
INFO [1/13/2021, 10:35:48 AM]: Extension version: 0.2.449
INFO [1/13/2021, 10:35:48 AM]: Using configuration {
  // ...snip...
  updates: { channel: 'nightly', askBeforeDownload: false },
  server: { path: null, extraEnv: null },
  trace: { server: 'messages', extension: true },
  // ...snip...
INFO [1/13/2021, 10:35:48 AM]: PersistentState: {
  lastCheck: 1610280485770,
  releaseId: 36187327,
  serverVersion: '0.2.449'
}
INFO [1/13/2021, 10:35:48 AM]: Using server binary at /Users/someonetoignore/Library/Application Support/Code/User/globalStorage/matklad.rust-analyzer/rust-analyzer-x86_64-apple-darwin
DEBUG [1/13/2021, 10:35:48 AM]: Checking availability of a binary at /Users/someonetoignore/Library/Application Support/Code/User/globalStorage/matklad.rust-analyzer/rust-analyzer-x86_64-apple-darwin
DEBUG [1/13/2021, 10:35:48 AM]: /Users/someonetoignore/Library/Application Support/Code/User/globalStorage/matklad.rust-analyzer/rust-analyzer-x86_64-apple-darwin --version: {
  status: 0,
  signal: null,
  output: [ null, 'rust-analyzer 60c501f\n', '' ],
  pid: 99709,
  stdout: 'rust-analyzer 60c501f\n',
  stderr: ''
}

Here's the client logs I've got, looks like I have the latest VSCode extension version (0.2.449, released 1 day ago) + "nightly channel" + 60c501 server version (which is from 2021-01-11) and RA seems to ignore the fact that there're newer server versions available?

bjorn3 (Jan 13 2021 at 08:45, on Zulip):

The rust-analyzer extension needs to be updated first. There is a 1 to 1 match between the vscode extension and rust-analyzer server version. I believe it should update itself on the nightly channel. I don't know why it doesn't for you though.

Kirill Bulatov (Jan 13 2021 at 08:51, on Zulip):

Seems like it and I'm pretty lost at this point: there are no settings for the extension itself to update, aren't they?

Kirill Bulatov (Jan 13 2021 at 08:54, on Zulip):

Can that be that the tags are messed up?

I see "2 days ago" for the recent nightly on https://github.com/rust-analyzer/rust-analyzer/tags

image.png

and when I open that nightly version https://github.com/rust-analyzer/rust-analyzer/releases/tag/nightly

I see "7 hours ago"

image.png

Laurențiu (Jan 13 2021 at 08:57, on Zulip):

The SHA on the tag seems fine

Kirill Bulatov (Jan 13 2021 at 08:59, on Zulip):

https://github.com/rust-analyzer/rust-analyzer/commits/master

Oh, it turns out we did not commit for 2 days in master?
That's unusual for our repo, but seems to explain the situation perfectly :grinning:

For some reason, I was sure I've seen some PRs merged after 11th.

Kirill Bulatov (Jan 14 2021 at 10:31, on Zulip):

I still have the old version and it does not update itself despite new commits had been addded yesterday.

This is exactly what I've meant under "lack of stability and ways to diagnose the issue" in the neighbour thread: I'm pretty much clueless now and worse, if I haven't paid attention, I would have used the old version still.
I wonder how many users are out there stuck with ancient RA without knowing it.

I'll reinstall it once more and see if it updates tomorrow and come back again, if it's not.

Lukas Wirth (Jan 14 2021 at 13:43, on Zulip):

I think I found the problem,
https://github.com/rust-analyzer/rust-analyzer/blob/022d031b7fe9266ad3dd320c729989e8bf495b67/editors/code/src/config.ts#L92-L94

    private get<T>(path: string): T {
        return this.cfg.get<T>(path)!;
    }

here we erase null and undefined from the type via !, but then we read a null | string from it in

    get serverPath() {
        return this.get<null | string>("server.path") ?? this.get<null | string>("serverPath");
    }

https://github.com/rust-analyzer/rust-analyzer/blob/022d031b7fe9266ad3dd320c729989e8bf495b67/editors/code/src/config.ts#L96-L98
which is wrong because the cfg.get call in our get function only returns the value or undefined.
Docs from that function:

        /**
         * Return a value from this configuration.
         *
         * @param section Configuration name, supports _dotted_ names.
         * @return The value `section` denotes or `undefined`.
         */
        get<T>(section: string): T | undefined;
Lukas Wirth (Jan 14 2021 at 13:44, on Zulip):

So thats why we get the unexpected undefined in https://github.com/rust-analyzer/rust-analyzer/pull/7194#discussion_r557372912 I think

Lukas Wirth (Jan 14 2021 at 13:44, on Zulip):

@Kirill Bulatov

Kirill Bulatov (Jan 14 2021 at 13:51, on Zulip):

I blame ?? for that.
Another great footgun learned, thanks for looking into that.

And thanks Laurențiu for fixing that one.

Laurențiu (Jan 14 2021 at 13:54, on Zulip):

Sigh, sorry for breaking it :-(

Laurențiu (Jan 14 2021 at 13:54, on Zulip):

Can you test the fix?

Kirill Bulatov (Jan 14 2021 at 13:56, on Zulip):

No worries, you don't make mistakes only if you don't do anything and it's TS anyway.

I cannot truly test it before the next stable release, but can debug the code itself a bit later, sure.

Kirill Bulatov (Jan 14 2021 at 14:13, on Zulip):

Works like a charm now, thanks @Laurențiu Nicola

Lukas Wirth (Jan 14 2021 at 14:18, on Zulip):

I blame ! for that to be fair, erasing undefined and null without checks seems awful, its basically unwrap but without the panic :big_smile:

Laurențiu (Jan 14 2021 at 14:20, on Zulip):

!= would have been fine, but I wanted to get fancy

Kirill Bulatov (Jan 18 2021 at 15:03, on Zulip):

Just rechecked with the new release and had got a regular nightly update, so now it's officially fixed :tada:

Last update: Jul 27 2021 at 20:15UTC