about summary refs log tree commit diff
path: root/tests/ui/pattern/usefulness
diff options
context:
space:
mode:
authorSebastian Toh <sebas.tsj.98@gmail.com>2023-09-03 19:55:11 +0800
committerSebastian Toh <sebas.tsj.98@gmail.com>2023-09-03 19:55:11 +0800
commitd87b87d10e630eb0fb9cd0bf11c70ee869f077b7 (patch)
treeb0700d2294c143db74caf50f5eb27ccbaf7ee2f5 /tests/ui/pattern/usefulness
parent43dd8613a308745a9f75690bb5365f8b8ca05926 (diff)
downloadrust-d87b87d10e630eb0fb9cd0bf11c70ee869f077b7.tar.gz
rust-d87b87d10e630eb0fb9cd0bf11c70ee869f077b7.zip
Improve clarity of diagnostic message on non-exhaustive matches
Diffstat (limited to 'tests/ui/pattern/usefulness')
-rw-r--r--tests/ui/pattern/usefulness/issue-105479-str-non-exhaustiveness.rs2
-rw-r--r--tests/ui/pattern/usefulness/issue-105479-str-non-exhaustiveness.stderr2
-rw-r--r--tests/ui/pattern/usefulness/issue-30240.stderr4
-rw-r--r--tests/ui/pattern/usefulness/nested-non-exhaustive-enums.stderr2
4 files changed, 5 insertions, 5 deletions
diff --git a/tests/ui/pattern/usefulness/issue-105479-str-non-exhaustiveness.rs b/tests/ui/pattern/usefulness/issue-105479-str-non-exhaustiveness.rs
index faf37b07513..0ee7856c680 100644
--- a/tests/ui/pattern/usefulness/issue-105479-str-non-exhaustiveness.rs
+++ b/tests/ui/pattern/usefulness/issue-105479-str-non-exhaustiveness.rs
@@ -5,7 +5,7 @@ fn main() {
         //~^ ERROR non-exhaustive patterns: `(&_, _)` not covered [E0004]
         //~| NOTE pattern `(&_, _)` not covered
         //~| NOTE the matched value is of type `(&str, &str)`
-        //~| NOTE `str` cannot be matched exhaustively, so a wildcard `_` is necessary
+        //~| NOTE `&str` cannot be matched exhaustively, so a wildcard `_` is necessary
         ("a", "b") => {}
         ("c", "d") => {}
     }
diff --git a/tests/ui/pattern/usefulness/issue-105479-str-non-exhaustiveness.stderr b/tests/ui/pattern/usefulness/issue-105479-str-non-exhaustiveness.stderr
index 5c09b3bada6..771fc320a13 100644
--- a/tests/ui/pattern/usefulness/issue-105479-str-non-exhaustiveness.stderr
+++ b/tests/ui/pattern/usefulness/issue-105479-str-non-exhaustiveness.stderr
@@ -5,7 +5,7 @@ LL |     match (a, b) {
    |           ^^^^^^ pattern `(&_, _)` not covered
    |
    = note: the matched value is of type `(&str, &str)`
-   = note: `str` cannot be matched exhaustively, so a wildcard `_` is necessary
+   = note: `&str` cannot be matched exhaustively, so a wildcard `_` is necessary
 help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
    |
 LL ~         ("c", "d") => {},
diff --git a/tests/ui/pattern/usefulness/issue-30240.stderr b/tests/ui/pattern/usefulness/issue-30240.stderr
index 736ab34e164..da8bbdffbf6 100644
--- a/tests/ui/pattern/usefulness/issue-30240.stderr
+++ b/tests/ui/pattern/usefulness/issue-30240.stderr
@@ -5,7 +5,7 @@ LL |     match "world" {
    |           ^^^^^^^ pattern `&_` not covered
    |
    = note: the matched value is of type `&str`
-   = note: `str` cannot be matched exhaustively, so a wildcard `_` is necessary
+   = note: `&str` cannot be matched exhaustively, so a wildcard `_` is necessary
 help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
    |
 LL ~         "hello" => {},
@@ -19,7 +19,7 @@ LL |     match "world" {
    |           ^^^^^^^ pattern `&_` not covered
    |
    = note: the matched value is of type `&str`
-   = note: `str` cannot be matched exhaustively, so a wildcard `_` is necessary
+   = note: `&str` cannot be matched exhaustively, so a wildcard `_` is necessary
 help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
    |
 LL ~         "hello" => {},
diff --git a/tests/ui/pattern/usefulness/nested-non-exhaustive-enums.stderr b/tests/ui/pattern/usefulness/nested-non-exhaustive-enums.stderr
index ae81f307fde..9fbd871db7c 100644
--- a/tests/ui/pattern/usefulness/nested-non-exhaustive-enums.stderr
+++ b/tests/ui/pattern/usefulness/nested-non-exhaustive-enums.stderr
@@ -10,7 +10,7 @@ note: `Option<NonExhaustiveEnum>` defined here
    |
    = note: not covered
    = note: the matched value is of type `Option<NonExhaustiveEnum>`
-   = note: `NonExhaustiveEnum` is marked as non-exhaustive
+   = note: `NonExhaustiveEnum` is marked as non-exhaustive, so a wildcard `_` is necessary to match exhaustively
 help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
    |
 LL ~         None => {},