]>
Commit | Line | Data |
---|---|---|
32a655c1 | 1 | #![deny(unreachable_patterns)] |
1a4d82fc | 2 | |
223e47cc | 3 | fn main() { |
1a4d82fc | 4 | let x: Vec<(isize, isize)> = Vec::new(); |
85aaf69f | 5 | let x: &[(isize, isize)] = &x; |
3157f602 | 6 | match *x { |
223e47cc LB |
7 | [a, (2, 3), _] => (), |
8 | [(1, 2), (2, 3), b] => (), //~ ERROR unreachable pattern | |
9 | _ => () | |
10 | } | |
11 | ||
1a4d82fc JJ |
12 | let x: Vec<String> = vec!["foo".to_string(), |
13 | "bar".to_string(), | |
14 | "baz".to_string()]; | |
85aaf69f | 15 | let x: &[String] = &x; |
3157f602 | 16 | match *x { |
32a655c1 | 17 | [ref a, _, _, ..] => { println!("{}", a); } |
1a4d82fc | 18 | [_, _, _, _, _] => { } //~ ERROR unreachable pattern |
223e47cc LB |
19 | _ => { } |
20 | } | |
21 | ||
c30ab7b3 | 22 | let x: Vec<char> = vec!['a', 'b', 'c']; |
85aaf69f | 23 | let x: &[char] = &x; |
3157f602 | 24 | match *x { |
416331ca | 25 | ['a', 'b', 'c', ref _tail @ ..] => {} |
223e47cc LB |
26 | ['a', 'b', 'c'] => {} //~ ERROR unreachable pattern |
27 | _ => {} | |
28 | } | |
29 | } |