rust-lang / rust-lang/rust-analyzer
macro-error expected leaf: `;` when using a macro
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 16.9k
- Forks
- 2.2k
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 72
Description
I'm seeing an error message on a macro expansion in rust-analyzer expected leaf: ; rust-analyzer(macro-error). I can run and build the crate fine. Removing the generic parameters on the macro resolves the error.
The macro is building a enum definiton as well as implementing parsing traits based on the macro arguments.
I created https://github.com/semicoleon/macro-error-demo with a (mostly) minimal example of a macro that causes the error. The README has slightly more information about the error as well as the cargo expand output.
I encountered this in rust-analyzer d15f646ff 2021-08-30 stable on macOS. I also tried building from source rust-analyzer c16e6474f 2021-09-04 dev and also encountered the issue there.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the mostly minimal reproducer in the linked macro-error-demo repository, read its README, and compare the reported diagnostic with the cargo expand output. Trace how rust-analyzer handles the macro's generic parameters and generated enum and parsing traits; done means the false expected leaf: ; diagnostic no longer appears while the crate still builds.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100