rust-lang / rust-analyzer

A Rust compiler front-end for IDEs
https://rust-analyzer.github.io/
Apache License 2.0
14.03k stars 1.56k forks source link

macro-error expected leaf: `;` when using a macro #10151

Open semicoleon opened 2 years ago

semicoleon commented 2 years ago

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.

Veykril commented 8 months ago

This now errors with unexpected token in input