Skip to content

Macro rules: using lifetime specifier inside recursion causes local ambiguity #50903

Closed
@jjedelsky

Description

@jjedelsky

# is not valid lifetime, so using :litetime specifier should not cause local ambiguity.

Example:

macro_rules! bug {
    ($($lif2:lifetime ,)* #) => {};
}

bug!('a, #);
error: local ambiguity: multiple parsing options: built-in NTs lifetime ('lif2') or 1 other option.
 --> src/main.rs:7:10
  |
7 | bug!('a, #);
  |          ^

Playground link

cc tracking issue for $:lifetime matcher: #34303

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.E-mentorCall for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.T-compilerRelevant to the compiler 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