Cannot complete macro path in macro <!-- Troubleshooting guide:…
- User
Cannot complete macro path in macro
rust-analyzer version: rust-analyzer 0.4.2897-standalone
rustc version: rustc 1.97.0-nightly (36ba2c771 2026-04-23)
editor or extension: Vim
code snippet to reproduce:
rustmacro_rules! bar { () => (); } macro_rules! foo { ($i:ident) => { $i!() }; } fn main() { foo!(bar$0); }Interface
No new interfaces are introduced.
- Assistant
I’ll trace macro-call completion handling, add a focused regression test for the cursor after
barinsidefoo!(...), then run the narrow completion test suite and any relevant checks. - Assistant
rgisn’t installed in this checkout, so I’m switching tofind/grepand keeping the search scoped to completion and macro-expansion crates. - Assistant
The regression test is in place and is compiling. The likely failure mode is now clear: after
foo!expands, the cursor lands in the generatedbar!call’s path, but completion treats that as still being inside macro input and keeps trying to expand instead of analyzing the path. - Assistant
The focused test now passes with a small context-analysis change: completion stops recursive expansion when the mapped token is part of a macro call’s path, while still expanding when the cursor is genuinely inside the macro arguments. I’m formatting and running the full
ide-completiontest suite now.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.