2015-10-02 19:41:24 +00:00
|
|
|
// Can't use empty braced struct as constant pattern
|
2015-02-09 19:01:45 +00:00
|
|
|
|
2016-01-14 11:26:50 +00:00
|
|
|
// aux-build:empty-struct.rs
|
|
|
|
|
|
|
|
extern crate empty_struct;
|
|
|
|
use empty_struct::*;
|
|
|
|
|
2015-10-02 19:41:24 +00:00
|
|
|
struct Empty1 {}
|
|
|
|
|
|
|
|
enum E {
|
2016-01-14 11:26:50 +00:00
|
|
|
Empty3 {}
|
2015-10-02 19:41:24 +00:00
|
|
|
}
|
2015-09-10 19:46:52 +00:00
|
|
|
|
|
|
|
fn main() {
|
2015-10-02 19:41:24 +00:00
|
|
|
let e1 = Empty1 {};
|
2016-01-14 11:26:50 +00:00
|
|
|
let e3 = E::Empty3 {};
|
|
|
|
let xe1 = XEmpty1 {};
|
|
|
|
let xe3 = XE::XEmpty3 {};
|
2013-08-05 20:18:29 +00:00
|
|
|
|
2015-10-26 18:09:12 +00:00
|
|
|
match e1 {
|
|
|
|
Empty1 => () // Not an error, `Empty1` is interpreted as a new binding
|
|
|
|
}
|
2016-01-14 11:26:50 +00:00
|
|
|
match e3 {
|
2016-06-11 15:47:47 +00:00
|
|
|
E::Empty3 => ()
|
2019-10-15 00:20:50 +00:00
|
|
|
//~^ ERROR expected unit struct, unit variant or constant, found struct variant `E::Empty3`
|
2016-01-14 11:26:50 +00:00
|
|
|
}
|
|
|
|
match xe1 {
|
|
|
|
XEmpty1 => () // Not an error, `XEmpty1` is interpreted as a new binding
|
|
|
|
}
|
|
|
|
match xe3 {
|
2016-06-11 15:47:47 +00:00
|
|
|
XE::XEmpty3 => ()
|
2019-10-15 00:20:50 +00:00
|
|
|
//~^ ERROR expected unit struct, unit variant or constant, found struct variant `XE::XEmpty3`
|
2015-09-10 19:46:52 +00:00
|
|
|
}
|
|
|
|
}
|