aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/rust/compile/match3.rs
blob: 98181e85197c99d011dba37355dceadc89cd29fe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
enum Foo {
    A,
    B,
    C(char),
    D { x: i64, y: i64 },
}

fn inspect(f: Foo) {
    match f {
        Foo::A => {}
        Foo::B => {}
        Foo::C(x) => {}
        Foo::D { z } => {} // { dg-error "variant D does not have a field named z" }
                           // { dg-error "pattern does not mention fields x, y" "" { target *-*-* } .-1 }
    }
}