]>
Commit | Line | Data |
---|---|---|
29967ef6 XL |
1 | enum A { |
2 | StructWithFields { x: () }, | |
3 | TupleWithFields(()), | |
4 | Struct {}, | |
5 | Tuple(), | |
6 | Unit, | |
7 | } | |
8 | ||
9 | enum B { | |
10 | StructWithFields { x: () }, | |
11 | TupleWithFields(()), | |
12 | } | |
13 | ||
14 | enum C { | |
15 | StructWithFields { x: () }, | |
16 | TupleWithFields(()), | |
17 | Unit, | |
18 | } | |
19 | ||
20 | enum D { | |
21 | TupleWithFields(()), | |
22 | Unit, | |
23 | } | |
24 | ||
f2b60f7d FG |
25 | enum E { |
26 | TupleWithFields(()), | |
27 | } | |
28 | ||
29967ef6 XL |
29 | fn main() { |
30 | // Only variants without fields are suggested (and others mentioned in a note) where an enum | |
31 | // is used rather than a variant. | |
32 | ||
33 | A.foo(); | |
34 | //~^ ERROR expected value, found enum `A` | |
35 | B.foo(); | |
36 | //~^ ERROR expected value, found enum `B` | |
37 | C.foo(); | |
38 | //~^ ERROR expected value, found enum `C` | |
39 | D.foo(); | |
40 | //~^ ERROR expected value, found enum `D` | |
f2b60f7d FG |
41 | E.foo(); |
42 | //~^ ERROR expected value, found enum `E` | |
29967ef6 XL |
43 | |
44 | // Only tuple variants are suggested in calls or tuple struct pattern matching. | |
45 | ||
46 | let x = A(3); | |
47 | //~^ ERROR expected function, tuple struct or tuple variant, found enum `A` | |
48 | if let A(3) = x { } | |
49 | //~^ ERROR expected tuple struct or tuple variant, found enum `A` | |
50 | } |