]> git.lizzy.rs Git - rust.git/commitdiff
Add some test cases
authorNadrieril <nadrieril@gmail.com>
Sat, 5 Oct 2019 21:57:52 +0000 (22:57 +0100)
committerNadrieril <nadrieril+git@gmail.com>
Tue, 5 Nov 2019 17:59:01 +0000 (17:59 +0000)
src/test/ui/pattern/usefulness/slice-patterns.rs
src/test/ui/pattern/usefulness/slice-patterns.stderr

index 97086c4d75ddc87c6d15b62e4498bc4cc4eb75dc..e11f11ba7524d233d9d78ff0b4315360843d68f7 100644 (file)
@@ -93,4 +93,18 @@ fn main() {
         [false] => {}
         [..] => {}
     }
+    match s {
+    //~^ ERROR `&[_, _, true]` not covered
+        [] => {}
+        [_] => {}
+        [_, _] => {}
+        [.., false] => {}
+    }
+    match s {
+    //~^ ERROR `&[true, _, _]` not covered
+        [] => {}
+        [_] => {}
+        [_, _] => {}
+        [false, .., false] => {}
+    }
 }
index 3cea068543ebdf7fd6ecf800989e990a23cfbfa4..666e16627c57e0a090fd5ba542105ca4afc07c99 100644 (file)
@@ -112,6 +112,22 @@ error: unreachable pattern
 LL |         [false, true] => {}
    |         ^^^^^^^^^^^^^
 
-error: aborting due to 15 previous errors
+error[E0004]: non-exhaustive patterns: `&[_, _, true]` not covered
+  --> $DIR/slice-patterns.rs:96:11
+   |
+LL |     match s {
+   |           ^ pattern `&[_, _, true]` not covered
+   |
+   = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+
+error[E0004]: non-exhaustive patterns: `&[true, _, _]` not covered
+  --> $DIR/slice-patterns.rs:103:11
+   |
+LL |     match s {
+   |           ^ pattern `&[true, _, _]` not covered
+   |
+   = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+
+error: aborting due to 17 previous errors
 
 For more information about this error, try `rustc --explain E0004`.