-
Notifications
You must be signed in to change notification settings - Fork 2k
Description
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:
- Go to Definition: Jumps to the
#[turbo_tasks::value_impl]macro attribute instead of the function definition. - Rename Symbol: Fails to rename the symbol correctly (often effectively doing nothing or erroring).
- 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.
- I created a minimal repo with a macro identical to
value_implstructure -> Works correctly. - I created a small repo importing the actual
turbo-taskscrate -> Works correctly. - The issue only reliably reproduces in the full
vercel/next.jsrepository.
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:
- Clone vercel/next.js@6dfcffe
- Open the folder in VS Code with
rust-analyzerinstalled. - Open
crates/next-api/src/project.rs. - 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). - 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)
- Good:
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.