about summary refs log tree commit diff
path: root/src/test/ui/pattern
diff options
context:
space:
mode:
authorNadrieril <nadrieril+git@gmail.com>2019-11-03 23:11:04 +0000
committerNadrieril <nadrieril+git@gmail.com>2019-11-05 17:59:01 +0000
commit65bc67e8d9922c450ee81971cd1bab030fcf0a14 (patch)
tree9e6177cb39d02b12a0c47879eb57022232b23204 /src/test/ui/pattern
parentb66973043e555f3a24a50a227db76b0a069ea037 (diff)
downloadrust-65bc67e8d9922c450ee81971cd1bab030fcf0a14.tar.gz
rust-65bc67e8d9922c450ee81971cd1bab030fcf0a14.zip
Make exhaustiveness error message more consistent for slice patterns
This improves error messages by indicating when slices above a certain
lengths have not been matched. Previously, we would only report examples
of such lengths, but of course never all of them.
Diffstat (limited to 'src/test/ui/pattern')
-rw-r--r--src/test/ui/pattern/usefulness/match-byte-array-patterns-2.stderr4
-rw-r--r--src/test/ui/pattern/usefulness/non-exhaustive-match.rs2
-rw-r--r--src/test/ui/pattern/usefulness/non-exhaustive-match.stderr4
-rw-r--r--src/test/ui/pattern/usefulness/slice-patterns.rs4
-rw-r--r--src/test/ui/pattern/usefulness/slice-patterns.stderr8
5 files changed, 11 insertions, 11 deletions
diff --git a/src/test/ui/pattern/usefulness/match-byte-array-patterns-2.stderr b/src/test/ui/pattern/usefulness/match-byte-array-patterns-2.stderr
index 9938c9c284d..6e52072e3bf 100644
--- a/src/test/ui/pattern/usefulness/match-byte-array-patterns-2.stderr
+++ b/src/test/ui/pattern/usefulness/match-byte-array-patterns-2.stderr
@@ -6,11 +6,11 @@ LL |     match buf {
    |
    = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
 
-error[E0004]: non-exhaustive patterns: `&[]` not covered
+error[E0004]: non-exhaustive patterns: `&[..]` not covered
   --> $DIR/match-byte-array-patterns-2.rs:10:11
    |
 LL |     match buf {
-   |           ^^^ pattern `&[]` not covered
+   |           ^^^ pattern `&[..]` not covered
    |
    = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
 
diff --git a/src/test/ui/pattern/usefulness/non-exhaustive-match.rs b/src/test/ui/pattern/usefulness/non-exhaustive-match.rs
index 0e5a9203c5f..bfca5352353 100644
--- a/src/test/ui/pattern/usefulness/non-exhaustive-match.rs
+++ b/src/test/ui/pattern/usefulness/non-exhaustive-match.rs
@@ -44,7 +44,7 @@ fn main() {
     }
     let vec = vec![0.5f32];
     let vec: &[f32] = &vec;
-    match *vec { //~ ERROR non-exhaustive patterns: `[_, _, _, _]` not covered
+    match *vec { //~ ERROR non-exhaustive patterns: `[_, _, _, _, ..]` not covered
         [0.1, 0.2, 0.3] => (),
         [0.1, 0.2] => (),
         [0.1] => (),
diff --git a/src/test/ui/pattern/usefulness/non-exhaustive-match.stderr b/src/test/ui/pattern/usefulness/non-exhaustive-match.stderr
index 5dba05e1642..577867e4e71 100644
--- a/src/test/ui/pattern/usefulness/non-exhaustive-match.stderr
+++ b/src/test/ui/pattern/usefulness/non-exhaustive-match.stderr
@@ -66,11 +66,11 @@ LL |     match *vec {
    |
    = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
 
-error[E0004]: non-exhaustive patterns: `[_, _, _, _]` not covered
+error[E0004]: non-exhaustive patterns: `[_, _, _, _, ..]` not covered
   --> $DIR/non-exhaustive-match.rs:47:11
    |
 LL |     match *vec {
-   |           ^^^^ pattern `[_, _, _, _]` not covered
+   |           ^^^^ pattern `[_, _, _, _, ..]` not covered
    |
    = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
 
diff --git a/src/test/ui/pattern/usefulness/slice-patterns.rs b/src/test/ui/pattern/usefulness/slice-patterns.rs
index 0493646ff3b..97086c4d75d 100644
--- a/src/test/ui/pattern/usefulness/slice-patterns.rs
+++ b/src/test/ui/pattern/usefulness/slice-patterns.rs
@@ -48,11 +48,11 @@ fn main() {
         [true, .., true] => {}
     }
     match s {
-    //~^ ERROR `&[_]` not covered
+    //~^ ERROR `&[_, ..]` not covered
         [] => {}
     }
     match s {
-    //~^ ERROR `&[_, _]` not covered
+    //~^ ERROR `&[_, _, ..]` not covered
         [] => {}
         [_] => {}
     }
diff --git a/src/test/ui/pattern/usefulness/slice-patterns.stderr b/src/test/ui/pattern/usefulness/slice-patterns.stderr
index 18c73330fcd..3cea068543e 100644
--- a/src/test/ui/pattern/usefulness/slice-patterns.stderr
+++ b/src/test/ui/pattern/usefulness/slice-patterns.stderr
@@ -30,19 +30,19 @@ LL |     match s3 {
    |
    = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
 
-error[E0004]: non-exhaustive patterns: `&[_]` not covered
+error[E0004]: non-exhaustive patterns: `&[_, ..]` not covered
   --> $DIR/slice-patterns.rs:50:11
    |
 LL |     match s {
-   |           ^ pattern `&[_]` not covered
+   |           ^ pattern `&[_, ..]` not covered
    |
    = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
 
-error[E0004]: non-exhaustive patterns: `&[_, _]` not covered
+error[E0004]: non-exhaustive patterns: `&[_, _, ..]` not covered
   --> $DIR/slice-patterns.rs:54:11
    |
 LL |     match s {
-   |           ^ pattern `&[_, _]` not covered
+   |           ^ pattern `&[_, _, ..]` not covered
    |
    = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms