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