gcc/testsuite/rust/compile/match3.rs
raw| 1 | enum Foo { |
| 2 | A, |
| 3 | B, |
| 4 | C(char), |
| 5 | D { x: i64, y: i64 }, |
| 6 | } |
| 7 | |
| 8 | fn inspect(f: Foo) { |
| 9 | match f { |
| 10 | Foo::A => {} |
| 11 | Foo::B => {} |
| 12 | Foo::C(x) => {} |
| 13 | Foo::D { z } => {} // { dg-error "variant D does not have a field named z" } |
| 14 | // { dg-error "pattern does not mention fields x, y" "" { target *-*-* } .-1 } |
| 15 | } |
| 16 | } |