]> git.lizzy.rs Git - rust.git/blob - src/test/ui/issues/issue-73427.rs
Rollup merge of #91804 - woppopo:const_clone, r=oli-obk
[rust.git] / src / test / ui / issues / issue-73427.rs
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
25 fn 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 }