]> git.lizzy.rs Git - rust.git/blob - src/test/run-pass/issue-6449.rs
Auto merge of #28465 - apasel422:tidy, r=alexcrichton
[rust.git] / src / test / run-pass / issue-6449.rs
1 // Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
4 //
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
10
11
12 enum Foo {
13     Bar(isize),
14     Baz,
15 }
16
17 enum Other {
18     Other1(Foo),
19     Other2(Foo, Foo),
20 }
21
22 fn main() {
23     match Foo::Baz {
24         ::Foo::Bar(3) => panic!(),
25         ::Foo::Bar(_) if false => panic!(),
26         ::Foo::Bar(..) if false => panic!(),
27         ::Foo::Bar(_n) => panic!(),
28         ::Foo::Baz => {}
29     }
30     match Foo::Bar(3) {
31         ::Foo::Bar(3) => {}
32         ::Foo::Bar(_) if false => panic!(),
33         ::Foo::Bar(..) if false => panic!(),
34         ::Foo::Bar(_n) => panic!(),
35         ::Foo::Baz => panic!(),
36     }
37     match Foo::Bar(4) {
38         ::Foo::Bar(3) => panic!(),
39         ::Foo::Bar(_) if false => panic!(),
40         ::Foo::Bar(..) if false => panic!(),
41         ::Foo::Bar(n) => assert_eq!(n, 4),
42         ::Foo::Baz => panic!(),
43     }
44
45     match Other::Other1(Foo::Baz) {
46         ::Other::Other1(::Foo::Baz) => {}
47         ::Other::Other1(::Foo::Bar(_)) => {}
48         ::Other::Other2(::Foo::Baz, ::Foo::Bar(_)) => {}
49         ::Other::Other2(::Foo::Bar(..), ::Foo::Baz) => {}
50         ::Other::Other2(..) => {}
51     }
52 }