Skip to content

Errors flash and disappear (RA crash) after 0.3.2220 version with "Server process exited with code 0" #18781

Closed
@tgrushka

Description

@tgrushka

I've been using nightly and have noticed this for the past week or so.
Unfortunately, it also occurs in 0.3.2228 release version onwards.

This is a serious regression in nightly and release 0.3.2228 and it's important to fix it before the next release.

When I downgrade to 0.3.2220, the problem goes away.

uname -a
Linux framework-mint 6.8.0-51-generic #52-Ubuntu SMP PREEMPT_DYNAMIC Thu Dec  5 13:09:44 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux

code-insiders --version
1.97.0-insider
89f808979a5151bd91324e65d4f7ab1b62896983
x64

Whenever working in code in any #[cfg(test)] blocks (and sometimes outside those blocks), rust-analyzer seems to crash 90% of the time when there's an error in my code that's not "very simple" (i.e. let x: i32 = 3.5;). There are no useful logs. The only output for "Rust Analyzer Language Server" is like this:

[Error - 4:14:38 PM] Server process exited with code 0.

EDIT: Also occurred with fresh install of VS Code Insiders with no other extensions/settings except rust-analyzer.

Screen recording (I am hitting Control-S several times to save; analyzer runs, displays the error for a frame or two, then disappears):
Image

Sample Rust code (this is only an example, it's not only this particular error):
(This is in a #[cfg(test)] module.)

impl TestResponse {
...
    pub async fn print(&mut self) {
        let response = self.response;
        todo!()
    }
...
}
cargo check --tests
...
error[E0507]: cannot move out of `self.response` which is behind a mutable reference
  --> api/src/test_helpers/test_response.rs:35:24
   |
35 |         let response = self.response;
   |                        ^^^^^^^^^^^^^ move occurs because `self.response` has type `Response<Body>`, which does not implement the `Copy` trait
...

Here's "Rust Analyzer Language Server Trace" output with rust-analyzer.trace.server: "messages" after Clear, Save, and error flashes briefly (a couple frames) and disappears:

[Trace - 4:21:34 PM] Sending request 'textDocument/formatting - (139)'. [Trace - 4:21:34 PM] Received response 'textDocument/formatting - (139)' in 39ms. [Trace - 4:21:34 PM] Sending notification 'textDocument/didSave'. [Trace - 4:21:34 PM] Received request 'window/workDoneProgress/create - (40)'. [Trace - 4:21:34 PM] Sending response 'window/workDoneProgress/create - (40)'. Processing request took 0ms [Trace - 4:21:34 PM] Received notification '$/progress'. [Trace - 4:21:34 PM] Sending notification 'workspace/didChangeWatchedFiles'. [Trace - 4:21:34 PM] Received notification '$/progress'. [Trace - 4:21:34 PM] Received notification 'textDocument/publishDiagnostics'. [Trace - 4:21:34 PM] Received notification '$/progress'. [Trace - 4:21:34 PM] Received notification '$/progress'. [Trace - 4:21:34 PM] Received notification '$/progress'. [Trace - 4:21:35 PM] Received notification '$/progress'. [Trace - 4:21:35 PM] Received notification 'textDocument/publishDiagnostics'. [Trace - 4:21:35 PM] Sending request 'textDocument/codeAction - (140)'. [Trace - 4:21:35 PM] Received response 'textDocument/codeAction - (140)' in 1ms. [Trace - 4:21:35 PM] Sending request 'textDocument/codeLens - (141)'. [Trace - 4:21:35 PM] Received response 'textDocument/codeLens - (141)' in 2ms.

Here's "Rust Analyzer Language Server Trace" output with rust-analyzer.trace.server: "verbose" after Clear, Save, and error flashes briefly (a couple frames) and disappears:

[Trace - 4:24:42 PM] Sending request 'textDocument/formatting - (162)'. Params: { "textDocument": { "uri": "file:///home/tom/apps/a11y.doctor/api/src/test_helpers/test_response.rs" }, "options": { "tabSize": 4, "insertSpaces": true, "trimTrailingWhitespace": true, "insertFinalNewline": true } }

[Trace - 4:24:42 PM] Received response 'textDocument/formatting - (162)' in 66ms.
No result returned.

[Trace - 4:24:42 PM] Sending notification 'textDocument/didSave'.
Params: {
"textDocument": {
"uri": "file:///home/tom/apps/a11y.doctor/api/src/test_helpers/test_response.rs"
}
}

[Trace - 4:24:42 PM] Received request 'window/workDoneProgress/create - (45)'.
Params: {
"token": "rust-analyzer/flycheck/0"
}

[Trace - 4:24:42 PM] Sending response 'window/workDoneProgress/create - (45)'. Processing request took 0ms
No result returned.

[Trace - 4:24:42 PM] Received notification '$/progress'.
Params: {
"token": "rust-analyzer/flycheck/0",
"value": {
"kind": "begin",
"title": "cargo check",
"cancellable": true
}
}

[Trace - 4:24:42 PM] Sending notification 'workspace/didChangeWatchedFiles'.
Params: {
"changes": [
{
"uri": "file:///home/tom/apps/a11y.doctor/api/src/test_helpers/test_response.rs",
"type": 2
},
{
"uri": "file:///home/tom/apps/a11y.doctor/api/src/test_helpers/test_response.rs",
"type": 2
}
]
}

[Trace - 4:24:42 PM] Received notification '$/progress'.
Params: {
"token": "rust-analyzer/flycheck/0",
"value": {
"kind": "report",
"cancellable": true,
"message": "api"
}
}

[Trace - 4:24:42 PM] Received notification 'textDocument/publishDiagnostics'.
Params: {
"uri": "file:///home/tom/apps/a11y.doctor/api/src/test_helpers/test_response.rs",
"diagnostics": [
{
"range": {
"start": {
"line": 34,
"character": 23
},
"end": {
"line": 34,
"character": 36
}
},
"severity": 1,
"code": "E0507",
"codeDescription": {
"href": "https://doc.rust-lang.org/error-index.html#E0507"
},
"source": "rustc",
"message": "cannot move out of self.response which is behind a mutable reference\nmove occurs because self.response has type Response<Body>, which does not implement the Copy trait",
"relatedInformation": [
{
"location": {
"uri": "file:///home/tom/apps/a11y.doctor/api/src/test_helpers/test_response.rs",
"range": {
"start": {
"line": 34,
"character": 23
},
"end": {
"line": 34,
"character": 23
}
}
},
"message": "consider borrowing here: &"
}
],
"data": {
"rendered": "\u001b[0m\u001b[1m\u001b[38;5;9merror[E0507]\u001b[0m\u001b[0m\u001b[1m: cannot move out of self.response which is behind a mutable reference\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m--> \u001b[0m\u001b[0mapi/src/test_helpers/test_response.rs:35:24\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\n\u001b[0m\u001b[1m\u001b[38;5;12m35\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\u001b[0m \u001b[0m\u001b[0m let response = self.response;\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;9m^^^^^^^^^^^^^\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;9mmove occurs because self.response has type Response<Body>, which does not implement the Copy trait\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\n\u001b[0m\u001b[1m\u001b[38;5;14mhelp\u001b[0m\u001b[0m: consider borrowing here\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\n\u001b[0m\u001b[1m\u001b[38;5;12m35\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m| \u001b[0m\u001b[0m let response = \u001b[0m\u001b[0m\u001b[38;5;10m&\u001b[0m\u001b[0mself.response;\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[38;5;10m+\u001b[0m\n\n"
}
},
{
"range": {
"start": {
"line": 34,
"character": 23
},
"end": {
"line": 34,
"character": 23
}
},
"severity": 4,
"code": "E0507",
"codeDescription": {
"href": "https://doc.rust-lang.org/error-index.html#E0507"
},
"source": "rustc",
"message": "consider borrowing here: &",
"relatedInformation": [
{
"location": {
"uri": "file:///home/tom/apps/a11y.doctor/api/src/test_helpers/test_response.rs",
"range": {
"start": {
"line": 34,
"character": 23
},
"end": {
"line": 34,
"character": 36
}
}
},
"message": "original diagnostic"
}
]
}
],
"version": 282
}

[Trace - 4:24:42 PM] Received notification '$/progress'.
Params: {
"token": "rust-analyzer/flycheck/0",
"value": {
"kind": "report",
"cancellable": true,
"message": "quick_dev"
}
}

[Trace - 4:24:42 PM] Received notification '$/progress'.
Params: {
"token": "rust-analyzer/flycheck/0",
"value": {
"kind": "report",
"cancellable": true,
"message": "api"
}
}

[Trace - 4:24:42 PM] Received notification '$/progress'.
Params: {
"token": "rust-analyzer/flycheck/0",
"value": {
"kind": "report",
"cancellable": true,
"message": "api"
}
}

[Trace - 4:24:42 PM] Received notification '$/progress'.
Params: {
"token": "rust-analyzer/flycheck/0",
"value": {
"kind": "end"
}
}

[Trace - 4:24:42 PM] Received notification 'textDocument/publishDiagnostics'.
Params: {
"uri": "file:///home/tom/apps/a11y.doctor/api/src/test_helpers/test_response.rs",
"diagnostics": [],
"version": 282
}

[Trace - 4:24:43 PM] Sending request 'textDocument/codeAction - (163)'.
Params: {
"textDocument": {
"uri": "file:///home/tom/apps/a11y.doctor/api/src/test_helpers/test_response.rs"
},
"range": {
"start": {
"line": 36,
"character": 5
},
"end": {
"line": 36,
"character": 5
}
},
"context": {
"diagnostics": [],
"triggerKind": 2
}
}

[Trace - 4:24:43 PM] Received response 'textDocument/codeAction - (163)' in 2ms.
Result: []

[Trace - 4:24:43 PM] Sending request 'textDocument/codeLens - (164)'.
Params: {
"textDocument": {
"uri": "file:///home/tom/apps/a11y.doctor/api/src/test_helpers/test_response.rs"
}
}

[Trace - 4:24:43 PM] Received response 'textDocument/codeLens - (164)' in 1ms.
Result: [
{
"range": {
"start": {
"line": 7,
"character": 11
},
"end": {
"line": 7,
"character": 23
}
},
"data": {
"version": 282,
"kind": {
"impls": {
"textDocument": {
"uri": "file:///home/tom/apps/a11y.doctor/api/src/test_helpers/test_response.rs"
},
"position": {
"line": 7,
"character": 11
}
}
}
}
}
]

[Trace - 4:24:45 PM] Sending request 'textDocument/diagnostic - (165)'.
Params: {
"textDocument": {
"uri": "file:///home/tom/apps/a11y.doctor/api/src/routes/jobs/checkout_job.rs"
},
"previousResultId": "rust-analyzer"
}

[Trace - 4:24:45 PM] Received response 'textDocument/diagnostic - (165)' in 2ms.
Result: {
"kind": "full",
"resultId": "rust-analyzer",
"items": []
}

[Trace - 4:24:45 PM] Sending request 'textDocument/diagnostic - (166)'.
Params: {
"textDocument": {
"uri": "file:///home/tom/apps/a11y.doctor/api/src/test_helpers/test_response.rs"
},
"previousResultId": "rust-analyzer"
}

[Trace - 4:24:45 PM] Received response 'textDocument/diagnostic - (166)' in 1ms.
Result: {
"kind": "full",
"resultId": "rust-analyzer",
"items": []
}

[Trace - 4:24:45 PM] Sending request 'textDocument/codeLens - (167)'.
Params: {
"textDocument": {
"uri": "file:///home/tom/apps/a11y.doctor/api/src/test_helpers/test_response.rs"
}
}

[Trace - 4:24:45 PM] Received response 'textDocument/codeLens - (167)' in 1ms.
Result: [
{
"range": {
"start": {
"line": 7,
"character": 11
},
"end": {
"line": 7,
"character": 23
}
},
"data": {
"version": 282,
"kind": {
"impls": {
"textDocument": {
"uri": "file:///home/tom/apps/a11y.doctor/api/src/test_helpers/test_response.rs"
},
"position": {
"line": 7,
"character": 11
}
}
}
}
}
]

Metadata

Metadata

Assignees

No one assigned

    Labels

    Broken WindowBugs / technical debt to be addressed immediately

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions