aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/rust/execute/torture/struct_pattern1.rs
blob: 7a74092ad50c38ba29e503959405aaadfc75fb02 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
struct A {
    // the two warnings are invalid but this should be fixed by our lint rework
    // with this year's GSoC so ok for now
    a: i32, // { dg-warning "never read" }
    b: i32, // { dg-warning "never read" }
}

fn main() -> i32 {
    let a = A { a: 15, b: 14 };

    let result = match a {
        A {
            a: self_a,
            b: self_b,
        } => self_a + self_b,
    };

    result - 29
}