]> git.lizzy.rs Git - rust.git/blob - src/test/ui/empty/empty-struct-tuple-pat.rs
Rollup merge of #103159 - cuviper:check_pow-final-try_opt, r=Mark-Simulacrum
[rust.git] / src / test / ui / empty / empty-struct-tuple-pat.rs
1 // Can't use unit struct as enum 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 // remove attribute after warning cycle and promoting warnings to errors
15 fn main() {
16     let e2 = Empty2();
17     let e4 = E::Empty4();
18     let xe6 = XEmpty6();
19     let xe5 = XE::XEmpty5();
20
21     match e2 {
22         Empty2 => () //~ ERROR match bindings cannot shadow tuple structs
23     }
24     match xe6 {
25         XEmpty6 => () //~ ERROR match bindings cannot shadow tuple structs
26     }
27
28     match e4 {
29         E::Empty4 => ()
30         //~^ ERROR expected unit struct, unit variant or constant, found tuple variant `E::Empty4`
31     }
32     match xe5 {
33         XE::XEmpty5 => (),
34         //~^ ERROR expected unit struct, unit variant or constant, found tuple variant `XE::XEmpty5`
35         _ => {},
36     }
37 }