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