Skip to content

[BUG] Broader Regression: Go-to-Def, Rename, and References broken in macro attribute blocks (Large Workspace) #21721

@xusd320

Description

@xusd320

Description

I am experiencing a severe regression in rust-analyzer where symbol resolution seems to be completely broken for code wrapped in macros like #[turbo_tasks::value_impl].

Affected Features:

  1. Go to Definition: Jumps to the #[turbo_tasks::value_impl] macro attribute instead of the function definition.
  2. Rename Symbol: Fails to rename the symbol correctly (often effectively doing nothing or erroring).
  3. Find References: Returns incomplete or zero results for symbols defined inside the macro block.

Reproduction Attempts (Important)

I have tried multiple times to create a minimal reproduction repository, and bisection debugging, but I was unable to stably reproduce it in a small, isolated environment.

  1. I created a minimal repo with a macro identical to value_impl structure -> Works correctly.
  2. I created a small repo importing the actual turbo-tasks crate -> Works correctly.
  3. The issue only reliably reproduces in the full vercel/next.js repository.

This suggests the issue implies interaction with:

  • The sheer size of the workspace (Next.js is a very large monorepo).
  • Interaction with complex dependency graphs or caching in large projects.

Steps to Reproduce (in Next.js)

Since I cannot minimize it effectively, here is how to reproduce it using the Next.js repo as the test case:

  1. Clone vercel/next.js@6dfcffe
  2. Open the folder in VS Code with rust-analyzer installed.
  3. Open crates/next-api/src/project.rs.
  4. Locate a function call inside a #[turbo_tasks::value_impl] block (e.g., https://github.com/vercel/next.js/blob/6dfcffe1cfb375363674723182b1a5d5c2894ea9/crates/next-api/src/project.rs#L1008).
  5. Try to:
    • Go to Definition on a usage -> Jumps to macro attribute.
    • Rename the function definition -> Fails or behaves inconsistently.
    • Find References -> Returns incorrect results.

Expected Behavior:
All IDE features should resolve to the specific function definition inside the impl block, ignoring the macro wrapper.

Actual Behavior:
IDE features treat the symbols as if they originate from the macro attribute itself, losing the mapping to the inner source code.

Environment & Bisect

  • OS: macOS
  • Known Regression Window:
    • Good: 2025-12-01 (Nightly)
    • Bad: 2025-12-08 (Nightly)

Update: I am currently attempting to git bisect the rust-analyzer repository locally to pinpoint the exact commit. I will update this issue if I find the specific PR, but any pointers on what changed in macro expansion/span mapping during this window would be appreciated.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions