Skip to content

macro pattern ($($arg:expr)*) should be illegal #48220

Closed
@semenzato

Description

@semenzato

On rustc 1.21.0 it is legal to write a rule like

($($arg:expr)*) => { println!($($arg),*) }

but the manual does not allow space as a separator in an expr list:

https://doc.rust-lang.org/book/first-edition/macros.html#syntactic-requirements

which is reasonable because it leads to ambiguities (e.g. "a b -c" could be three expressions "a", "b", and "-c", or two, "a" and "b-c"). (If you're curious, the implementation picks the second choice in this case).

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-macrosArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)C-bugCategory: This is a bug.T-langRelevant to the language team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions