2017-11-23 07:10:23 -06:00
|
|
|
enum Example { Ex(String), NotEx }
|
|
|
|
|
2019-03-20 13:54:43 -05:00
|
|
|
enum Void {}
|
|
|
|
|
|
|
|
enum ManyVariants {
|
|
|
|
One,
|
|
|
|
Two,
|
|
|
|
Three,
|
|
|
|
Four,
|
|
|
|
Five,
|
|
|
|
Six,
|
|
|
|
Seven,
|
|
|
|
Eight,
|
|
|
|
Nine,
|
|
|
|
Ten,
|
|
|
|
}
|
|
|
|
|
2017-11-15 01:20:09 -06:00
|
|
|
fn result_test() {
|
2019-10-14 19:20:50 -05:00
|
|
|
let x = Option(1); //~ ERROR expected function, tuple struct or tuple variant, found enum
|
2017-11-15 01:20:09 -06:00
|
|
|
|
2019-10-14 19:20:50 -05:00
|
|
|
if let Option(_) = x { //~ ERROR expected tuple struct or tuple variant, found enum
|
2017-11-15 01:20:09 -06:00
|
|
|
println!("It is OK.");
|
|
|
|
}
|
2017-11-23 07:10:23 -06:00
|
|
|
|
|
|
|
let y = Example::Ex(String::from("test"));
|
|
|
|
|
2019-10-14 19:20:50 -05:00
|
|
|
if let Example(_) = y { //~ ERROR expected tuple struct or tuple variant, found enum
|
2017-11-23 07:10:23 -06:00
|
|
|
println!("It is OK.");
|
|
|
|
}
|
2019-03-20 13:54:43 -05:00
|
|
|
|
2019-10-14 19:20:50 -05:00
|
|
|
let y = Void(); //~ ERROR expected function, tuple struct or tuple variant, found enum
|
2019-03-20 13:54:43 -05:00
|
|
|
|
2019-10-14 19:20:50 -05:00
|
|
|
let z = ManyVariants(); //~ ERROR expected function, tuple struct or tuple variant, found enum
|
2017-11-15 01:20:09 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {}
|