]> git.lizzy.rs Git - rust.git/blob - src/test/run-pass/issue-6449.rs
auto merge of #20154 : P1start/rust/qualified-assoc-type-generics, r=nikomatsakis
[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 enum Foo {
12     Bar(int),
13     Baz,
14 }
15
16 enum Other {
17     Other1(Foo),
18     Other2(Foo, Foo),
19 }
20
21 fn main() {
22     match Foo::Baz {
23         ::Foo::Bar(3) => panic!(),
24         ::Foo::Bar(_) if false => panic!(),
25         ::Foo::Bar(..) if false => panic!(),
26         ::Foo::Bar(_n) => panic!(),
27         ::Foo::Baz => {}
28     }
29     match Foo::Bar(3) {
30         ::Foo::Bar(3) => {}
31         ::Foo::Bar(_) if false => panic!(),
32         ::Foo::Bar(..) if false => panic!(),
33         ::Foo::Bar(_n) => panic!(),
34         ::Foo::Baz => panic!(),
35     }
36     match Foo::Bar(4) {
37         ::Foo::Bar(3) => panic!(),
38         ::Foo::Bar(_) if false => panic!(),
39         ::Foo::Bar(..) if false => panic!(),
40         ::Foo::Bar(n) => assert_eq!(n, 4),
41         ::Foo::Baz => panic!(),
42     }
43
44     match Other::Other1(Foo::Baz) {
45         ::Other::Other1(::Foo::Baz) => {}
46         ::Other::Other1(::Foo::Bar(_)) => {}
47         ::Other::Other2(::Foo::Baz, ::Foo::Bar(_)) => {}
48         ::Other::Other2(::Foo::Bar(..), ::Foo::Baz) => {}
49         ::Other::Other2(..) => {}
50     }
51 }