rust/src/test/compile-fail/match-vec-unreachable.rs

21 lines
517 B
Rust
Raw Normal View History

fn main() {
let x: ~[(int, int)] = ~[];
match x {
[a, (2, 3), _] => (),
[(1, 2), (2, 3), b] => (), //~ ERROR unreachable pattern
_ => ()
}
match ~[~"foo", ~"bar", ~"baz"] {
2013-11-28 14:22:53 -06:00
[a, _, _, ..] => { println(a); }
[~"foo", ~"bar", ~"baz", ~"foo", ~"bar"] => { } //~ ERROR unreachable pattern
_ => { }
}
match ~['a', 'b', 'c'] {
['a', 'b', 'c', .._tail] => {}
['a', 'b', 'c'] => {} //~ ERROR unreachable pattern
_ => {}
}
}