Skip to content

proc macro crate delayed diagnostic with check workspace = false #23324

Open

Description

@pacak

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?

Activity

  1. ChayimFriedman2 commented on Sep 8, 2026

    @ChayimFriedman2
    Contributor

    The macro needs to be built. In theory rust-analyzer never intended to do that automatically, but check-on-save does that as a side effect (then another edit will refresh). In practice it used to work, not sure why, and I have also noticed it started to fail recently.

  2. pacak commented on Sep 11, 2026

    @pacak
    Author

    Not sure. Somehow it is related to not checking the whole workspace. When I set it back to true - it stops failing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions