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