Debian Codegraph @

gcc/testsuite/rust/compile/exhaustiveness1.rs

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