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-05-21 03:28:00 +00:00
|
|
|
enum Foo {
|
2015-03-26 00:06:52 +00:00
|
|
|
Bar(isize),
|
2014-05-21 03:28:00 +00:00
|
|
|
Baz,
|
|
|
|
}
|
|
|
|
|
|
|
|
enum Other {
|
|
|
|
Other1(Foo),
|
|
|
|
Other2(Foo, Foo),
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
2014-11-06 08:05:53 +00:00
|
|
|
match Foo::Baz {
|
|
|
|
::Foo::Bar(3) => panic!(),
|
|
|
|
::Foo::Bar(_) if false => panic!(),
|
|
|
|
::Foo::Bar(..) if false => panic!(),
|
|
|
|
::Foo::Bar(_n) => panic!(),
|
|
|
|
::Foo::Baz => {}
|
2014-05-21 03:28:00 +00:00
|
|
|
}
|
2014-11-06 08:05:53 +00:00
|
|
|
match Foo::Bar(3) {
|
|
|
|
::Foo::Bar(3) => {}
|
|
|
|
::Foo::Bar(_) if false => panic!(),
|
|
|
|
::Foo::Bar(..) if false => panic!(),
|
|
|
|
::Foo::Bar(_n) => panic!(),
|
|
|
|
::Foo::Baz => panic!(),
|
2014-05-21 03:28:00 +00:00
|
|
|
}
|
2014-11-06 08:05:53 +00:00
|
|
|
match Foo::Bar(4) {
|
|
|
|
::Foo::Bar(3) => panic!(),
|
|
|
|
::Foo::Bar(_) if false => panic!(),
|
|
|
|
::Foo::Bar(..) if false => panic!(),
|
|
|
|
::Foo::Bar(n) => assert_eq!(n, 4),
|
|
|
|
::Foo::Baz => panic!(),
|
2014-05-21 03:28:00 +00:00
|
|
|
}
|
|
|
|
|
2014-11-06 08:05:53 +00:00
|
|
|
match Other::Other1(Foo::Baz) {
|
|
|
|
::Other::Other1(::Foo::Baz) => {}
|
|
|
|
::Other::Other1(::Foo::Bar(_)) => {}
|
|
|
|
::Other::Other2(::Foo::Baz, ::Foo::Bar(_)) => {}
|
|
|
|
::Other::Other2(::Foo::Bar(..), ::Foo::Baz) => {}
|
|
|
|
::Other::Other2(..) => {}
|
2014-05-21 03:28:00 +00:00
|
|
|
}
|
|
|
|
}
|