2018-08-30 12:18:55 +00:00
|
|
|
//@ run-pass
|
2018-09-25 21:51:35 +00:00
|
|
|
#![allow(dead_code)]
|
2015-03-22 20:13:15 +00:00
|
|
|
|
2014-07-21 19:32:03 +00:00
|
|
|
enum NestedEnum {
|
|
|
|
First,
|
|
|
|
Second,
|
|
|
|
Third
|
|
|
|
}
|
|
|
|
enum Enum {
|
|
|
|
Variant1(bool),
|
|
|
|
Variant2(NestedEnum)
|
|
|
|
}
|
|
|
|
|
|
|
|
#[inline(never)]
|
2015-03-26 00:06:52 +00:00
|
|
|
fn foo(x: Enum) -> isize {
|
2014-07-21 19:32:03 +00:00
|
|
|
match x {
|
2014-11-06 08:05:53 +00:00
|
|
|
Enum::Variant1(true) => 1,
|
|
|
|
Enum::Variant1(false) => 2,
|
|
|
|
Enum::Variant2(NestedEnum::Second) => 3,
|
|
|
|
Enum::Variant2(NestedEnum::Third) => 4,
|
|
|
|
Enum::Variant2(NestedEnum::First) => 5
|
2014-07-21 19:32:03 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
2014-11-06 08:05:53 +00:00
|
|
|
assert_eq!(foo(Enum::Variant2(NestedEnum::Third)), 4);
|
2014-07-21 19:32:03 +00:00
|
|
|
}
|