]> git.lizzy.rs Git - rust.git/blob - tests/ui/empty/empty-struct-braces-pat-1.rs
Tweak use of trimmed paths
[rust.git] / tests / ui / empty / empty-struct-braces-pat-1.rs
1 // Can't use empty braced struct as constant pattern
2
3 // aux-build:empty-struct.rs
4
5 extern crate empty_struct;
6 use empty_struct::*;
7
8 struct Empty1 {}
9
10 enum E {
11     Empty3 {}
12 }
13
14 fn main() {
15     let e1 = Empty1 {};
16     let e3 = E::Empty3 {};
17     let xe1 = XEmpty1 {};
18     let xe3 = XE::XEmpty3 {};
19
20     match e1 {
21         Empty1 => () // Not an error, `Empty1` is interpreted as a new binding
22     }
23     match e3 {
24         E::Empty3 => ()
25         //~^ ERROR expected unit struct, unit variant or constant, found struct variant `E::Empty3`
26     }
27     match xe1 {
28         XEmpty1 => () // Not an error, `XEmpty1` is interpreted as a new binding
29     }
30     match xe3 {
31         XE::XEmpty3 => ()
32     //~^ ERROR expected unit struct, unit variant or constant, found struct variant `XE::XEmpty3`
33     }
34 }