Remove the proc_macro::Group around metavariables which are always a single token #55557
Labels
A-macros
Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..)
C-enhancement
Category: An issue proposing an enhancement or a PR with one.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
I have the following proc macro to print out tokens:
And suppose I call it like this:
As of rustc 1.31.0-nightly (1cf82fd 2018-10-30) the input is passed to my macro as:
I believe idents (and any other metavariables which are always a single token) should not be wrapped in a Group. It makes handling proc macro input unnecessarily confusing. This proc macro should be receiving a plain
Literal
Punct
Ident
rather thanLiteral
Punct
Group
.Metavariables that can be multiple tokens, including$:expr and $ :ty, will need to continue having a surrounding None-delimited Group to preserve precedence.
cc @alexcrichton
The text was updated successfully, but these errors were encountered: