]> git.proxmox.com Git - rustc.git/blame - src/test/ui/resolve/issue-73427.rs
New upstream version 1.64.0+dfsg1
[rustc.git] / src / test / ui / resolve / issue-73427.rs
CommitLineData
29967ef6
XL
1enum A {
2 StructWithFields { x: () },
3 TupleWithFields(()),
4 Struct {},
5 Tuple(),
6 Unit,
7}
8
9enum B {
10 StructWithFields { x: () },
11 TupleWithFields(()),
12}
13
14enum C {
15 StructWithFields { x: () },
16 TupleWithFields(()),
17 Unit,
18}
19
20enum D {
21 TupleWithFields(()),
22 Unit,
23}
24
25fn main() {
26 // Only variants without fields are suggested (and others mentioned in a note) where an enum
27 // is used rather than a variant.
28
29 A.foo();
30 //~^ ERROR expected value, found enum `A`
31 B.foo();
32 //~^ ERROR expected value, found enum `B`
33 C.foo();
34 //~^ ERROR expected value, found enum `C`
35 D.foo();
36 //~^ ERROR expected value, found enum `D`
37
38 // Only tuple variants are suggested in calls or tuple struct pattern matching.
39
40 let x = A(3);
41 //~^ ERROR expected function, tuple struct or tuple variant, found enum `A`
42 if let A(3) = x { }
43 //~^ ERROR expected tuple struct or tuple variant, found enum `A`
44}