rust-lang / rust-lang/rust-analyzer

proc macro crate delayed diagnostic with check workspace = false

Open
#23,324 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

rust-analyzer version: rust-analyzer 0.3.3041-standalone

rustc version: rustc 1.98.1 (48a229cea 2026-09-01)

editor or extension: neovim, rustaceanvim

relevant settings:

                      ['rust-analyzer'] = {
                         check = {
                             workspace = false,
                             command = "clippy"
                         },
                      },

repository link (if public, optional): N/A

code snippet to reproduce:

  1. proc macro crate
  2. check.workspace = false

It's a sizeable derive macro. I make a change, say replace todo!() -> tod!() and save the file. In theory it should update the errors immediately, but to actually see the new error I need to save it the second time.

I don't think contents of the macro itself matter, more about the size. Somewhat works with this:

#![allow(dead_code)]

//! doc

use proc_macro::TokenStream;

#[proc_macro_derive(Thing)]
pub fn thing(_input: TokenStream) -> TokenStream {
    "let _ = 42;".parse().unwrap()
}

fn dead0() {}
struct S0;
fn dead1() {}
struct S1;
// 30 of each. Maybe more better?

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

Reproduce the issue in a sizeable Rust proc-macro workspace using rust-analyzer with check.workspace = false and check.command = "clippy". Compare diagnostics after the first and second save, then trace proc-macro checking and diagnostic update scheduling. Done means replacing or introducing an error in the macro updates diagnostics after one 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
Active
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.