rust-lang / rust-lang/rust-analyzer

Rust Analyzer server poisoning with macro editing

Open
#22,553 11 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

I observe an error proc-macro panicked: rstest is present in Cargo.toml qed: Invalid toml file. rust-analyzer (macro-error) with conditions below:

I have multiple test modules which heavily using rstest and tokio::test. It's happening in any module within any function either it sync or async, either it contain no cases (just rstest used) or thousands (per single test function).

At the moment, when I open such module, I see [rstest] marked in red with message in subject and text below as details.

When I put cursor at the end of this lines and hit space once, this test become shown as resolved and I see types and colors.

cargo build --tests, cargo nextest list/run working fine.

Problem is not persistent, starts after few hours of work and "self-resolves" with a RA full restart. Around a month back I have no such issue at all. Few opened projects help to reproduce an issue. My code base is only 146 files and overall test count is only about 5000. I run tests and cargo often from CLI, and never from UI.

rstest_macros
proc_macro rstest

rust-analyzer version: (eg. output of "rust-analyzer: Show RA Version" command, accessible in VSCode via Ctrl/⌘+Shift+P) rust-analyzer version: 0.3.2896-standalone (e266f5cab8 2026-05-10)

rustc version: (eg. output of rustc -V): rustc 1.94.1 (e408947bf 2026-03-25)

editor or extension: (eg. VSCode, Vim, Emacs, etc. For VSCode users, specify your extension version; for users of other editors, provide the distribution if applicable) VSCodium Wersja: 1.121.03429

relevant settings: (eg. client settings, or environment variables like CARGO, RUSTC, RUSTUP_HOME or CARGO_HOME)

repository link (if public, optional): (eg. rust-analyzer) Repository is not public at the moment.

code snippet to reproduce:

// add your code here
use rstest::rstest;

#[rstest]
fn test() {}

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 with the minimal Rust snippet using rstest and tokio::test, then observe rust-analyzer's proc-macro diagnostic after extended work and multiple opened projects. Compare the red [rstest] error with editing the line, restarting rust-analyzer, and running cargo build --tests or cargo nextest. Done means the stale macro error no longer requires a full server restart.

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
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.