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

21 lines
520 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"] {
[a, _, _, .._] => { io::println(a); }
[~"foo", ~"bar", ~"baz", ~"foo", ~"bar"] => { } //~ ERROR unreachable pattern
_ => { }
}
match ['a', 'b', 'c'] {
['a', 'b', 'c', .._tail] => {}
['a', 'b', 'c'] => {} //~ ERROR unreachable pattern
_ => {}
}
}