Info
This post is auto-generated from RSS feed The Rust Programming Language Forum - Latest topics. Source: VSCode rust-analyzer lints/errors disappear after a split second
VSCode rust-analyzer lints/errors disappear after a split second
โ Rust ๐ 2025-08-11 ๐ค surdeus ๐๏ธ 4After adding the image
crate to a project and writing a few lines of code with it to save a &[u8]
to disk, any and all errors/lints/warnings from the rust-analyzer vscode extension (at least those that only appear after saving a file) started to disappear some split second after saving. I have updated my rust toolchain, uninstalled and reinstalled the rust-analyzer extension, and tested it in other projects but the issue persists.
Even if I create a brand new project with cargo new [...]
, and for instance enter this very incorrect code into main.rs
fn main() -> foobar {
println!("Hello, world!");
dasdjdisjasdopjadospjdops;
adsiasdoiadsni + iodsous9uad9u
}
the issue persists. If I restart the language server with >rust-analyzer: Restart server
or reload the vscode window, the errors will appear and stay, until I save again. The same thing applies if I hit the little > Run
button that the extension displays above the main function.
This issue seems related to Lints disappear a few seconds after having pressed Ctrl+S ยท Issue #8257 ยท rust-lang/rust-analyzer ยท GitHub, but it is still open and no solution was found.
When enabling LSP logs with > rust-analyzer: Toggle LSP logs
I get the following output when saving a file
[Trace - 13:51:14] Sending request 'textDocument/formatting - (39)'.
Params: {
"textDocument": {
"uri": "file:///Users/[redacted]/Dev/misc/bugbugbug/src/main.rs"
},
"options": {
"tabSize": 4,
"insertSpaces": true
}
}
[Trace - 13:51:14] Received response 'textDocument/formatting - (39)' in 69ms.
No result returned.
[Trace - 13:51:14] Sending notification 'textDocument/didSave'.
Params: {
"textDocument": {
"uri": "file:///Users/[redacted]/Dev/misc/bugbugbug/src/main.rs"
}
}
[Trace - 13:51:14] Received request 'window/workDoneProgress/create - (41)'.
Params: {
"token": "rust-analyzer/flycheck/0"
}
[Trace - 13:51:14] Sending response 'window/workDoneProgress/create - (41)'. Processing request took 0ms
No result returned.
[Trace - 13:51:14] Received notification '$/progress'.
Params: {
"token": "rust-analyzer/flycheck/0",
"value": {
"kind": "begin",
"title": "cargo check",
"cancellable": true
}
}
[Trace - 13:51:14] Received notification 'textDocument/publishDiagnostics'.
Params: {
"uri": "file:///Users/[redacted]/Dev/misc/bugbugbug/src/main.rs",
"diagnostics": [
{
"range": {
"start": {
"line": 0,
"character": 13
},
"end": {
"line": 0,
"character": 19
}
},
"severity": 1,
"code": "E0412",
"codeDescription": {
"href": "https://doc.rust-lang.org/error-index.html#E0412"
},
"source": "rustc",
"message": "cannot find type `foobar` in this scope\nnot found in this scope",
"data": {
"rendered": "\u001b[0m\u001b[1m\u001b[38;5;9merror[E0412]\u001b[0m\u001b[0m\u001b[1m: cannot find type `foobar` in this scope\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m--> \u001b[0m\u001b[0msrc/main.rs:1:14\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;12m1\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\u001b[0m \u001b[0m\u001b[0mfn main() -> foobar {\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;9mnot found in this scope\u001b[0m\n\n"
}
}
],
"version": 1
}
[Trace - 13:51:14] Received notification 'textDocument/publishDiagnostics'.
Params: {
"uri": "file:///Users/[redacted]/Dev/misc/bugbugbug/src/main.rs",
"diagnostics": [
{
"range": {
"start": {
"line": 0,
"character": 13
},
"end": {
"line": 0,
"character": 19
}
},
"severity": 1,
"code": "E0412",
"codeDescription": {
"href": "https://doc.rust-lang.org/error-index.html#E0412"
},
"source": "rustc",
"message": "cannot find type `foobar` in this scope\nnot found in this scope",
"data": {
"rendered": "\u001b[0m\u001b[1m\u001b[38;5;9merror[E0412]\u001b[0m\u001b[0m\u001b[1m: cannot find type `foobar` in this scope\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m--> \u001b[0m\u001b[0msrc/main.rs:1:14\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;12m1\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\u001b[0m \u001b[0m\u001b[0mfn main() -> foobar {\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;9mnot found in this scope\u001b[0m\n\n"
}
},
{
"range": {
"start": {
"line": 2,
"character": 4
},
"end": {
"line": 2,
"character": 29
}
},
"severity": 1,
"code": "E0425",
"codeDescription": {
"href": "https://doc.rust-lang.org/error-index.html#E0425"
},
"source": "rustc",
"message": "cannot find value `dasdjdisjasdopjadospjdops` in this scope\nnot found in this scope",
"data": {
"rendered": "\u001b[0m\u001b[1m\u001b[38;5;9merror[E0425]\u001b[0m\u001b[0m\u001b[1m: cannot find value `dasdjdisjasdopjadospjdops` in this scope\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m--> \u001b[0m\u001b[0msrc/main.rs:3:5\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;12m3\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\u001b[0m \u001b[0m\u001b[0m dasdjdisjasdopjadospjdops;\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;9mnot found in this scope\u001b[0m\n\n"
}
},
{
"range": {
"start": {
"line": 3,
"character": 4
},
"end": {
"line": 3,
"character": 18
}
},
"severity": 1,
"code": "E0425",
"codeDescription": {
"href": "https://doc.rust-lang.org/error-index.html#E0425"
},
"source": "rustc",
"message": "cannot find value `adsiasdoiadsni` in this scope\nnot found in this scope",
"data": {
"rendered": "\u001b[0m\u001b[1m\u001b[38;5;9merror[E0425]\u001b[0m\u001b[0m\u001b[1m: cannot find value `adsiasdoiadsni` in this scope\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m--> \u001b[0m\u001b[0msrc/main.rs:4:5\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;12m4\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\u001b[0m \u001b[0m\u001b[0m adsiasdoiadsni + iodsous9uad9u\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;9mnot found in this scope\u001b[0m\n\n"
}
},
{
"range": {
"start": {
"line": 3,
"character": 21
},
"end": {
"line": 3,
"character": 34
}
},
"severity": 1,
"code": "E0425",
"codeDescription": {
"href": "https://doc.rust-lang.org/error-index.html#E0425"
},
"source": "rustc",
"message": "cannot find value `iodsous9uad9u` in this scope\nnot found in this scope",
"data": {
"rendered": "\u001b[0m\u001b[1m\u001b[38;5;9merror[E0425]\u001b[0m\u001b[0m\u001b[1m: cannot find value `iodsous9uad9u` in this scope\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m--> \u001b[0m\u001b[0msrc/main.rs:4:22\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;12m4\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\u001b[0m \u001b[0m\u001b[0m adsiasdoiadsni + iodsous9uad9u\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;9mnot found in this scope\u001b[0m\n\n"
}
}
],
"version": 1
}
[Trace - 13:51:14] Received notification 'textDocument/publishDiagnostics'.
Params: {
"uri": "file:///Users/[redacted]/Dev/misc/bugbugbug/src/main.rs",
"diagnostics": [
{
"range": {
"start": {
"line": 0,
"character": 13
},
"end": {
"line": 0,
"character": 19
}
},
"severity": 1,
"code": "E0412",
"codeDescription": {
"href": "https://doc.rust-lang.org/error-index.html#E0412"
},
"source": "rustc",
"message": "cannot find type `foobar` in this scope\nnot found in this scope",
"data": {
"rendered": "\u001b[0m\u001b[1m\u001b[38;5;9merror[E0412]\u001b[0m\u001b[0m\u001b[1m: cannot find type `foobar` in this scope\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m--> \u001b[0m\u001b[0msrc/main.rs:1:14\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;12m1\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\u001b[0m \u001b[0m\u001b[0mfn main() -> foobar {\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;9mnot found in this scope\u001b[0m\n\n"
}
},
{
"range": {
"start": {
"line": 2,
"character": 4
},
"end": {
"line": 2,
"character": 29
}
},
"severity": 1,
"code": "E0425",
"codeDescription": {
"href": "https://doc.rust-lang.org/error-index.html#E0425"
},
"source": "rustc",
"message": "cannot find value `dasdjdisjasdopjadospjdops` in this scope\nnot found in this scope",
"data": {
"rendered": "\u001b[0m\u001b[1m\u001b[38;5;9merror[E0425]\u001b[0m\u001b[0m\u001b[1m: cannot find value `dasdjdisjasdopjadospjdops` in this scope\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m--> \u001b[0m\u001b[0msrc/main.rs:3:5\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;12m3\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\u001b[0m \u001b[0m\u001b[0m dasdjdisjasdopjadospjdops;\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;9mnot found in this scope\u001b[0m\n\n"
}
},
{
"range": {
"start": {
"line": 3,
"character": 4
},
"end": {
"line": 3,
"character": 18
}
},
"severity": 1,
"code": "E0425",
"codeDescription": {
"href": "https://doc.rust-lang.org/error-index.html#E0425"
},
"source": "rustc",
"message": "cannot find value `adsiasdoiadsni` in this scope\nnot found in this scope",
"data": {
"rendered": "\u001b[0m\u001b[1m\u001b[38;5;9merror[E0425]\u001b[0m\u001b[0m\u001b[1m: cannot find value `adsiasdoiadsni` in this scope\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m--> \u001b[0m\u001b[0msrc/main.rs:4:5\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;12m4\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\u001b[0m \u001b[0m\u001b[0m adsiasdoiadsni + iodsous9uad9u\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;9mnot found in this scope\u001b[0m\n\n"
}
}
],
"version": 1
}
[Trace - 13:51:14] Received notification '$/progress'.
Params: {
"token": "rust-analyzer/flycheck/0",
"value": {
"kind": "end"
}
}
[Trace - 13:51:14] Received notification 'textDocument/publishDiagnostics'.
Params: {
"uri": "file:///Users/[redacted]/Dev/misc/bugbugbug/src/main.rs",
"diagnostics": [],
"version": 1
}
[Trace - 13:51:15] Sending request 'textDocument/codeAction - (40)'.
Params: {
"textDocument": {
"uri": "file:///Users/[redacted]/Dev/misc/bugbugbug/src/main.rs"
},
"range": {
"start": {
"line": 3,
"character": 34
},
"end": {
"line": 3,
"character": 34
}
},
"context": {
"diagnostics": [],
"triggerKind": 2
}
}
[Trace - 13:51:15] Received response 'textDocument/codeAction - (40)' in 3ms.
Result: []
[Trace - 13:51:15] Sending notification 'workspace/didChangeWatchedFiles'.
Params: {
"changes": [
{
"uri": "file:///Users/[redacted]/Dev/misc/bugbugbug/src/main.rs",
"type": 2
},
{
"uri": "file:///Users/[redacted]/Dev/misc/bugbugbug/src/main.rs",
"type": 2
}
]
}
[Trace - 13:51:18] Sending request 'textDocument/diagnostic - (41)'.
Params: {
"identifier": "rust-analyzer",
"textDocument": {
"uri": "file:///Users/[redacted]/Dev/misc/bugbugbug/src/main.rs"
},
"previousResultId": "rust-analyzer"
}
[Trace - 13:51:18] Received response 'textDocument/diagnostic - (41)' in 15ms.
Result: {
"kind": "full",
"resultId": "rust-analyzer",
"items": []
}
It seems as if the errors are indeed being received in Received notification 'textDocument/publishDiagnostics'
but then being overridden by an empty array in a subsequent message, although this is pure speculation.
I have no idea why this would suddenly become an issue, though I had set my default toolchain to nightly at the time to test out some things, which could maybe have screwed something up in a cache somewhere (?). I have since switched back to stable, and I have tried to search for any caches to purge and have rm -rf
ed ~/.cargo/registry/
but nothing has come of it.
I will also add that in a fresh project the lints flash on screen so quickly that I have to save 2-5 times to even see a glimpse of them.
1 post - 1 participant
๐ท๏ธ Rust_feed