gccrs icon indicating copy to clipboard operation
gccrs copied to clipboard

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

Open philberty opened this issue 2 years ago • 3 comments

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 https://github.com/Rust-GCC/gccrs/issues/995#issuecomment-1061139942

philberty avatar Apr 19 '22 15:04 philberty