Skip to content

Allow pat macro matcher to be followed by : #2688

Open
@GrantMoyer

Description

@GrantMoyer

Similarly to #1336, since function parameters can be destructured with patterns:

fn foo((x, y): (u32, u32)) -> u32 {}

pat fragment specifiers should be able to be followed by :. The motivation case for this is something like:

macro_rules! terse {
    ($name:ident($($arg:pat : $type:ty),*) $body:block => {
        fn $name<T>($($arg : $type),*) -> T
            where really::long::and::tedious::Bound<That=Even, Has=Associated> + Types
        $body
    }
}

terse!{bar((x, y): (u32, u32)) {}}

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-macrosMacro related proposals and issuesA-patternsPattern matching related proposals & ideasT-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