Skip to content

RFC: Allow matching against n-ary variants with just the name #1701

Closed
@marijnh

Description

@marijnh

There's lot of stuff like this in the current code:

alt expr.node {
    expr_field(_, _) | expr_index(_, _) { ... }
}

Where we need to have the (_, _, _) in there even though we just want to match a variant, and don't care about the arguments. If I understand correctly, we're already disallowing shadowing such variants in patterns, so it is probably a good idea to also allow matching against them with just their name. I.e.

alt expr.node {
    expr_field | expr_index { ... }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-frontendArea: Compiler frontend (errors, parsing and HIR)E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions