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-06-18 09:33:58 -05:00
|
|
|
enum X {
|
2015-03-25 19:06:52 -05:00
|
|
|
Foo(usize),
|
2014-06-18 09:33:58 -05:00
|
|
|
Bar(bool)
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
2014-11-06 02:05:53 -06:00
|
|
|
let x = match X::Foo(42) {
|
2015-01-25 15:05:03 -06:00
|
|
|
X::Foo(..) => 1,
|
2014-06-18 09:33:58 -05:00
|
|
|
_ if true => 0,
|
2014-11-06 02:05:53 -06:00
|
|
|
X::Bar(..) => panic!("Oh dear")
|
2014-06-18 09:33:58 -05:00
|
|
|
};
|
|
|
|
assert_eq!(x, 1);
|
|
|
|
|
2014-11-06 02:05:53 -06:00
|
|
|
let x = match X::Foo(42) {
|
2015-01-25 15:05:03 -06:00
|
|
|
_ if true => 0,
|
2014-11-06 02:05:53 -06:00
|
|
|
X::Foo(..) => 1,
|
|
|
|
X::Bar(..) => panic!("Oh dear")
|
2014-06-18 09:33:58 -05:00
|
|
|
};
|
|
|
|
assert_eq!(x, 0);
|
|
|
|
}
|