Skip to content

unrecognised token ‘|’ in grouped or tuple pattern after first pattern #1136

@philberty

Description

@philberty

Other example which should work as soon as we fix the above example:

enum NewTypeOrStruct {
    One(i32),
    Two{other: String, value: i32},
} 

fn foo((NewTypeOrStruct::One(foo) | NewTypeOrStruct::Two{other: _, value: foo}): NewTypeOrStruct) -> i32 {
    foo + 15i32
}

fn main() {
    foo(NewTypeOrStruct::One(15));
    foo(NewTypeOrStruct::Two {
        other: String::from("other"),
        value: 14
    });
}

Originally posted by @CohenArthur in #995 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions