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:
macro_rules! bar { () => (); } macro_rules! foo { ($i:ident) => { $i!() }; } fn main() { foo!(bar$0); }Interface
No new interfaces are introduced.
- Assistant
I’ll trace macro-argument completion and add a focused regression test for the
foo!(bar)case, then run the narrow completion test suite. - Assistant
The completion pipeline already speculatively expands the outer macro. I’m reproducing the failure at that boundary now; the likely fault is that a macro metavariable copied into a nested macro path is classified differently from a normal expression path.
- Assistant
The regression now passes: completion stops at the generated nested macro’s path, offers
bar, and inserts onlybarintofoo!(…)(the outer expansion still supplies!()). I’m checking the broader completion suite for unintended changes to macro-argument behavior.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.