2018-08-30 07:18:55 -05:00
|
|
|
// run-pass
|
2018-09-25 16:51:35 -05:00
|
|
|
#![allow(dead_code)]
|
2015-03-22 15:13:15 -05:00
|
|
|
|
2014-07-21 14:32:03 -05:00
|
|
|
enum NestedEnum {
|
|
|
|
First,
|
|
|
|
Second,
|
|
|
|
Third
|
|
|
|
}
|
|
|
|
enum Enum {
|
|
|
|
Variant1(bool),
|
|
|
|
Variant2(NestedEnum)
|
|
|
|
}
|
|
|
|
|
|
|
|
#[inline(never)]
|
2015-03-25 19:06:52 -05:00
|
|
|
fn foo(x: Enum) -> isize {
|
2014-07-21 14:32:03 -05:00
|
|
|
match x {
|
2014-11-06 02:05:53 -06: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 14:32:03 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
2014-11-06 02:05:53 -06:00
|
|
|
assert_eq!(foo(Enum::Variant2(NestedEnum::Third)), 4);
|
2014-07-21 14:32:03 -05:00
|
|
|
}
|