]> git.proxmox.com Git - rustc.git/blob - src/test/run-pass/issues/issue-6449.rs
New upstream version 1.37.0+dfsg1
[rustc.git] / src / test / run-pass / issues / issue-6449.rs
1 // run-pass
2 #![allow(dead_code)]
3
4 enum Foo {
5 Bar(isize),
6 Baz,
7 }
8
9 enum Other {
10 Other1(Foo),
11 Other2(Foo, Foo),
12 }
13
14 fn main() {
15 match Foo::Baz {
16 ::Foo::Bar(3) => panic!(),
17 ::Foo::Bar(_) if false => panic!(),
18 ::Foo::Bar(..) if false => panic!(),
19 ::Foo::Bar(_n) => panic!(),
20 ::Foo::Baz => {}
21 }
22 match Foo::Bar(3) {
23 ::Foo::Bar(3) => {}
24 ::Foo::Bar(_) if false => panic!(),
25 ::Foo::Bar(..) if false => panic!(),
26 ::Foo::Bar(_n) => panic!(),
27 ::Foo::Baz => panic!(),
28 }
29 match Foo::Bar(4) {
30 ::Foo::Bar(3) => panic!(),
31 ::Foo::Bar(_) if false => panic!(),
32 ::Foo::Bar(..) if false => panic!(),
33 ::Foo::Bar(n) => assert_eq!(n, 4),
34 ::Foo::Baz => panic!(),
35 }
36
37 match Other::Other1(Foo::Baz) {
38 ::Other::Other1(::Foo::Baz) => {}
39 ::Other::Other1(::Foo::Bar(_)) => {}
40 ::Other::Other2(::Foo::Baz, ::Foo::Bar(_)) => {}
41 ::Other::Other2(::Foo::Bar(..), ::Foo::Baz) => {}
42 ::Other::Other2(..) => {}
43 }
44 }