aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/rust/execute/torture/struct-pattern-match.rs
blob: 6aec51f93fe06fe06a9b2e172a54b22ca14e3052 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
enum Foo {
    A { x: i32 },
    B { y: i32 }
}

fn main() -> i32 {
    let x = Foo::A { x: 12 };
    match x {
        Foo::A { x: 10 } => 1,
        Foo::B { y: 11 } => 2,
        Foo::A { x: abc } => { abc - 12 }
    }
}