rust-lang / rust-lang/rust-analyzer

Flycheck diagnostics should be triggered by changes to the project files that were not triggered by the client

Open
#22,359 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

C-bug
Dominant language
Rust
Stars
16.9k
Forks
2.2k
Avg merge
1d 12h
Merged PRs (30d)
72

Description

Rust Analyzer does not seem to trigger flycheck without user saving (even if the state of the files on disk did change), which leads to stale rustc diagnostics.

rust-analyzer version:

rust-analyzer version: 0.3.2896-standalone (e266f5cab8 2026-05-10) [/Users/hiro/.vscode/extensions/rust-lang.rust-analyzer-0.3.2896-darwin-arm64/server/rust-analyzer]

rustc version: rustc 1.95.0 (59807616e 2026-04-14)

editor or extension: VSC and Zed (I don't believe version is relevant here)

relevant settings: N/A

code snippet to reproduce:
Start with following code in git repo (committed):

fn food() {}
fn main() {
  food();
}

Introduce an error and save (without committing):

fn food() {}
fn main() {
  food(1);
}

Result: 2 diagnostics ✅
Now, run a git restore .:

fn food() {}
fn main() {
  food();
}

Result: 1 outstanding rustc diagnostic ❌
Expected result: No diagnostics

In this scenario, RA does not witness any didSaves after git restore which means that flycheck is never triggered. However, it could trigger it after a brief debounce or what have you.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing how external project-file changes are observed and how those changes trigger flycheck in rust-analyzer. Reproduce the git restore scenario, then verify that restoring the committed Rust source causes the stale rustc diagnostic to disappear without a client save.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.