]> git.lizzy.rs Git - rust.git/blobdiff - src/test/compile-fail/match-vec-unreachable.rs
librustc: Remove unique vector patterns from the language.
[rust.git] / src / test / compile-fail / match-vec-unreachable.rs
index d595effcb4b048826aa29863ce7b2a36c65534f1..e2a052bd2638e8959dd02a9b8df07290dcca03f3 100644 (file)
 
 fn main() {
     let x: ~[(int, int)] = ~[];
+    let x: &[(int, int)] = x;
     match x {
         [a, (2, 3), _] => (),
         [(1, 2), (2, 3), b] => (), //~ ERROR unreachable pattern
         _ => ()
     }
 
-    match ~[~"foo", ~"bar", ~"baz"] {
+    let x: ~[~str] = ~[~"foo", ~"bar", ~"baz"];
+    let x: &[~str] = x;
+    match x {
         [a, _, _, ..] => { println!("{}", a); }
         [~"foo", ~"bar", ~"baz", ~"foo", ~"bar"] => { } //~ ERROR unreachable pattern
         _ => { }
     }
 
-    match ~['a', 'b', 'c'] {
+    let x: ~[char] = ~['a', 'b', 'c'];
+    let x: &[char] = x;
+    match x {
         ['a', 'b', 'c', .._tail] => {}
         ['a', 'b', 'c'] => {} //~ ERROR unreachable pattern
         _ => {}