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-call completion handling, add a focused regression test for this fixture, then run the narrow test suite and any relevant formatting/tidy checks.
- Assistant
rgisn’t installed in this checkout, so I’m switching togit grepand keeping the search scoped to completion code. - Assistant
The failure is in recursive speculative expansion: after
foo!expands tobar!(), completion seesbaras “inside a macro call” and insists on expanding again. But the cursor is on that call’s path, not in its arguments, so expansion cannot proceed and the completion context is discarded. I’m narrowing that stopping condition to recognize macro-call paths as valid completion sites. - Assistant
The focused regression now passes and verifies the applied edit remains
foo!(bar)—the expansion supplies the!(), so completion must not insert a second macro invocation. Formatting and whitespace checks are clean; I’m running the fullide-completiontest suite next.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
Identical first prompt
- composer-2.5Compare side by side →
- composer-2.5Compare side by side →
- composer-2.5Compare side by side →
- composer-2.5Compare side by side →
- composer-2.5Compare side by side →
- gpt-5.6-solCompare side by side →
- gpt-5.6-solCompare side by side →
- gpt-5.6-solCompare side by side →
- gpt-5.6-solCompare side by side →
- fable-5Compare side by side →
- fable-5Compare side by side →