]> git.lizzy.rs Git - rust.git/blob - tests/ui/empty/empty-struct-unit-pat.rs
Auto merge of #105102 - compiler-errors:copy-impl-considering-regions, r=lcnr
[rust.git] / tests / ui / empty / empty-struct-unit-pat.rs
1 // Can't use unit struct as tuple struct pattern
2
3 // aux-build:empty-struct.rs
4
5 extern crate empty_struct;
6 use empty_struct::*;
7
8 struct Empty2;
9
10 enum E {
11     Empty4
12 }
13
14 fn main() {
15     let e2 = Empty2;
16     let e4 = E::Empty4;
17     let xe2 = XEmpty2;
18     let xe4 = XE::XEmpty4;
19
20     match e2 {
21         Empty2() => () //~ ERROR expected tuple struct or tuple variant, found unit struct `Empty2`
22     }
23     match xe2 {
24         XEmpty2() => ()
25         //~^ ERROR expected tuple struct or tuple variant, found unit struct `XEmpty2`
26     }
27     match e2 {
28         Empty2(..) => ()
29         //~^ ERROR expected tuple struct or tuple variant, found unit struct `Empty2`
30     }
31     match xe2 {
32         XEmpty2(..) => ()
33         //~^ ERROR expected tuple struct or tuple variant, found unit struct `XEmpty2`
34     }
35
36     match e4 {
37         E::Empty4() => ()
38         //~^ ERROR expected tuple struct or tuple variant, found unit variant `E::Empty4`
39     }
40     match xe4 {
41         XE::XEmpty4() => (),
42         //~^ ERROR expected tuple struct or tuple variant, found unit variant `XE::XEmpty4`
43         _ => {},
44     }
45     match e4 {
46         E::Empty4(..) => ()
47         //~^ ERROR expected tuple struct or tuple variant, found unit variant `E::Empty4`
48     }
49     match xe4 {
50         XE::XEmpty4(..) => (),
51         //~^ ERROR expected tuple struct or tuple variant, found unit variant `XE::XEmpty4`
52         _ => {},
53     }
54 }