1 // Copyright 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.
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.
12 #![deny(unreachable_patterns)]
14 use self::Direction
::{North, East, South, West}
;
16 #[derive(PartialEq, Eq)]
19 #[derive(PartialEq, Eq)]
27 const TRUE_TRUE
: (bool
, bool
) = (true, true);
36 //~^ ERROR unreachable pattern
40 const NONE
: Option
<Direction
> = None
;
41 const EAST
: Direction
= East
;
44 match Some(Some(North
)) {
46 Some(Some(North
)) => (),
47 Some(Some(EAST
)) => (),
48 Some(Some(South
)) => (),
49 Some(Some(West
)) => (),
50 Some(Some(East
)) => (),
51 //~^ ERROR unreachable pattern
56 const NEW_FALSE
: NewBool
= NewBool(false);
58 bar
: Option
<Direction
>,
63 match (Foo { bar: Some(EAST), baz: NewBool(true) }
) {
64 Foo { bar: None, baz: NewBool(true) }
=> (),
65 Foo { bar: _, baz: NEW_FALSE }
=> (),
66 Foo { bar: Some(West), baz: NewBool(true) }
=> (),
67 Foo { bar: Some(South), .. }
=> (),
68 Foo { bar: Some(EAST), .. }
=> (),
69 Foo { bar: Some(North), baz: NewBool(true) }
=> (),
70 Foo { bar: Some(EAST), baz: NewBool(false) }
=> ()
71 //~^ ERROR unreachable pattern