1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
struct S {
e1: E1,
e2: E2,
}
enum E1 {
A(),
B(),
C(),
}
enum E2 {
D(),
E(),
}
// This is a valid match
fn f(s: S) {
match s {
S {
e1: E1::A(),
e2: E2::D(),
} => {}
S {
e1: E1::B(),
e2: E2::D(),
} => {}
S {
e1: E1::C(),
e2: E2::D(),
} => {}
S {
e1: E1::A(),
e2: E2::E(),
} => {}
S {
e1: E1::B(),
e2: E2::E(),
} => {}
S {
e1: E1::C(),
e2: E2::E(),
} => {}
}
}
fn f2(s: S) {
match s {
// { dg-error "non-exhaustive patterns: 'S { e1: E1::B.., e2: E2::D.. }' and 'S { e1: E1::C.., e2: E2::D.. }' not covered" "" { target *-*-* } .-1 }
S { e1: E1::A(), e2: _ } => {}
S { e1: _, e2: E2::E() } => {}
}
}
fn main() {}
|