Skip to content

Add macro_rules fragment class for "expressions that can be followed by {" #1463

@pnkfelix

Description

@pnkfelix

(spawned off of #1384 (comment) )

I've been leaving links to the above comment in all sorts of places, so I finally decided it was time to open an RFC issue for this idea.

Namely, to add some fragment class, which I'll call pred for now, that represents "the subset of expressions that do not have { in their follow set, and thus the presence of a { as the next token tells the parser that it is definitely done parsing the expression."

In particular, this is the subset of expressions that we use for the test in an if test { then } else { other }

Such an fragment class would be useful for writing macro_rules! that naturally want a { to come after them in the input pattern.

We used to superficially "allow" such macros, but they didn't actually work in general; see rust-lang/rust#26739

Metadata

Metadata

Assignees

No one assigned

    Labels

    T-langRelevant to the language team, which will review and decide on the RFC.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions