2019-04-15 10:08:46 -05:00
|
|
|
#[derive(Copy, Clone, Debug, Hash, PartialEq, Eq)]
|
|
|
|
enum E {
|
2019-04-18 13:35:11 -05:00
|
|
|
V { field: bool },
|
|
|
|
I { field1: bool, field2: usize },
|
|
|
|
J { field: isize },
|
|
|
|
K { field: &'static str},
|
2019-04-15 10:08:46 -05:00
|
|
|
}
|
|
|
|
fn test_E(x: E) {
|
|
|
|
let field = true;
|
|
|
|
if x == E::V { field } {}
|
|
|
|
//~^ ERROR expected value, found struct variant `E::V`
|
|
|
|
//~| ERROR mismatched types
|
2019-04-18 13:35:11 -05:00
|
|
|
if x == E::I { field1: true, field2: 42 } {}
|
|
|
|
//~^ ERROR struct literals are not allowed here
|
|
|
|
if x == E::V { field: false } {}
|
2019-04-18 15:58:57 -05:00
|
|
|
//~^ ERROR struct literals are not allowed here
|
2019-04-18 13:35:11 -05:00
|
|
|
if x == E::J { field: -42 } {}
|
|
|
|
//~^ ERROR struct literals are not allowed here
|
|
|
|
if x == E::K { field: "" } {}
|
|
|
|
//~^ ERROR struct literals are not allowed here
|
2019-04-15 10:08:46 -05:00
|
|
|
let y: usize = ();
|
|
|
|
//~^ ERROR mismatched types
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {}
|