about summary refs log tree commit diff
path: root/tests/ui/pattern
diff options
context:
space:
mode:
authorNadrieril <nadrieril+git@gmail.com>2024-07-21 14:46:05 +0200
committerNadrieril <nadrieril+git@gmail.com>2024-07-24 08:02:55 +0200
commit64ac2b80822c33d69e6e61ea1eaf8a043bc35aad (patch)
treeb36de43b0fe67b8728eba2eb07095c4dbf4a12ec /tests/ui/pattern
parentc4d6a4a7e4d8d006f6d08345e91fb1cdf0fc7e7a (diff)
downloadrust-64ac2b80822c33d69e6e61ea1eaf8a043bc35aad.tar.gz
rust-64ac2b80822c33d69e6e61ea1eaf8a043bc35aad.zip
Explain why a given pattern is considered unreachable
Diffstat (limited to 'tests/ui/pattern')
-rw-r--r--tests/ui/pattern/usefulness/consts-opaque.stderr14
-rw-r--r--tests/ui/pattern/usefulness/empty-match-check-notes.exhaustive_patterns.stderr17
-rw-r--r--tests/ui/pattern/usefulness/empty-match-check-notes.normal.stderr17
-rw-r--r--tests/ui/pattern/usefulness/empty-match-check-notes.rs4
-rw-r--r--tests/ui/pattern/usefulness/empty-types.exhaustive_patterns.stderr87
-rw-r--r--tests/ui/pattern/usefulness/empty-types.min_exh_pats.stderr87
-rw-r--r--tests/ui/pattern/usefulness/empty-types.never_pats.stderr33
-rw-r--r--tests/ui/pattern/usefulness/empty-types.normal.stderr33
-rw-r--r--tests/ui/pattern/usefulness/explain-unreachable-pats.rs97
-rw-r--r--tests/ui/pattern/usefulness/explain-unreachable-pats.stderr92
-rw-r--r--tests/ui/pattern/usefulness/floats.stderr68
-rw-r--r--tests/ui/pattern/usefulness/impl-trait.stderr27
-rw-r--r--tests/ui/pattern/usefulness/integer-ranges/reachability.stderr119
-rw-r--r--tests/ui/pattern/usefulness/issue-12116.stderr4
-rw-r--r--tests/ui/pattern/usefulness/issue-12369.stderr6
-rw-r--r--tests/ui/pattern/usefulness/issue-13727.stderr4
-rw-r--r--tests/ui/pattern/usefulness/issue-30240-b.stderr4
-rw-r--r--tests/ui/pattern/usefulness/issue-31221.stderr4
-rw-r--r--tests/ui/pattern/usefulness/issue-57472.stderr8
-rw-r--r--tests/ui/pattern/usefulness/match-arm-statics.stderr18
-rw-r--r--tests/ui/pattern/usefulness/match-byte-array-patterns.stderr32
-rw-r--r--tests/ui/pattern/usefulness/match-ref-ice.stderr4
-rw-r--r--tests/ui/pattern/usefulness/match-vec-fixed.stderr8
-rw-r--r--tests/ui/pattern/usefulness/match-vec-unreachable.stderr12
-rw-r--r--tests/ui/pattern/usefulness/slice-pattern-const-2.stderr17
-rw-r--r--tests/ui/pattern/usefulness/slice-pattern-const-3.stderr17
-rw-r--r--tests/ui/pattern/usefulness/slice-pattern-const.stderr39
-rw-r--r--tests/ui/pattern/usefulness/slice-patterns-reachability.stderr27
-rw-r--r--tests/ui/pattern/usefulness/top-level-alternation.stderr47
29 files changed, 824 insertions, 122 deletions
diff --git a/tests/ui/pattern/usefulness/consts-opaque.stderr b/tests/ui/pattern/usefulness/consts-opaque.stderr
index d057309e420..fdec3683c4a 100644
--- a/tests/ui/pattern/usefulness/consts-opaque.stderr
+++ b/tests/ui/pattern/usefulness/consts-opaque.stderr
@@ -106,20 +106,28 @@ LL |         _ => {} // should not be emitting unreachable warning
 error: unreachable pattern
   --> $DIR/consts-opaque.rs:72:9
    |
+LL |         BAZ => {}
+   |         --- matches all the values already
 LL |         Baz::Baz1 => {} // should not be emitting unreachable warning
-   |         ^^^^^^^^^
+   |         ^^^^^^^^^ unreachable pattern
 
 error: unreachable pattern
   --> $DIR/consts-opaque.rs:79:9
    |
+LL |         Baz::Baz1 => {}
+   |         --------- matches all the values already
 LL |         BAZ => {}
-   |         ^^^
+   |         ^^^ unreachable pattern
 
 error: unreachable pattern
   --> $DIR/consts-opaque.rs:87:9
    |
+LL |         BAZ => {}
+   |         --- matches some of the same values
+LL |         Baz::Baz2 => {}
+   |         --------- matches some of the same values
 LL |         _ => {} // should not be emitting unreachable warning
-   |         ^
+   |         ^ unreachable pattern
 
 error: aborting due to 17 previous errors
 
diff --git a/tests/ui/pattern/usefulness/empty-match-check-notes.exhaustive_patterns.stderr b/tests/ui/pattern/usefulness/empty-match-check-notes.exhaustive_patterns.stderr
index 4c434192431..9e700ee55ef 100644
--- a/tests/ui/pattern/usefulness/empty-match-check-notes.exhaustive_patterns.stderr
+++ b/tests/ui/pattern/usefulness/empty-match-check-notes.exhaustive_patterns.stderr
@@ -4,6 +4,7 @@ error: unreachable pattern
 LL |         _ => {}
    |         ^
    |
+   = note: this pattern matches no values because `EmptyEnum` is uninhabited
 note: the lint level is defined here
   --> $DIR/empty-match-check-notes.rs:7:9
    |
@@ -11,25 +12,31 @@ LL | #![deny(unreachable_patterns)]
    |         ^^^^^^^^^^^^^^^^^^^^
 
 error: unreachable pattern
-  --> $DIR/empty-match-check-notes.rs:20:9
+  --> $DIR/empty-match-check-notes.rs:21:9
    |
 LL |         _ if false => {}
    |         ^
+   |
+   = note: this pattern matches no values because `EmptyEnum` is uninhabited
 
 error: unreachable pattern
-  --> $DIR/empty-match-check-notes.rs:27:9
+  --> $DIR/empty-match-check-notes.rs:29:9
    |
 LL |         _ => {}
    |         ^
+   |
+   = note: this pattern matches no values because `EmptyForeignEnum` is uninhabited
 
 error: unreachable pattern
-  --> $DIR/empty-match-check-notes.rs:30:9
+  --> $DIR/empty-match-check-notes.rs:33:9
    |
 LL |         _ if false => {}
    |         ^
+   |
+   = note: this pattern matches no values because `EmptyForeignEnum` is uninhabited
 
 error[E0005]: refutable pattern in local binding
-  --> $DIR/empty-match-check-notes.rs:35:9
+  --> $DIR/empty-match-check-notes.rs:39:9
    |
 LL |     let None = x;
    |         ^^^^ pattern `Some(_)` not covered
@@ -44,7 +51,7 @@ LL |     if let None = x { todo!() };
    |     ++              +++++++++++
 
 error[E0004]: non-exhaustive patterns: `0_u8..=u8::MAX` not covered
-  --> $DIR/empty-match-check-notes.rs:45:11
+  --> $DIR/empty-match-check-notes.rs:49:11
    |
 LL |     match 0u8 {
    |           ^^^ pattern `0_u8..=u8::MAX` not covered
diff --git a/tests/ui/pattern/usefulness/empty-match-check-notes.normal.stderr b/tests/ui/pattern/usefulness/empty-match-check-notes.normal.stderr
index 45f715dc7b2..480ae7095a6 100644
--- a/tests/ui/pattern/usefulness/empty-match-check-notes.normal.stderr
+++ b/tests/ui/pattern/usefulness/empty-match-check-notes.normal.stderr
@@ -4,6 +4,7 @@ error: unreachable pattern
 LL |         _ => {}
    |         ^
    |
+   = note: this pattern matches no values because `EmptyEnum` is uninhabited
 note: the lint level is defined here
   --> $DIR/empty-match-check-notes.rs:7:9
    |
@@ -11,25 +12,31 @@ LL | #![deny(unreachable_patterns)]
    |         ^^^^^^^^^^^^^^^^^^^^
 
 error: unreachable pattern
-  --> $DIR/empty-match-check-notes.rs:20:9
+  --> $DIR/empty-match-check-notes.rs:21:9
    |
 LL |         _ if false => {}
    |         ^
+   |
+   = note: this pattern matches no values because `EmptyEnum` is uninhabited
 
 error: unreachable pattern
-  --> $DIR/empty-match-check-notes.rs:27:9
+  --> $DIR/empty-match-check-notes.rs:29:9
    |
 LL |         _ => {}
    |         ^
+   |
+   = note: this pattern matches no values because `EmptyForeignEnum` is uninhabited
 
 error: unreachable pattern
-  --> $DIR/empty-match-check-notes.rs:30:9
+  --> $DIR/empty-match-check-notes.rs:33:9
    |
 LL |         _ if false => {}
    |         ^
+   |
+   = note: this pattern matches no values because `EmptyForeignEnum` is uninhabited
 
 error[E0005]: refutable pattern in local binding
-  --> $DIR/empty-match-check-notes.rs:35:9
+  --> $DIR/empty-match-check-notes.rs:39:9
    |
 LL |     let None = x;
    |         ^^^^ pattern `Some(_)` not covered
@@ -43,7 +50,7 @@ LL |     if let None = x { todo!() };
    |     ++              +++++++++++
 
 error[E0004]: non-exhaustive patterns: `0_u8..=u8::MAX` not covered
-  --> $DIR/empty-match-check-notes.rs:45:11
+  --> $DIR/empty-match-check-notes.rs:49:11
    |
 LL |     match 0u8 {
    |           ^^^ pattern `0_u8..=u8::MAX` not covered
diff --git a/tests/ui/pattern/usefulness/empty-match-check-notes.rs b/tests/ui/pattern/usefulness/empty-match-check-notes.rs
index ea797bc7dd5..2eef283a21e 100644
--- a/tests/ui/pattern/usefulness/empty-match-check-notes.rs
+++ b/tests/ui/pattern/usefulness/empty-match-check-notes.rs
@@ -15,9 +15,11 @@ fn empty_enum(x: EmptyEnum) {
     match x {} // ok
     match x {
         _ => {} //~ ERROR unreachable pattern
+                //~^ NOTE matches no values
     }
     match x {
         _ if false => {} //~ ERROR unreachable pattern
+                         //~^ NOTE matches no values
     }
 }
 
@@ -25,9 +27,11 @@ fn empty_foreign_enum(x: empty::EmptyForeignEnum) {
     match x {} // ok
     match x {
         _ => {} //~ ERROR unreachable pattern
+                //~^ NOTE matches no values
     }
     match x {
         _ if false => {} //~ ERROR unreachable pattern
+                         //~^ NOTE matches no values
     }
 }
 
diff --git a/tests/ui/pattern/usefulness/empty-types.exhaustive_patterns.stderr b/tests/ui/pattern/usefulness/empty-types.exhaustive_patterns.stderr
index 45bdba94d78..416a50b87b5 100644
--- a/tests/ui/pattern/usefulness/empty-types.exhaustive_patterns.stderr
+++ b/tests/ui/pattern/usefulness/empty-types.exhaustive_patterns.stderr
@@ -4,6 +4,7 @@ error: unreachable pattern
 LL |         _ => {}
    |         ^
    |
+   = note: this pattern matches no values because `!` is uninhabited
 note: the lint level is defined here
   --> $DIR/empty-types.rs:17:9
    |
@@ -15,6 +16,8 @@ error: unreachable pattern
    |
 LL |         _x => {}
    |         ^^
+   |
+   = note: this pattern matches no values because `!` is uninhabited
 
 error[E0004]: non-exhaustive patterns: type `&!` is non-empty
   --> $DIR/empty-types.rs:58:11
@@ -36,24 +39,32 @@ error: unreachable pattern
    |
 LL |         (_, _) => {}
    |         ^^^^^^
+   |
+   = note: this pattern matches no values because `(u32, !)` is uninhabited
 
 error: unreachable pattern
   --> $DIR/empty-types.rs:80:9
    |
 LL |         _ => {}
    |         ^
+   |
+   = note: this pattern matches no values because `(!, !)` is uninhabited
 
 error: unreachable pattern
   --> $DIR/empty-types.rs:83:9
    |
 LL |         (_, _) => {}
    |         ^^^^^^
+   |
+   = note: this pattern matches no values because `(!, !)` is uninhabited
 
 error: unreachable pattern
   --> $DIR/empty-types.rs:87:9
    |
 LL |         _ => {}
    |         ^
+   |
+   = note: this pattern matches no values because `!` is uninhabited
 
 error[E0004]: non-exhaustive patterns: `Ok(_)` not covered
   --> $DIR/empty-types.rs:91:11
@@ -79,12 +90,16 @@ error: unreachable pattern
    |
 LL |         Err(_) => {}
    |         ^^^^^^
+   |
+   = note: this pattern matches no values because `!` is uninhabited
 
 error: unreachable pattern
   --> $DIR/empty-types.rs:104:9
    |
 LL |         Err(_) => {}
    |         ^^^^^^
+   |
+   = note: this pattern matches no values because `!` is uninhabited
 
 error[E0004]: non-exhaustive patterns: `Ok(1_u32..=u32::MAX)` not covered
   --> $DIR/empty-types.rs:101:11
@@ -123,114 +138,152 @@ error: unreachable pattern
    |
 LL |         _ => {}
    |         ^
+   |
+   = note: this pattern matches no values because `Result<!, !>` is uninhabited
 
 error: unreachable pattern
   --> $DIR/empty-types.rs:123:9
    |
 LL |         Ok(_) => {}
    |         ^^^^^
+   |
+   = note: this pattern matches no values because `Result<!, !>` is uninhabited
 
 error: unreachable pattern
   --> $DIR/empty-types.rs:126:9
    |
 LL |         Ok(_) => {}
    |         ^^^^^
+   |
+   = note: this pattern matches no values because `Result<!, !>` is uninhabited
 
 error: unreachable pattern
   --> $DIR/empty-types.rs:127:9
    |
 LL |         _ => {}
    |         ^
+   |
+   = note: this pattern matches no values because `Result<!, !>` is uninhabited
 
 error: unreachable pattern
   --> $DIR/empty-types.rs:130:9
    |
 LL |         Ok(_) => {}
    |         ^^^^^
+   |
+   = note: this pattern matches no values because `Result<!, !>` is uninhabited
 
 error: unreachable pattern
   --> $DIR/empty-types.rs:131:9
    |
 LL |         Err(_) => {}
    |         ^^^^^^
+   |
+   = note: this pattern matches no values because `Result<!, !>` is uninhabited
 
 error: unreachable pattern
   --> $DIR/empty-types.rs:140:13
    |
 LL |             _ => {}
    |             ^
+   |
+   = note: this pattern matches no values because `Void` is uninhabited
 
 error: unreachable pattern
   --> $DIR/empty-types.rs:143:13
    |
 LL |             _ if false => {}
    |             ^
+   |
+   = note: this pattern matches no values because `Void` is uninhabited
 
 error: unreachable pattern
   --> $DIR/empty-types.rs:152:13
    |
 LL |             Some(_) => {}
    |             ^^^^^^^
+   |
+   = note: this pattern matches no values because `Void` is uninhabited
 
 error: unreachable pattern
   --> $DIR/empty-types.rs:156:13
    |
+LL |             None => {}
+   |             ---- matches all the values already
 LL |             _ => {}
-   |             ^
+   |             ^ unreachable pattern
 
 error: unreachable pattern
   --> $DIR/empty-types.rs:208:13
    |
 LL |             _ => {}
    |             ^
+   |
+   = note: this pattern matches no values because `!` is uninhabited
 
 error: unreachable pattern
   --> $DIR/empty-types.rs:213:13
    |
 LL |             _ => {}
    |             ^
+   |
+   = note: this pattern matches no values because `!` is uninhabited
 
 error: unreachable pattern
   --> $DIR/empty-types.rs:218:13
    |
 LL |             _ => {}
    |             ^
+   |
+   = note: this pattern matches no values because `!` is uninhabited
 
 error: unreachable pattern
   --> $DIR/empty-types.rs:223:13
    |
 LL |             _ => {}
    |             ^
+   |
+   = note: this pattern matches no values because `!` is uninhabited
 
 error: unreachable pattern
   --> $DIR/empty-types.rs:229:13
    |
 LL |             _ => {}
    |             ^
+   |
+   = note: this pattern matches no values because `!` is uninhabited
 
 error: unreachable pattern
   --> $DIR/empty-types.rs:288:9
    |
 LL |         _ => {}
    |         ^
+   |
+   = note: this pattern matches no values because `!` is uninhabited
 
 error: unreachable pattern
   --> $DIR/empty-types.rs:291:9
    |
 LL |         (_, _) => {}
    |         ^^^^^^
+   |
+   = note: this pattern matches no values because `(!, !)` is uninhabited
 
 error: unreachable pattern
   --> $DIR/empty-types.rs:294:9
    |
 LL |         Ok(_) => {}
    |         ^^^^^
+   |
+   = note: this pattern matches no values because `Result<!, !>` is uninhabited
 
 error: unreachable pattern
   --> $DIR/empty-types.rs:295:9
    |
 LL |         Err(_) => {}
    |         ^^^^^^
+   |
+   = note: this pattern matches no values because `Result<!, !>` is uninhabited
 
 error[E0004]: non-exhaustive patterns: type `&[!]` is non-empty
   --> $DIR/empty-types.rs:327:11
@@ -292,18 +345,24 @@ error: unreachable pattern
    |
 LL |         _ => {}
    |         ^
+   |
+   = note: this pattern matches no values because `[!; 3]` is uninhabited
 
 error: unreachable pattern
   --> $DIR/empty-types.rs:372:9
    |
 LL |         [_, _, _] => {}
    |         ^^^^^^^^^
+   |
+   = note: this pattern matches no values because `[!; 3]` is uninhabited
 
 error: unreachable pattern
   --> $DIR/empty-types.rs:375:9
    |
 LL |         [_, ..] => {}
    |         ^^^^^^^
+   |
+   = note: this pattern matches no values because `[!; 3]` is uninhabited
 
 error[E0004]: non-exhaustive patterns: type `[!; 0]` is non-empty
   --> $DIR/empty-types.rs:389:11
@@ -322,8 +381,10 @@ LL +     }
 error: unreachable pattern
   --> $DIR/empty-types.rs:396:9
    |
+LL |         [] => {}
+   |         -- matches all the values already
 LL |         _ => {}
-   |         ^
+   |         ^ unreachable pattern
 
 error[E0004]: non-exhaustive patterns: `[]` not covered
   --> $DIR/empty-types.rs:398:11
@@ -344,48 +405,66 @@ error: unreachable pattern
    |
 LL |         Some(_) => {}
    |         ^^^^^^^
+   |
+   = note: this pattern matches no values because `!` is uninhabited
 
 error: unreachable pattern
   --> $DIR/empty-types.rs:422:9
    |
 LL |         Some(_a) => {}
    |         ^^^^^^^^
+   |
+   = note: this pattern matches no values because `!` is uninhabited
 
 error: unreachable pattern
   --> $DIR/empty-types.rs:427:9
    |
+LL |         None => {}
+   |         ---- matches all the values already
+LL |         // !useful, !reachable
 LL |         _ => {}
-   |         ^
+   |         ^ unreachable pattern
 
 error: unreachable pattern
   --> $DIR/empty-types.rs:432:9
    |
+LL |         None => {}
+   |         ---- matches all the values already
+LL |         // !useful, !reachable
 LL |         _a => {}
-   |         ^^
+   |         ^^ unreachable pattern
 
 error: unreachable pattern
   --> $DIR/empty-types.rs:604:9
    |
 LL |         _ => {}
    |         ^
+   |
+   = note: this pattern matches no values because `!` is uninhabited
 
 error: unreachable pattern
   --> $DIR/empty-types.rs:607:9
    |
 LL |         _x => {}
    |         ^^
+   |
+   = note: this pattern matches no values because `!` is uninhabited
 
 error: unreachable pattern
   --> $DIR/empty-types.rs:610:9
    |
 LL |         _ if false => {}
    |         ^
+   |
+   = note: this pattern matches no values because `!` is uninhabited
 
 error: unreachable pattern
   --> $DIR/empty-types.rs:613:9
    |
 LL |         _x if false => {}
    |         ^^
+   |
+   = note: this pattern matches no values because `!` is uninhabited
 
 error: aborting due to 49 previous errors
 
diff --git a/tests/ui/pattern/usefulness/empty-types.min_exh_pats.stderr b/tests/ui/pattern/usefulness/empty-types.min_exh_pats.stderr
index 9b57c895eea..2e5511527d5 100644
--- a/tests/ui/pattern/usefulness/empty-types.min_exh_pats.stderr
+++ b/tests/ui/pattern/usefulness/empty-types.min_exh_pats.stderr
@@ -4,6 +4,7 @@ error: unreachable pattern
 LL |         _ => {}
    |         ^
    |
+   = note: this pattern matches no values because `!` is uninhabited
 note: the lint level is defined here
   --> $DIR/empty-types.rs:17:9
    |
@@ -15,6 +16,8 @@ error: unreachable pattern
    |
 LL |         _x => {}
    |         ^^
+   |
+   = note: this pattern matches no values because `!` is uninhabited
 
 error[E0004]: non-exhaustive patterns: type `&!` is non-empty
   --> $DIR/empty-types.rs:58:11
@@ -36,24 +39,32 @@ error: unreachable pattern
    |
 LL |         (_, _) => {}
    |         ^^^^^^
+   |
+   = note: this pattern matches no values because `(u32, !)` is uninhabited
 
 error: unreachable pattern
   --> $DIR/empty-types.rs:80:9
    |
 LL |         _ => {}
    |         ^
+   |
+   = note: this pattern matches no values because `(!, !)` is uninhabited
 
 error: unreachable pattern
   --> $DIR/empty-types.rs:83:9
    |
 LL |         (_, _) => {}
    |         ^^^^^^
+   |
+   = note: this pattern matches no values because `(!, !)` is uninhabited
 
 error: unreachable pattern
   --> $DIR/empty-types.rs:87:9
    |
 LL |         _ => {}
    |         ^
+   |
+   = note: this pattern matches no values because `!` is uninhabited
 
 error[E0004]: non-exhaustive patterns: `Ok(_)` not covered
   --> $DIR/empty-types.rs:91:11
@@ -79,12 +90,16 @@ error: unreachable pattern
    |
 LL |         Err(_) => {}
    |         ^^^^^^
+   |
+   = note: this pattern matches no values because `!` is uninhabited
 
 error: unreachable pattern
   --> $DIR/empty-types.rs:104:9
    |
 LL |         Err(_) => {}
    |         ^^^^^^
+   |
+   = note: this pattern matches no values because `!` is uninhabited
 
 error[E0004]: non-exhaustive patterns: `Ok(1_u32..=u32::MAX)` not covered
   --> $DIR/empty-types.rs:101:11
@@ -137,60 +152,80 @@ error: unreachable pattern
    |
 LL |         _ => {}
    |         ^
+   |
+   = note: this pattern matches no values because `Result<!, !>` is uninhabited
 
 error: unreachable pattern
   --> $DIR/empty-types.rs:123:9
    |
 LL |         Ok(_) => {}
    |         ^^^^^
+   |
+   = note: this pattern matches no values because `Result<!, !>` is uninhabited
 
 error: unreachable pattern
   --> $DIR/empty-types.rs:126:9
    |
 LL |         Ok(_) => {}
    |         ^^^^^
+   |
+   = note: this pattern matches no values because `Result<!, !>` is uninhabited
 
 error: unreachable pattern
   --> $DIR/empty-types.rs:127:9
    |
 LL |         _ => {}
    |         ^
+   |
+   = note: this pattern matches no values because `Result<!, !>` is uninhabited
 
 error: unreachable pattern
   --> $DIR/empty-types.rs:130:9
    |
 LL |         Ok(_) => {}
    |         ^^^^^
+   |
+   = note: this pattern matches no values because `Result<!, !>` is uninhabited
 
 error: unreachable pattern
   --> $DIR/empty-types.rs:131:9
    |
 LL |         Err(_) => {}
    |         ^^^^^^
+   |
+   = note: this pattern matches no values because `Result<!, !>` is uninhabited
 
 error: unreachable pattern
   --> $DIR/empty-types.rs:140:13
    |
 LL |             _ => {}
    |             ^
+   |
+   = note: this pattern matches no values because `Void` is uninhabited
 
 error: unreachable pattern
   --> $DIR/empty-types.rs:143:13
    |
 LL |             _ if false => {}
    |             ^
+   |
+   = note: this pattern matches no values because `Void` is uninhabited
 
 error: unreachable pattern
   --> $DIR/empty-types.rs:152:13
    |
 LL |             Some(_) => {}
    |             ^^^^^^^
+   |
+   = note: this pattern matches no values because `Void` is uninhabited
 
 error: unreachable pattern
   --> $DIR/empty-types.rs:156:13
    |
+LL |             None => {}
+   |             ---- matches all the values already
 LL |             _ => {}
-   |             ^
+   |             ^ unreachable pattern
 
 error[E0004]: non-exhaustive patterns: `Some(_)` not covered
   --> $DIR/empty-types.rs:165:15
@@ -216,54 +251,72 @@ error: unreachable pattern
    |
 LL |             _ => {}
    |             ^
+   |
+   = note: this pattern matches no values because `!` is uninhabited
 
 error: unreachable pattern
   --> $DIR/empty-types.rs:213:13
    |
 LL |             _ => {}
    |             ^
+   |
+   = note: this pattern matches no values because `!` is uninhabited
 
 error: unreachable pattern
   --> $DIR/empty-types.rs:218:13
    |
 LL |             _ => {}
    |             ^
+   |
+   = note: this pattern matches no values because `!` is uninhabited
 
 error: unreachable pattern
   --> $DIR/empty-types.rs:223:13
    |
 LL |             _ => {}
    |             ^
+   |
+   = note: this pattern matches no values because `!` is uninhabited
 
 error: unreachable pattern
   --> $DIR/empty-types.rs:229:13
    |
 LL |             _ => {}
    |             ^
+   |
+   = note: this pattern matches no values because `!` is uninhabited
 
 error: unreachable pattern
   --> $DIR/empty-types.rs:288:9
    |
 LL |         _ => {}
    |         ^
+   |
+   = note: this pattern matches no values because `!` is uninhabited
 
 error: unreachable pattern
   --> $DIR/empty-types.rs:291:9
    |
 LL |         (_, _) => {}
    |         ^^^^^^
+   |
+   = note: this pattern matches no values because `(!, !)` is uninhabited
 
 error: unreachable pattern
   --> $DIR/empty-types.rs:294:9
    |
 LL |         Ok(_) => {}
    |         ^^^^^
+   |
+   = note: this pattern matches no values because `Result<!, !>` is uninhabited
 
 error: unreachable pattern
   --> $DIR/empty-types.rs:295:9
    |
 LL |         Err(_) => {}
    |         ^^^^^^
+   |
+   = note: this pattern matches no values because `Result<!, !>` is uninhabited
 
 error[E0004]: non-exhaustive patterns: type `(u32, !)` is non-empty
   --> $DIR/empty-types.rs:316:11
@@ -403,18 +456,24 @@ error: unreachable pattern
    |
 LL |         _ => {}
    |         ^
+   |
+   = note: this pattern matches no values because `[!; 3]` is uninhabited
 
 error: unreachable pattern
   --> $DIR/empty-types.rs:372:9
    |
 LL |         [_, _, _] => {}
    |         ^^^^^^^^^
+   |
+   = note: this pattern matches no values because `[!; 3]` is uninhabited
 
 error: unreachable pattern
   --> $DIR/empty-types.rs:375:9
    |
 LL |         [_, ..] => {}
    |         ^^^^^^^
+   |
+   = note: this pattern matches no values because `[!; 3]` is uninhabited
 
 error[E0004]: non-exhaustive patterns: type `[!; 0]` is non-empty
   --> $DIR/empty-types.rs:389:11
@@ -433,8 +492,10 @@ LL +     }
 error: unreachable pattern
   --> $DIR/empty-types.rs:396:9
    |
+LL |         [] => {}
+   |         -- matches all the values already
 LL |         _ => {}
-   |         ^
+   |         ^ unreachable pattern
 
 error[E0004]: non-exhaustive patterns: `[]` not covered
   --> $DIR/empty-types.rs:398:11
@@ -455,24 +516,34 @@ error: unreachable pattern
    |
 LL |         Some(_) => {}
    |         ^^^^^^^
+   |
+   = note: this pattern matches no values because `!` is uninhabited
 
 error: unreachable pattern
   --> $DIR/empty-types.rs:422:9
    |
 LL |         Some(_a) => {}
    |         ^^^^^^^^
+   |
+   = note: this pattern matches no values because `!` is uninhabited
 
 error: unreachable pattern
   --> $DIR/empty-types.rs:427:9
    |
+LL |         None => {}
+   |         ---- matches all the values already
+LL |         // !useful, !reachable
 LL |         _ => {}
-   |         ^
+   |         ^ unreachable pattern
 
 error: unreachable pattern
   --> $DIR/empty-types.rs:432:9
    |
+LL |         None => {}
+   |         ---- matches all the values already
+LL |         // !useful, !reachable
 LL |         _a => {}
-   |         ^^
+   |         ^^ unreachable pattern
 
 error[E0004]: non-exhaustive patterns: `&Some(_)` not covered
   --> $DIR/empty-types.rs:452:11
@@ -569,24 +640,32 @@ error: unreachable pattern
    |
 LL |         _ => {}
    |         ^
+   |
+   = note: this pattern matches no values because `!` is uninhabited
 
 error: unreachable pattern
   --> $DIR/empty-types.rs:607:9
    |
 LL |         _x => {}
    |         ^^
+   |
+   = note: this pattern matches no values because `!` is uninhabited
 
 error: unreachable pattern
   --> $DIR/empty-types.rs:610:9
    |
 LL |         _ if false => {}
    |         ^
+   |
+   = note: this pattern matches no values because `!` is uninhabited
 
 error: unreachable pattern
   --> $DIR/empty-types.rs:613:9
    |
 LL |         _x if false => {}
    |         ^^
+   |
+   = note: this pattern matches no values because `!` is uninhabited
 
 error[E0004]: non-exhaustive patterns: `&_` not covered
   --> $DIR/empty-types.rs:638:11
diff --git a/tests/ui/pattern/usefulness/empty-types.never_pats.stderr b/tests/ui/pattern/usefulness/empty-types.never_pats.stderr
index 0ff2472922e..4856a2f8e08 100644
--- a/tests/ui/pattern/usefulness/empty-types.never_pats.stderr
+++ b/tests/ui/pattern/usefulness/empty-types.never_pats.stderr
@@ -13,6 +13,7 @@ error: unreachable pattern
 LL |         _ => {}
    |         ^
    |
+   = note: this pattern matches no values because `!` is uninhabited
 note: the lint level is defined here
   --> $DIR/empty-types.rs:17:9
    |
@@ -24,6 +25,8 @@ error: unreachable pattern
    |
 LL |         _x => {}
    |         ^^
+   |
+   = note: this pattern matches no values because `!` is uninhabited
 
 error[E0004]: non-exhaustive patterns: type `&!` is non-empty
   --> $DIR/empty-types.rs:58:11
@@ -73,6 +76,8 @@ error: unreachable pattern
    |
 LL |         _ => {}
    |         ^
+   |
+   = note: this pattern matches no values because `!` is uninhabited
 
 error[E0004]: non-exhaustive patterns: `Ok(_)` and `Err(!)` not covered
   --> $DIR/empty-types.rs:91:11
@@ -218,12 +223,16 @@ error: unreachable pattern
    |
 LL |             _ => {}
    |             ^
+   |
+   = note: this pattern matches no values because `Void` is uninhabited
 
 error: unreachable pattern
   --> $DIR/empty-types.rs:143:13
    |
 LL |             _ if false => {}
    |             ^
+   |
+   = note: this pattern matches no values because `Void` is uninhabited
 
 error[E0004]: non-exhaustive patterns: `Some(!)` not covered
   --> $DIR/empty-types.rs:146:15
@@ -266,36 +275,48 @@ error: unreachable pattern
    |
 LL |             _ => {}
    |             ^
+   |
+   = note: this pattern matches no values because `!` is uninhabited
 
 error: unreachable pattern
   --> $DIR/empty-types.rs:213:13
    |
 LL |             _ => {}
    |             ^
+   |
+   = note: this pattern matches no values because `!` is uninhabited
 
 error: unreachable pattern
   --> $DIR/empty-types.rs:218:13
    |
 LL |             _ => {}
    |             ^
+   |
+   = note: this pattern matches no values because `!` is uninhabited
 
 error: unreachable pattern
   --> $DIR/empty-types.rs:223:13
    |
 LL |             _ => {}
    |             ^
+   |
+   = note: this pattern matches no values because `!` is uninhabited
 
 error: unreachable pattern
   --> $DIR/empty-types.rs:229:13
    |
 LL |             _ => {}
    |             ^
+   |
+   = note: this pattern matches no values because `!` is uninhabited
 
 error: unreachable pattern
   --> $DIR/empty-types.rs:288:9
    |
 LL |         _ => {}
    |         ^
+   |
+   = note: this pattern matches no values because `!` is uninhabited
 
 error[E0004]: non-exhaustive patterns: type `(u32, !)` is non-empty
   --> $DIR/empty-types.rs:316:11
@@ -460,8 +481,10 @@ LL +     }
 error: unreachable pattern
   --> $DIR/empty-types.rs:396:9
    |
+LL |         [] => {}
+   |         -- matches all the values already
 LL |         _ => {}
-   |         ^
+   |         ^ unreachable pattern
 
 error[E0004]: non-exhaustive patterns: `[]` not covered
   --> $DIR/empty-types.rs:398:11
@@ -568,24 +591,32 @@ error: unreachable pattern
    |
 LL |         _ => {}
    |         ^
+   |
+   = note: this pattern matches no values because `!` is uninhabited
 
 error: unreachable pattern
   --> $DIR/empty-types.rs:607:9
    |
 LL |         _x => {}
    |         ^^
+   |
+   = note: this pattern matches no values because `!` is uninhabited
 
 error: unreachable pattern
   --> $DIR/empty-types.rs:610:9
    |
 LL |         _ if false => {}
    |         ^
+   |
+   = note: this pattern matches no values because `!` is uninhabited
 
 error: unreachable pattern
   --> $DIR/empty-types.rs:613:9
    |
 LL |         _x if false => {}
    |         ^^
+   |
+   = note: this pattern matches no values because `!` is uninhabited
 
 error[E0004]: non-exhaustive patterns: `&!` not covered
   --> $DIR/empty-types.rs:638:11
diff --git a/tests/ui/pattern/usefulness/empty-types.normal.stderr b/tests/ui/pattern/usefulness/empty-types.normal.stderr
index 1d13802a2bd..78db9ee349b 100644
--- a/tests/ui/pattern/usefulness/empty-types.normal.stderr
+++ b/tests/ui/pattern/usefulness/empty-types.normal.stderr
@@ -4,6 +4,7 @@ error: unreachable pattern
 LL |         _ => {}
    |         ^
    |
+   = note: this pattern matches no values because `!` is uninhabited
 note: the lint level is defined here
   --> $DIR/empty-types.rs:17:9
    |
@@ -15,6 +16,8 @@ error: unreachable pattern
    |
 LL |         _x => {}
    |         ^^
+   |
+   = note: this pattern matches no values because `!` is uninhabited
 
 error[E0004]: non-exhaustive patterns: type `&!` is non-empty
   --> $DIR/empty-types.rs:58:11
@@ -64,6 +67,8 @@ error: unreachable pattern
    |
 LL |         _ => {}
    |         ^
+   |
+   = note: this pattern matches no values because `!` is uninhabited
 
 error[E0004]: non-exhaustive patterns: `Ok(_)` and `Err(_)` not covered
   --> $DIR/empty-types.rs:91:11
@@ -209,12 +214,16 @@ error: unreachable pattern
    |
 LL |             _ => {}
    |             ^
+   |
+   = note: this pattern matches no values because `Void` is uninhabited
 
 error: unreachable pattern
   --> $DIR/empty-types.rs:143:13
    |
 LL |             _ if false => {}
    |             ^
+   |
+   = note: this pattern matches no values because `Void` is uninhabited
 
 error[E0004]: non-exhaustive patterns: `Some(_)` not covered
   --> $DIR/empty-types.rs:146:15
@@ -257,36 +266,48 @@ error: unreachable pattern
    |
 LL |             _ => {}
    |             ^
+   |
+   = note: this pattern matches no values because `!` is uninhabited
 
 error: unreachable pattern
   --> $DIR/empty-types.rs:213:13
    |
 LL |             _ => {}
    |             ^
+   |
+   = note: this pattern matches no values because `!` is uninhabited
 
 error: unreachable pattern
   --> $DIR/empty-types.rs:218:13
    |
 LL |             _ => {}
    |             ^
+   |
+   = note: this pattern matches no values because `!` is uninhabited
 
 error: unreachable pattern
   --> $DIR/empty-types.rs:223:13
    |
 LL |             _ => {}
    |             ^
+   |
+   = note: this pattern matches no values because `!` is uninhabited
 
 error: unreachable pattern
   --> $DIR/empty-types.rs:229:13
    |
 LL |             _ => {}
    |             ^
+   |
+   = note: this pattern matches no values because `!` is uninhabited
 
 error: unreachable pattern
   --> $DIR/empty-types.rs:288:9
    |
 LL |         _ => {}
    |         ^
+   |
+   = note: this pattern matches no values because `!` is uninhabited
 
 error[E0004]: non-exhaustive patterns: type `(u32, !)` is non-empty
   --> $DIR/empty-types.rs:316:11
@@ -451,8 +472,10 @@ LL +     }
 error: unreachable pattern
   --> $DIR/empty-types.rs:396:9
    |
+LL |         [] => {}
+   |         -- matches all the values already
 LL |         _ => {}
-   |         ^
+   |         ^ unreachable pattern
 
 error[E0004]: non-exhaustive patterns: `[]` not covered
   --> $DIR/empty-types.rs:398:11
@@ -559,24 +582,32 @@ error: unreachable pattern
    |
 LL |         _ => {}
    |         ^
+   |
+   = note: this pattern matches no values because `!` is uninhabited
 
 error: unreachable pattern
   --> $DIR/empty-types.rs:607:9
    |
 LL |         _x => {}
    |         ^^
+   |
+   = note: this pattern matches no values because `!` is uninhabited
 
 error: unreachable pattern
   --> $DIR/empty-types.rs:610:9
    |
 LL |         _ if false => {}
    |         ^
+   |
+   = note: this pattern matches no values because `!` is uninhabited
 
 error: unreachable pattern
   --> $DIR/empty-types.rs:613:9
    |
 LL |         _x if false => {}
    |         ^^
+   |
+   = note: this pattern matches no values because `!` is uninhabited
 
 error[E0004]: non-exhaustive patterns: `&_` not covered
   --> $DIR/empty-types.rs:638:11
diff --git a/tests/ui/pattern/usefulness/explain-unreachable-pats.rs b/tests/ui/pattern/usefulness/explain-unreachable-pats.rs
new file mode 100644
index 00000000000..6a27f7d4a82
--- /dev/null
+++ b/tests/ui/pattern/usefulness/explain-unreachable-pats.rs
@@ -0,0 +1,97 @@
+#![feature(never_type)]
+#![feature(min_exhaustive_patterns)]
+#![deny(unreachable_patterns)]
+//~^ NOTE lint level is defined here
+
+#[rustfmt::skip]
+fn main() {
+    match (0u8,) {
+        (1 | 2,) => {}
+        //~^ NOTE matches all the values already
+        (2,) => {}
+        //~^ ERROR unreachable pattern
+        //~| NOTE unreachable pattern
+        _ => {}
+    }
+
+    match (0u8,) {
+        (1,) => {}
+        //~^ NOTE matches some of the same values
+        (2,) => {}
+        //~^ NOTE matches some of the same values
+        (1 | 2,) => {}
+        //~^ ERROR unreachable pattern
+        //~| NOTE unreachable pattern
+        _ => {}
+    }
+
+    let res: Result<(),!> = Ok(());
+    match res {
+        Ok(_) => {}
+        Err(_) => {}
+        //~^ ERROR unreachable pattern
+        //~| NOTE this pattern matches no values because `!` is uninhabited
+    }
+
+    #[derive(Copy, Clone)]
+    enum Void1 {}
+    #[derive(Copy, Clone)]
+    enum Void2 {}
+    // Only an empty type matched _by value_ can make an arm unreachable. We must get the right one.
+    let res1: Result<(), Void1> = Ok(());
+    let res2: Result<(), Void2> = Ok(());
+    match (&res1, res2) {
+        (Err(_), Err(_)) => {}
+        //~^ ERROR unreachable pattern
+        //~| NOTE this pattern matches no values because `Void2` is uninhabited
+        _ => {}
+    }
+    match (res1, &res2) {
+        (Err(_), Err(_)) => {}
+        //~^ ERROR unreachable pattern
+        //~| NOTE this pattern matches no values because `Void1` is uninhabited
+        _ => {}
+    }
+
+
+    if let (0
+        //~^ NOTE matches all the values already
+        | 0, _) = (0, 0) {}
+        //~^ ERROR unreachable pattern
+        //~| NOTE unreachable pattern
+
+    match (true, true) {
+        (_, true) if false => {} // Guarded patterns don't cover others
+        (true, _) => {}
+        //~^ NOTE matches some of the same values
+        (false, _) => {}
+        //~^ NOTE matches some of the same values
+        (_, true) => {}
+        //~^ ERROR unreachable pattern
+        //~| NOTE unreachable pattern
+    }
+
+    match (true, true) {
+        (true, _) => {}
+        //~^ NOTE matches all the values already
+        (false, _) => {}
+        #[allow(unreachable_patterns)]
+        (_, true) => {} // Doesn't cover below because it's already unreachable.
+        (true, true) => {}
+        //~^ ERROR unreachable pattern
+        //~| NOTE unreachable pattern
+    }
+
+    // Despite skipping some irrelevant cases, we still report a set of rows that covers the
+    // unreachable one.
+    match (true, true, 0) {
+        (true, _, _) => {}
+        (_, true, 0..10) => {}
+        //~^ NOTE matches all the values already
+        (_, true, 10..) => {}
+        (_, true, 3) => {}
+        //~^ ERROR unreachable pattern
+        //~| NOTE unreachable pattern
+        _ => {}
+    }
+}
diff --git a/tests/ui/pattern/usefulness/explain-unreachable-pats.stderr b/tests/ui/pattern/usefulness/explain-unreachable-pats.stderr
new file mode 100644
index 00000000000..7c2382c26b8
--- /dev/null
+++ b/tests/ui/pattern/usefulness/explain-unreachable-pats.stderr
@@ -0,0 +1,92 @@
+error: unreachable pattern
+  --> $DIR/explain-unreachable-pats.rs:11:9
+   |
+LL |         (1 | 2,) => {}
+   |         -------- matches all the values already
+LL |
+LL |         (2,) => {}
+   |         ^^^^ unreachable pattern
+   |
+note: the lint level is defined here
+  --> $DIR/explain-unreachable-pats.rs:3:9
+   |
+LL | #![deny(unreachable_patterns)]
+   |         ^^^^^^^^^^^^^^^^^^^^
+
+error: unreachable pattern
+  --> $DIR/explain-unreachable-pats.rs:22:9
+   |
+LL |         (1,) => {}
+   |         ---- matches some of the same values
+LL |
+LL |         (2,) => {}
+   |         ---- matches some of the same values
+LL |
+LL |         (1 | 2,) => {}
+   |         ^^^^^^^^ unreachable pattern
+
+error: unreachable pattern
+  --> $DIR/explain-unreachable-pats.rs:31:9
+   |
+LL |         Err(_) => {}
+   |         ^^^^^^
+   |
+   = note: this pattern matches no values because `!` is uninhabited
+
+error: unreachable pattern
+  --> $DIR/explain-unreachable-pats.rs:44:9
+   |
+LL |         (Err(_), Err(_)) => {}
+   |         ^^^^^^^^^^^^^^^^
+   |
+   = note: this pattern matches no values because `Void2` is uninhabited
+
+error: unreachable pattern
+  --> $DIR/explain-unreachable-pats.rs:50:9
+   |
+LL |         (Err(_), Err(_)) => {}
+   |         ^^^^^^^^^^^^^^^^
+   |
+   = note: this pattern matches no values because `Void1` is uninhabited
+
+error: unreachable pattern
+  --> $DIR/explain-unreachable-pats.rs:59:11
+   |
+LL |     if let (0
+   |             - matches all the values already
+LL |
+LL |         | 0, _) = (0, 0) {}
+   |           ^ unreachable pattern
+
+error: unreachable pattern
+  --> $DIR/explain-unreachable-pats.rs:69:9
+   |
+LL |         (true, _) => {}
+   |         --------- matches some of the same values
+LL |
+LL |         (false, _) => {}
+   |         ---------- matches some of the same values
+LL |
+LL |         (_, true) => {}
+   |         ^^^^^^^^^ unreachable pattern
+
+error: unreachable pattern
+  --> $DIR/explain-unreachable-pats.rs:80:9
+   |
+LL |         (true, _) => {}
+   |         --------- matches all the values already
+...
+LL |         (true, true) => {}
+   |         ^^^^^^^^^^^^ unreachable pattern
+
+error: unreachable pattern
+  --> $DIR/explain-unreachable-pats.rs:92:9
+   |
+LL |         (_, true, 0..10) => {}
+   |         ---------------- matches all the values already
+...
+LL |         (_, true, 3) => {}
+   |         ^^^^^^^^^^^^ unreachable pattern
+
+error: aborting due to 9 previous errors
+
diff --git a/tests/ui/pattern/usefulness/floats.stderr b/tests/ui/pattern/usefulness/floats.stderr
index 684f6c93a16..d0a8841d6a8 100644
--- a/tests/ui/pattern/usefulness/floats.stderr
+++ b/tests/ui/pattern/usefulness/floats.stderr
@@ -14,8 +14,10 @@ LL +         _ => todo!()
 error: unreachable pattern
   --> $DIR/floats.rs:18:9
    |
+LL |         0.01f16..=6.5f16 => {}
+   |         ---------------- matches all the values already
 LL |         0.01f16 => {}
-   |         ^^^^^^^
+   |         ^^^^^^^ unreachable pattern
    |
 note: the lint level is defined here
   --> $DIR/floats.rs:1:9
@@ -26,80 +28,118 @@ LL | #![deny(unreachable_patterns)]
 error: unreachable pattern
   --> $DIR/floats.rs:19:9
    |
+LL |         0.01f16..=6.5f16 => {}
+   |         ---------------- matches all the values already
+LL |         0.01f16 => {}
 LL |         0.02f16 => {}
-   |         ^^^^^^^
+   |         ^^^^^^^ unreachable pattern
 
 error: unreachable pattern
   --> $DIR/floats.rs:20:9
    |
+LL |         0.01f16..=6.5f16 => {}
+   |         ---------------- matches all the values already
+...
 LL |         6.5f16 => {}
-   |         ^^^^^^
+   |         ^^^^^^ unreachable pattern
 
 error: unreachable pattern
   --> $DIR/floats.rs:31:9
    |
+LL |         0.01f32..=6.5f32 => {}
+   |         ---------------- matches all the values already
 LL |         0.01f32 => {}
-   |         ^^^^^^^
+   |         ^^^^^^^ unreachable pattern
 
 error: unreachable pattern
   --> $DIR/floats.rs:32:9
    |
+LL |         0.01f32..=6.5f32 => {}
+   |         ---------------- matches all the values already
+LL |         0.01f32 => {}
 LL |         0.02f32 => {}
-   |         ^^^^^^^
+   |         ^^^^^^^ unreachable pattern
 
 error: unreachable pattern
   --> $DIR/floats.rs:33:9
    |
+LL |         0.01f32..=6.5f32 => {}
+   |         ---------------- matches all the values already
+...
 LL |         6.5f32 => {}
-   |         ^^^^^^
+   |         ^^^^^^ unreachable pattern
 
 error: unreachable pattern
   --> $DIR/floats.rs:45:9
    |
+LL |         0.01f64..=6.5f64 => {}
+   |         ---------------- matches all the values already
+LL |         0.005f64 => {}
 LL |         0.01f64 => {}
-   |         ^^^^^^^
+   |         ^^^^^^^ unreachable pattern
 
 error: unreachable pattern
   --> $DIR/floats.rs:46:9
    |
+LL |         0.01f64..=6.5f64 => {}
+   |         ---------------- matches all the values already
+...
 LL |         0.02f64 => {}
-   |         ^^^^^^^
+   |         ^^^^^^^ unreachable pattern
 
 error: unreachable pattern
   --> $DIR/floats.rs:47:9
    |
+LL |         0.01f64..=6.5f64 => {}
+   |         ---------------- matches all the values already
+...
 LL |         6.5f64 => {}
-   |         ^^^^^^
+   |         ^^^^^^ unreachable pattern
 
 error: unreachable pattern
   --> $DIR/floats.rs:49:9
    |
+LL |         0.01f64..=6.5f64 => {}
+   |         ---------------- matches all the values already
+...
 LL |         1.0f64..=4.0f64 => {}
-   |         ^^^^^^^^^^^^^^^
+   |         ^^^^^^^^^^^^^^^ unreachable pattern
 
 error: unreachable pattern
   --> $DIR/floats.rs:62:9
    |
+LL |         0.01f128..=6.5f128 => {}
+   |         ------------------ matches all the values already
+LL |         0.005f128 => {}
 LL |         0.01f128 => {}
-   |         ^^^^^^^^
+   |         ^^^^^^^^ unreachable pattern
 
 error: unreachable pattern
   --> $DIR/floats.rs:63:9
    |
+LL |         0.01f128..=6.5f128 => {}
+   |         ------------------ matches all the values already
+...
 LL |         0.02f128 => {}
-   |         ^^^^^^^^
+   |         ^^^^^^^^ unreachable pattern
 
 error: unreachable pattern
   --> $DIR/floats.rs:64:9
    |
+LL |         0.01f128..=6.5f128 => {}
+   |         ------------------ matches all the values already
+...
 LL |         6.5f128 => {}
-   |         ^^^^^^^
+   |         ^^^^^^^ unreachable pattern
 
 error: unreachable pattern
   --> $DIR/floats.rs:66:9
    |
+LL |         0.01f128..=6.5f128 => {}
+   |         ------------------ matches all the values already
+...
 LL |         1.0f128..=4.0f128 => {}
-   |         ^^^^^^^^^^^^^^^^^
+   |         ^^^^^^^^^^^^^^^^^ unreachable pattern
 
 error: aborting due to 15 previous errors
 
diff --git a/tests/ui/pattern/usefulness/impl-trait.stderr b/tests/ui/pattern/usefulness/impl-trait.stderr
index ba8b12f9f66..c079f5a259d 100644
--- a/tests/ui/pattern/usefulness/impl-trait.stderr
+++ b/tests/ui/pattern/usefulness/impl-trait.stderr
@@ -4,6 +4,7 @@ error: unreachable pattern
 LL |             _ => {}
    |             ^
    |
+   = note: this pattern matches no values because `Void` is uninhabited
 note: the lint level is defined here
   --> $DIR/impl-trait.rs:5:9
    |
@@ -15,36 +16,48 @@ error: unreachable pattern
    |
 LL |             _ => {}
    |             ^
+   |
+   = note: this pattern matches no values because `Void` is uninhabited
 
 error: unreachable pattern
   --> $DIR/impl-trait.rs:45:13
    |
 LL |             Some(_) => {}
    |             ^^^^^^^
+   |
+   = note: this pattern matches no values because `Void` is uninhabited
 
 error: unreachable pattern
   --> $DIR/impl-trait.rs:49:13
    |
+LL |             None => {}
+   |             ---- matches all the values already
 LL |             _ => {}
-   |             ^
+   |             ^ unreachable pattern
 
 error: unreachable pattern
   --> $DIR/impl-trait.rs:59:13
    |
 LL |             Some(_) => {}
    |             ^^^^^^^
+   |
+   = note: this pattern matches no values because `Void` is uninhabited
 
 error: unreachable pattern
   --> $DIR/impl-trait.rs:63:13
    |
+LL |             None => {}
+   |             ---- matches all the values already
 LL |             _ => {}
-   |             ^
+   |             ^ unreachable pattern
 
 error: unreachable pattern
   --> $DIR/impl-trait.rs:76:9
    |
 LL |         _ => {}
    |         ^
+   |
+   = note: this pattern matches no values because `Void` is uninhabited
 
 error: unreachable pattern
   --> $DIR/impl-trait.rs:86:9
@@ -59,12 +72,16 @@ error: unreachable pattern
    |
 LL |             _ => {}
    |             ^
+   |
+   = note: this pattern matches no values because `Void` is uninhabited
 
 error: unreachable pattern
   --> $DIR/impl-trait.rs:105:9
    |
+LL |         Some((a, b)) => {}
+   |         ------------ matches all the values already
 LL |         Some((mut x, mut y)) => {
-   |         ^^^^^^^^^^^^^^^^^^^^
+   |         ^^^^^^^^^^^^^^^^^^^^ unreachable pattern
 
 error: unreachable pattern
   --> $DIR/impl-trait.rs:124:13
@@ -79,12 +96,16 @@ error: unreachable pattern
    |
 LL |             _ => {}
    |             ^
+   |
+   = note: this pattern matches no values because `SecretelyVoid` is uninhabited
 
 error: unreachable pattern
   --> $DIR/impl-trait.rs:151:13
    |
 LL |             _ => {}
    |             ^
+   |
+   = note: this pattern matches no values because `SecretelyDoubleVoid` is uninhabited
 
 error[E0004]: non-exhaustive patterns: type `impl Copy` is non-empty
   --> $DIR/impl-trait.rs:23:11
diff --git a/tests/ui/pattern/usefulness/integer-ranges/reachability.stderr b/tests/ui/pattern/usefulness/integer-ranges/reachability.stderr
index c5b028d2038..8cf81822659 100644
--- a/tests/ui/pattern/usefulness/integer-ranges/reachability.stderr
+++ b/tests/ui/pattern/usefulness/integer-ranges/reachability.stderr
@@ -2,7 +2,9 @@ error: unreachable pattern
   --> $DIR/reachability.rs:18:17
    |
 LL |     m!(0u8, 42, 42);
-   |                 ^^
+   |             --  ^^ unreachable pattern
+   |             |
+   |             matches all the values already
    |
 note: the lint level is defined here
   --> $DIR/reachability.rs:3:9
@@ -14,121 +16,181 @@ error: unreachable pattern
   --> $DIR/reachability.rs:22:22
    |
 LL |     m!(0u8, 20..=30, 20);
-   |                      ^^
+   |             -------  ^^ unreachable pattern
+   |             |
+   |             matches all the values already
 
 error: unreachable pattern
   --> $DIR/reachability.rs:23:22
    |
 LL |     m!(0u8, 20..=30, 21);
-   |                      ^^
+   |             -------  ^^ unreachable pattern
+   |             |
+   |             matches all the values already
 
 error: unreachable pattern
   --> $DIR/reachability.rs:24:22
    |
 LL |     m!(0u8, 20..=30, 25);
-   |                      ^^
+   |             -------  ^^ unreachable pattern
+   |             |
+   |             matches all the values already
 
 error: unreachable pattern
   --> $DIR/reachability.rs:25:22
    |
 LL |     m!(0u8, 20..=30, 29);
-   |                      ^^
+   |             -------  ^^ unreachable pattern
+   |             |
+   |             matches all the values already
 
 error: unreachable pattern
   --> $DIR/reachability.rs:26:22
    |
 LL |     m!(0u8, 20..=30, 30);
-   |                      ^^
+   |             -------  ^^ unreachable pattern
+   |             |
+   |             matches all the values already
 
 error: unreachable pattern
   --> $DIR/reachability.rs:29:21
    |
 LL |     m!(0u8, 20..30, 20);
-   |                     ^^
+   |             ------  ^^ unreachable pattern
+   |             |
+   |             matches all the values already
 
 error: unreachable pattern
   --> $DIR/reachability.rs:30:21
    |
 LL |     m!(0u8, 20..30, 21);
-   |                     ^^
+   |             ------  ^^ unreachable pattern
+   |             |
+   |             matches all the values already
 
 error: unreachable pattern
   --> $DIR/reachability.rs:31:21
    |
 LL |     m!(0u8, 20..30, 25);
-   |                     ^^
+   |             ------  ^^ unreachable pattern
+   |             |
+   |             matches all the values already
 
 error: unreachable pattern
   --> $DIR/reachability.rs:32:21
    |
 LL |     m!(0u8, 20..30, 29);
-   |                     ^^
+   |             ------  ^^ unreachable pattern
+   |             |
+   |             matches all the values already
 
 error: unreachable pattern
   --> $DIR/reachability.rs:36:22
    |
 LL |     m!(0u8, 20..=30, 20..=30);
-   |                      ^^^^^^^
+   |             -------  ^^^^^^^ unreachable pattern
+   |             |
+   |             matches all the values already
 
 error: unreachable pattern
   --> $DIR/reachability.rs:37:22
    |
 LL |     m!(0u8, 20.. 30, 20.. 30);
-   |                      ^^^^^^^
+   |             -------  ^^^^^^^ unreachable pattern
+   |             |
+   |             matches all the values already
 
 error: unreachable pattern
   --> $DIR/reachability.rs:38:22
    |
 LL |     m!(0u8, 20..=30, 20.. 30);
-   |                      ^^^^^^^
+   |             -------  ^^^^^^^ unreachable pattern
+   |             |
+   |             matches all the values already
 
 error: unreachable pattern
   --> $DIR/reachability.rs:40:22
    |
 LL |     m!(0u8, 20..=30, 21..=30);
-   |                      ^^^^^^^
+   |             -------  ^^^^^^^ unreachable pattern
+   |             |
+   |             matches all the values already
 
 error: unreachable pattern
   --> $DIR/reachability.rs:41:22
    |
 LL |     m!(0u8, 20..=30, 20..=29);
-   |                      ^^^^^^^
+   |             -------  ^^^^^^^ unreachable pattern
+   |             |
+   |             matches all the values already
 
 error: unreachable pattern
   --> $DIR/reachability.rs:43:24
    |
 LL |     m!('a', 'A'..='z', 'a'..='z');
-   |                        ^^^^^^^^^
+   |             ---------  ^^^^^^^^^ unreachable pattern
+   |             |
+   |             matches all the values already
 
 error: unreachable pattern
   --> $DIR/reachability.rs:50:9
    |
+LL |         5 => {},
+   |         - matches some of the same values
+LL |         6 => {},
+   |         - matches some of the same values
+LL |         7 => {},
+   |         - matches some of the same values
+LL |         8 => {},
+   |         - matches some of the same values
 LL |         5..=8 => {},
-   |         ^^^^^
+   |         ^^^^^ unreachable pattern
 
 error: unreachable pattern
   --> $DIR/reachability.rs:56:9
    |
+LL |         0..10 => {},
+   |         ----- matches some of the same values
+LL |         10..20 => {},
+   |         ------ matches some of the same values
 LL |         5..15 => {},
-   |         ^^^^^
+   |         ^^^^^ unreachable pattern
 
 error: unreachable pattern
   --> $DIR/reachability.rs:63:9
    |
+LL |         0..10 => {},
+   |         ----- matches some of the same values
+LL |         10..20 => {},
+   |         ------ matches some of the same values
+LL |         20..30 => {},
+   |         ------ matches some of the same values
 LL |         5..25 => {},
-   |         ^^^^^
+   |         ^^^^^ unreachable pattern
 
 error: unreachable pattern
   --> $DIR/reachability.rs:71:9
    |
+LL |         0..10 => {},
+   |         ----- matches some of the same values
+LL |         10 => {},
+   |         -- matches some of the same values
+LL |         11..=23 => {},
+   |         ------- matches some of the same values
+LL |         19..30 => {},
+   |         ------ matches some of the same values
 LL |         5..25 => {},
-   |         ^^^^^
+   |         ^^^^^ unreachable pattern
 
 error: unreachable pattern
   --> $DIR/reachability.rs:77:9
    |
+LL |         0..10 => {},
+   |         ----- matches some of the same values
+LL |         10..20 => {},
+   |         ------ matches some of the same values
 LL |         5..15 => {},
-   |         ^^^^^
+   |         ^^^^^ unreachable pattern
 
 error: unreachable pattern
   --> $DIR/reachability.rs:84:9
@@ -141,20 +203,29 @@ LL |         '\u{D7FF}'..='\u{E000}' => {},
 error: unreachable pattern
   --> $DIR/reachability.rs:89:9
    |
+LL |         '\u{0}'..='\u{D7FF}' => {},
+   |         -------------------- matches some of the same values
+LL |         '\u{E000}'..='\u{10_FFFF}' => {},
+   |         -------------------------- matches some of the same values
 LL |         '\u{D7FF}'..='\u{E000}' => {},
-   |         ^^^^^^^^^^^^^^^^^^^^^^^
+   |         ^^^^^^^^^^^^^^^^^^^^^^^ unreachable pattern
 
 error: unreachable pattern
   --> $DIR/reachability.rs:105:9
    |
+LL |         &42 => {}
+   |         --- matches all the values already
 LL |         &FOO => {}
-   |         ^^^^
+   |         ^^^^ unreachable pattern
 
 error: unreachable pattern
   --> $DIR/reachability.rs:106:9
    |
+LL |         &42 => {}
+   |         --- matches all the values already
+LL |         &FOO => {}
 LL |         BAR => {}
-   |         ^^^
+   |         ^^^ unreachable pattern
 
 error: aborting due to 25 previous errors
 
diff --git a/tests/ui/pattern/usefulness/issue-12116.stderr b/tests/ui/pattern/usefulness/issue-12116.stderr
index 199bdc6ac97..b2c2be97563 100644
--- a/tests/ui/pattern/usefulness/issue-12116.stderr
+++ b/tests/ui/pattern/usefulness/issue-12116.stderr
@@ -1,8 +1,10 @@
 error: unreachable pattern
   --> $DIR/issue-12116.rs:15:9
    |
+LL |         &IntList::Cons(val, box ref next_list) => tail(next_list),
+   |         -------------------------------------- matches all the values already
 LL |         &IntList::Cons(val, box IntList::Nil)  => IntList::Cons(val, Box::new(IntList::Nil)),
-   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unreachable pattern
    |
 note: the lint level is defined here
   --> $DIR/issue-12116.rs:4:9
diff --git a/tests/ui/pattern/usefulness/issue-12369.stderr b/tests/ui/pattern/usefulness/issue-12369.stderr
index 2b6e2e14b7c..dbd6bab6aeb 100644
--- a/tests/ui/pattern/usefulness/issue-12369.stderr
+++ b/tests/ui/pattern/usefulness/issue-12369.stderr
@@ -1,8 +1,12 @@
 error: unreachable pattern
   --> $DIR/issue-12369.rs:9:9
    |
+LL |         &[a,b,c] => 3,
+   |         -------- matches some of the same values
+LL |         &[a, ref rest @ ..] => a,
+   |         ------------------- matches some of the same values
 LL |         &[10,a, ref rest @ ..] => 10
-   |         ^^^^^^^^^^^^^^^^^^^^^^
+   |         ^^^^^^^^^^^^^^^^^^^^^^ unreachable pattern
    |
 note: the lint level is defined here
   --> $DIR/issue-12369.rs:1:9
diff --git a/tests/ui/pattern/usefulness/issue-13727.stderr b/tests/ui/pattern/usefulness/issue-13727.stderr
index ab80c56ea88..ca8533b33a4 100644
--- a/tests/ui/pattern/usefulness/issue-13727.stderr
+++ b/tests/ui/pattern/usefulness/issue-13727.stderr
@@ -1,8 +1,10 @@
 error: unreachable pattern
   --> $DIR/issue-13727.rs:7:5
    |
+LL |     256 => print!("0b1110\n"),
+   |     --- matches all the values already
 LL |     512 => print!("0b1111\n"),
-   |     ^^^
+   |     ^^^ unreachable pattern
    |
 note: the lint level is defined here
   --> $DIR/issue-13727.rs:2:9
diff --git a/tests/ui/pattern/usefulness/issue-30240-b.stderr b/tests/ui/pattern/usefulness/issue-30240-b.stderr
index 74d39eba98c..749515fc94b 100644
--- a/tests/ui/pattern/usefulness/issue-30240-b.stderr
+++ b/tests/ui/pattern/usefulness/issue-30240-b.stderr
@@ -2,7 +2,9 @@ error: unreachable pattern
   --> $DIR/issue-30240-b.rs:12:9
    |
 LL |         "hello" => {}
-   |         ^^^^^^^
+   |         ------- matches all the values already
+LL |         "hello" => {}
+   |         ^^^^^^^ unreachable pattern
    |
 note: the lint level is defined here
   --> $DIR/issue-30240-b.rs:1:9
diff --git a/tests/ui/pattern/usefulness/issue-31221.stderr b/tests/ui/pattern/usefulness/issue-31221.stderr
index 7d349144456..f564422faae 100644
--- a/tests/ui/pattern/usefulness/issue-31221.stderr
+++ b/tests/ui/pattern/usefulness/issue-31221.stderr
@@ -23,8 +23,10 @@ LL |         &Var2 => (),
 error: unreachable pattern
   --> $DIR/issue-31221.rs:31:9
    |
+LL |         (Var1, b) => (),
+   |         --------- matches some of the same values
 LL |         (c, d) => (),
-   |         ------ matches any value
+   |         ------ matches some of the same values
 LL |         anything => ()
    |         ^^^^^^^^ unreachable pattern
 
diff --git a/tests/ui/pattern/usefulness/issue-57472.stderr b/tests/ui/pattern/usefulness/issue-57472.stderr
index c814eaec0d1..68b5b7cb791 100644
--- a/tests/ui/pattern/usefulness/issue-57472.stderr
+++ b/tests/ui/pattern/usefulness/issue-57472.stderr
@@ -1,8 +1,10 @@
 error: unreachable pattern
   --> $DIR/issue-57472.rs:15:13
    |
+LL |             Punned { foo: [_], .. } => println!("foo"),
+   |             ----------------------- matches all the values already
 LL |             Punned { bar: [_], .. } => println!("bar"),
-   |             ^^^^^^^^^^^^^^^^^^^^^^^
+   |             ^^^^^^^^^^^^^^^^^^^^^^^ unreachable pattern
    |
 note: the lint level is defined here
   --> $DIR/issue-57472.rs:2:9
@@ -13,8 +15,10 @@ LL | #![deny(unreachable_patterns)]
 error: unreachable pattern
   --> $DIR/issue-57472.rs:32:17
    |
+LL |                 Punned { foo: [_] } => println!("foo"),
+   |                 ------------------- matches all the values already
 LL |                 Punned { bar: [_] } => println!("bar"),
-   |                 ^^^^^^^^^^^^^^^^^^^
+   |                 ^^^^^^^^^^^^^^^^^^^ unreachable pattern
 
 error: aborting due to 2 previous errors
 
diff --git a/tests/ui/pattern/usefulness/match-arm-statics.stderr b/tests/ui/pattern/usefulness/match-arm-statics.stderr
index a5dffebf699..37f1ac58a16 100644
--- a/tests/ui/pattern/usefulness/match-arm-statics.stderr
+++ b/tests/ui/pattern/usefulness/match-arm-statics.stderr
@@ -1,8 +1,11 @@
 error: unreachable pattern
   --> $DIR/match-arm-statics.rs:25:9
    |
+LL |         TRUE_TRUE => (),
+   |         --------- matches all the values already
+...
 LL |         (true, true) => ()
-   |         ^^^^^^^^^^^^
+   |         ^^^^^^^^^^^^ unreachable pattern
    |
 note: the lint level is defined here
   --> $DIR/match-arm-statics.rs:2:9
@@ -13,14 +16,23 @@ LL | #![deny(unreachable_patterns)]
 error: unreachable pattern
   --> $DIR/match-arm-statics.rs:40:9
    |
+LL |         Some(Some(EAST)) => (),
+   |         ---------------- matches all the values already
+...
 LL |         Some(Some(East)) => (),
-   |         ^^^^^^^^^^^^^^^^
+   |         ^^^^^^^^^^^^^^^^ unreachable pattern
 
 error: unreachable pattern
   --> $DIR/match-arm-statics.rs:60:9
    |
+LL |         Foo { bar: _, baz: NEW_FALSE } => (),
+   |         ------------------------------ matches some of the same values
+...
+LL |         Foo { bar: Some(EAST), .. } => (),
+   |         --------------------------- matches some of the same values
+LL |         Foo { bar: Some(North), baz: NewBool(true) } => (),
 LL |         Foo { bar: Some(EAST), baz: NewBool(false) } => ()
-   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unreachable pattern
 
 error: aborting due to 3 previous errors
 
diff --git a/tests/ui/pattern/usefulness/match-byte-array-patterns.stderr b/tests/ui/pattern/usefulness/match-byte-array-patterns.stderr
index 0c582be8df8..39675e2bdd4 100644
--- a/tests/ui/pattern/usefulness/match-byte-array-patterns.stderr
+++ b/tests/ui/pattern/usefulness/match-byte-array-patterns.stderr
@@ -1,8 +1,10 @@
 error: unreachable pattern
   --> $DIR/match-byte-array-patterns.rs:8:9
    |
+LL |         b"AAAA" => {},
+   |         ------- matches all the values already
 LL |         &[0x41, 0x41, 0x41, 0x41] => {}
-   |         ^^^^^^^^^^^^^^^^^^^^^^^^^
+   |         ^^^^^^^^^^^^^^^^^^^^^^^^^ unreachable pattern
    |
 note: the lint level is defined here
   --> $DIR/match-byte-array-patterns.rs:1:9
@@ -13,44 +15,58 @@ LL | #![deny(unreachable_patterns)]
 error: unreachable pattern
   --> $DIR/match-byte-array-patterns.rs:14:9
    |
+LL |         &[0x41, 0x41, 0x41, 0x41] => {}
+   |         ------------------------- matches all the values already
 LL |         b"AAAA" => {},
-   |         ^^^^^^^
+   |         ^^^^^^^ unreachable pattern
 
 error: unreachable pattern
   --> $DIR/match-byte-array-patterns.rs:20:9
    |
+LL |         &[_, 0x41, 0x41, 0x41] => {},
+   |         ---------------------- matches all the values already
 LL |         b"AAAA" => {},
-   |         ^^^^^^^
+   |         ^^^^^^^ unreachable pattern
 
 error: unreachable pattern
   --> $DIR/match-byte-array-patterns.rs:26:9
    |
+LL |         &[0x41, .., 0x41] => {}
+   |         ----------------- matches all the values already
 LL |         b"AAAA" => {},
-   |         ^^^^^^^
+   |         ^^^^^^^ unreachable pattern
 
 error: unreachable pattern
   --> $DIR/match-byte-array-patterns.rs:34:9
    |
+LL |         b"AAAA" => {},
+   |         ------- matches all the values already
 LL |         &[0x41, 0x41, 0x41, 0x41] => {}
-   |         ^^^^^^^^^^^^^^^^^^^^^^^^^
+   |         ^^^^^^^^^^^^^^^^^^^^^^^^^ unreachable pattern
 
 error: unreachable pattern
   --> $DIR/match-byte-array-patterns.rs:40:9
    |
+LL |         &[0x41, 0x41, 0x41, 0x41] => {}
+   |         ------------------------- matches all the values already
 LL |         b"AAAA" => {},
-   |         ^^^^^^^
+   |         ^^^^^^^ unreachable pattern
 
 error: unreachable pattern
   --> $DIR/match-byte-array-patterns.rs:46:9
    |
+LL |         &[_, 0x41, 0x41, 0x41] => {},
+   |         ---------------------- matches all the values already
 LL |         b"AAAA" => {},
-   |         ^^^^^^^
+   |         ^^^^^^^ unreachable pattern
 
 error: unreachable pattern
   --> $DIR/match-byte-array-patterns.rs:52:9
    |
+LL |         &[0x41, .., 0x41] => {}
+   |         ----------------- matches all the values already
 LL |         b"AAAA" => {},
-   |         ^^^^^^^
+   |         ^^^^^^^ unreachable pattern
 
 error: aborting due to 8 previous errors
 
diff --git a/tests/ui/pattern/usefulness/match-ref-ice.stderr b/tests/ui/pattern/usefulness/match-ref-ice.stderr
index 0dbfa776f69..9c5af47cc1e 100644
--- a/tests/ui/pattern/usefulness/match-ref-ice.stderr
+++ b/tests/ui/pattern/usefulness/match-ref-ice.stderr
@@ -1,8 +1,10 @@
 error: unreachable pattern
   --> $DIR/match-ref-ice.rs:13:9
    |
+LL |         [1, ref _madoka, 3] => (),
+   |         ------------------- matches all the values already
 LL |         [1, 2, 3] => (),
-   |         ^^^^^^^^^
+   |         ^^^^^^^^^ unreachable pattern
    |
 note: the lint level is defined here
   --> $DIR/match-ref-ice.rs:1:9
diff --git a/tests/ui/pattern/usefulness/match-vec-fixed.stderr b/tests/ui/pattern/usefulness/match-vec-fixed.stderr
index e388a06cb9a..04507a22856 100644
--- a/tests/ui/pattern/usefulness/match-vec-fixed.stderr
+++ b/tests/ui/pattern/usefulness/match-vec-fixed.stderr
@@ -2,7 +2,9 @@ error: unreachable pattern
   --> $DIR/match-vec-fixed.rs:7:9
    |
 LL |         [_, _, _] => {}
-   |         ^^^^^^^^^
+   |         --------- matches all the values already
+LL |         [_, _, _] => {}
+   |         ^^^^^^^^^ unreachable pattern
    |
 note: the lint level is defined here
   --> $DIR/match-vec-fixed.rs:1:9
@@ -14,7 +16,9 @@ error: unreachable pattern
   --> $DIR/match-vec-fixed.rs:11:9
    |
 LL |         [_, 1, _] => {}
-   |         ^^^^^^^^^
+   |         --------- matches all the values already
+LL |         [_, 1, _] => {}
+   |         ^^^^^^^^^ unreachable pattern
 
 error: aborting due to 2 previous errors
 
diff --git a/tests/ui/pattern/usefulness/match-vec-unreachable.stderr b/tests/ui/pattern/usefulness/match-vec-unreachable.stderr
index 672fd92fb5e..865f5b319a7 100644
--- a/tests/ui/pattern/usefulness/match-vec-unreachable.stderr
+++ b/tests/ui/pattern/usefulness/match-vec-unreachable.stderr
@@ -1,8 +1,10 @@
 error: unreachable pattern
   --> $DIR/match-vec-unreachable.rs:8:9
    |
+LL |         [a, (2, 3), _] => (),
+   |         -------------- matches all the values already
 LL |         [(1, 2), (2, 3), b] => (),
-   |         ^^^^^^^^^^^^^^^^^^^
+   |         ^^^^^^^^^^^^^^^^^^^ unreachable pattern
    |
 note: the lint level is defined here
   --> $DIR/match-vec-unreachable.rs:1:9
@@ -13,14 +15,18 @@ LL | #![deny(unreachable_patterns)]
 error: unreachable pattern
   --> $DIR/match-vec-unreachable.rs:18:9
    |
+LL |         [ref a, _, _, ..] => { println!("{}", a); }
+   |         ----------------- matches all the values already
 LL |         [_, _, _, _, _] => { }
-   |         ^^^^^^^^^^^^^^^
+   |         ^^^^^^^^^^^^^^^ unreachable pattern
 
 error: unreachable pattern
   --> $DIR/match-vec-unreachable.rs:26:9
    |
+LL |         ['a', 'b', 'c', ref _tail @ ..] => {}
+   |         ------------------------------- matches all the values already
 LL |         ['a', 'b', 'c'] => {}
-   |         ^^^^^^^^^^^^^^^
+   |         ^^^^^^^^^^^^^^^ unreachable pattern
 
 error: aborting due to 3 previous errors
 
diff --git a/tests/ui/pattern/usefulness/slice-pattern-const-2.stderr b/tests/ui/pattern/usefulness/slice-pattern-const-2.stderr
index dcad11a38a7..12db48590a4 100644
--- a/tests/ui/pattern/usefulness/slice-pattern-const-2.stderr
+++ b/tests/ui/pattern/usefulness/slice-pattern-const-2.stderr
@@ -1,8 +1,11 @@
 error: unreachable pattern
   --> $DIR/slice-pattern-const-2.rs:9:9
    |
+LL |         MAGIC_TEST => (),
+   |         ---------- matches all the values already
+LL |         [0x00, 0x00, 0x00, 0x00] => (),
 LL |         [4, 5, 6, 7] => (),
-   |         ^^^^^^^^^^^^
+   |         ^^^^^^^^^^^^ unreachable pattern
    |
 note: the lint level is defined here
   --> $DIR/slice-pattern-const-2.rs:1:9
@@ -13,20 +16,26 @@ LL | #![deny(unreachable_patterns)]
 error: unreachable pattern
   --> $DIR/slice-pattern-const-2.rs:15:9
    |
+LL |         MAGIC_TEST => (),
+   |         ---------- matches all the values already
 LL |         [4, 5, 6, 7] => (),
-   |         ^^^^^^^^^^^^
+   |         ^^^^^^^^^^^^ unreachable pattern
 
 error: unreachable pattern
   --> $DIR/slice-pattern-const-2.rs:21:9
    |
+LL |         [4, 5, 6, 7] => (),
+   |         ------------ matches all the values already
 LL |         MAGIC_TEST => (),
-   |         ^^^^^^^^^^
+   |         ^^^^^^^^^^ unreachable pattern
 
 error: unreachable pattern
   --> $DIR/slice-pattern-const-2.rs:28:9
    |
+LL |         [4] => (),
+   |         --- matches all the values already
 LL |         FOO => (),
-   |         ^^^
+   |         ^^^ unreachable pattern
 
 error: aborting due to 4 previous errors
 
diff --git a/tests/ui/pattern/usefulness/slice-pattern-const-3.stderr b/tests/ui/pattern/usefulness/slice-pattern-const-3.stderr
index b90b3a88a18..5a66799d9c9 100644
--- a/tests/ui/pattern/usefulness/slice-pattern-const-3.stderr
+++ b/tests/ui/pattern/usefulness/slice-pattern-const-3.stderr
@@ -1,8 +1,11 @@
 error: unreachable pattern
   --> $DIR/slice-pattern-const-3.rs:9:9
    |
+LL |         MAGIC_TEST => (),
+   |         ---------- matches all the values already
+LL |         ["0x00", "0x00", "0x00", "0x00"] => (),
 LL |         ["4", "5", "6", "7"] => (),
-   |         ^^^^^^^^^^^^^^^^^^^^
+   |         ^^^^^^^^^^^^^^^^^^^^ unreachable pattern
    |
 note: the lint level is defined here
   --> $DIR/slice-pattern-const-3.rs:1:9
@@ -13,20 +16,26 @@ LL | #![deny(unreachable_patterns)]
 error: unreachable pattern
   --> $DIR/slice-pattern-const-3.rs:15:9
    |
+LL |         MAGIC_TEST => (),
+   |         ---------- matches all the values already
 LL |         ["4", "5", "6", "7"] => (),
-   |         ^^^^^^^^^^^^^^^^^^^^
+   |         ^^^^^^^^^^^^^^^^^^^^ unreachable pattern
 
 error: unreachable pattern
   --> $DIR/slice-pattern-const-3.rs:21:9
    |
+LL |         ["4", "5", "6", "7"] => (),
+   |         -------------------- matches all the values already
 LL |         MAGIC_TEST => (),
-   |         ^^^^^^^^^^
+   |         ^^^^^^^^^^ unreachable pattern
 
 error: unreachable pattern
   --> $DIR/slice-pattern-const-3.rs:28:9
    |
+LL |         ["boo"] => (),
+   |         ------- matches all the values already
 LL |         FOO => (),
-   |         ^^^
+   |         ^^^ unreachable pattern
 
 error: aborting due to 4 previous errors
 
diff --git a/tests/ui/pattern/usefulness/slice-pattern-const.stderr b/tests/ui/pattern/usefulness/slice-pattern-const.stderr
index 1fffb9fedbf..87a85acc4c5 100644
--- a/tests/ui/pattern/usefulness/slice-pattern-const.stderr
+++ b/tests/ui/pattern/usefulness/slice-pattern-const.stderr
@@ -1,8 +1,11 @@
 error: unreachable pattern
   --> $DIR/slice-pattern-const.rs:9:9
    |
+LL |         MAGIC_TEST => (),
+   |         ---------- matches all the values already
+LL |         [0x00, 0x00, 0x00, 0x00] => (),
 LL |         [84, 69, 83, 84] => (),
-   |         ^^^^^^^^^^^^^^^^
+   |         ^^^^^^^^^^^^^^^^ unreachable pattern
    |
 note: the lint level is defined here
   --> $DIR/slice-pattern-const.rs:1:9
@@ -13,50 +16,68 @@ LL | #![deny(unreachable_patterns)]
 error: unreachable pattern
   --> $DIR/slice-pattern-const.rs:15:9
    |
+LL |         MAGIC_TEST => (),
+   |         ---------- matches all the values already
 LL |         [84, 69, 83, 84] => (),
-   |         ^^^^^^^^^^^^^^^^
+   |         ^^^^^^^^^^^^^^^^ unreachable pattern
 
 error: unreachable pattern
   --> $DIR/slice-pattern-const.rs:21:9
    |
+LL |         [84, 69, 83, 84] => (),
+   |         ---------------- matches all the values already
 LL |         MAGIC_TEST => (),
-   |         ^^^^^^^^^^
+   |         ^^^^^^^^^^ unreachable pattern
 
 error: unreachable pattern
   --> $DIR/slice-pattern-const.rs:28:9
    |
+LL |         [4] => (),
+   |         --- matches all the values already
 LL |         FOO => (),
-   |         ^^^
+   |         ^^^ unreachable pattern
 
 error: unreachable pattern
   --> $DIR/slice-pattern-const.rs:35:9
    |
+LL |         [4] => (),
+   |         --- matches all the values already
 LL |         BAR => (),
-   |         ^^^
+   |         ^^^ unreachable pattern
 
 error: unreachable pattern
   --> $DIR/slice-pattern-const.rs:43:9
    |
+LL |         [] => (),
+   |         -- matches all the values already
 LL |         BOO => (),
-   |         ^^^
+   |         ^^^ unreachable pattern
 
 error: unreachable pattern
   --> $DIR/slice-pattern-const.rs:44:9
    |
+LL |         [] => (),
+   |         -- matches all the values already
+LL |         BOO => (),
 LL |         b"" => (),
-   |         ^^^
+   |         ^^^ unreachable pattern
 
 error: unreachable pattern
   --> $DIR/slice-pattern-const.rs:45:9
    |
+LL |         [] => (),
+   |         -- matches all the values already
+...
 LL |         _ => (),
-   |         ^
+   |         ^ unreachable pattern
 
 error: unreachable pattern
   --> $DIR/slice-pattern-const.rs:51:9
    |
+LL |         CONST1 => {}
+   |         ------ matches all the values already
 LL |         [true] => {}
-   |         ^^^^^^
+   |         ^^^^^^ unreachable pattern
 
 error: aborting due to 9 previous errors
 
diff --git a/tests/ui/pattern/usefulness/slice-patterns-reachability.stderr b/tests/ui/pattern/usefulness/slice-patterns-reachability.stderr
index 607ffb76595..40fbb00de1f 100644
--- a/tests/ui/pattern/usefulness/slice-patterns-reachability.stderr
+++ b/tests/ui/pattern/usefulness/slice-patterns-reachability.stderr
@@ -2,7 +2,9 @@ error: unreachable pattern
   --> $DIR/slice-patterns-reachability.rs:8:9
    |
 LL |         [true, ..] => {}
-   |         ^^^^^^^^^^
+   |         ---------- matches all the values already
+LL |         [true, ..] => {}
+   |         ^^^^^^^^^^ unreachable pattern
    |
 note: the lint level is defined here
   --> $DIR/slice-patterns-reachability.rs:1:9
@@ -13,32 +15,45 @@ LL | #![deny(unreachable_patterns)]
 error: unreachable pattern
   --> $DIR/slice-patterns-reachability.rs:9:9
    |
+LL |         [true, ..] => {}
+   |         ---------- matches all the values already
+LL |         [true, ..] => {}
 LL |         [true] => {}
-   |         ^^^^^^
+   |         ^^^^^^ unreachable pattern
 
 error: unreachable pattern
   --> $DIR/slice-patterns-reachability.rs:14:9
    |
 LL |         [.., true] => {}
-   |         ^^^^^^^^^^
+   |         ---------- matches all the values already
+LL |         [.., true] => {}
+   |         ^^^^^^^^^^ unreachable pattern
 
 error: unreachable pattern
   --> $DIR/slice-patterns-reachability.rs:15:9
    |
+LL |         [.., true] => {}
+   |         ---------- matches all the values already
+LL |         [.., true] => {}
 LL |         [true] => {}
-   |         ^^^^^^
+   |         ^^^^^^ unreachable pattern
 
 error: unreachable pattern
   --> $DIR/slice-patterns-reachability.rs:20:9
    |
 LL |         [false, .., true] => {}
-   |         ^^^^^^^^^^^^^^^^^
+   |         ----------------- matches all the values already
+LL |         [false, .., true] => {}
+   |         ^^^^^^^^^^^^^^^^^ unreachable pattern
 
 error: unreachable pattern
   --> $DIR/slice-patterns-reachability.rs:21:9
    |
+LL |         [false, .., true] => {}
+   |         ----------------- matches all the values already
+LL |         [false, .., true] => {}
 LL |         [false, true] => {}
-   |         ^^^^^^^^^^^^^
+   |         ^^^^^^^^^^^^^ unreachable pattern
 
 error: aborting due to 6 previous errors
 
diff --git a/tests/ui/pattern/usefulness/top-level-alternation.stderr b/tests/ui/pattern/usefulness/top-level-alternation.stderr
index 17fa951c539..0e7e7d4969d 100644
--- a/tests/ui/pattern/usefulness/top-level-alternation.stderr
+++ b/tests/ui/pattern/usefulness/top-level-alternation.stderr
@@ -2,7 +2,9 @@ error: unreachable pattern
   --> $DIR/top-level-alternation.rs:4:23
    |
 LL |     while let 0..=2 | 1 = 0 {}
-   |                       ^
+   |               -----   ^ unreachable pattern
+   |               |
+   |               matches all the values already
    |
 note: the lint level is defined here
   --> $DIR/top-level-alternation.rs:1:9
@@ -14,61 +16,84 @@ error: unreachable pattern
   --> $DIR/top-level-alternation.rs:5:20
    |
 LL |     if let 0..=2 | 1 = 0 {}
-   |                    ^
+   |            -----   ^ unreachable pattern
+   |            |
+   |            matches all the values already
 
 error: unreachable pattern
   --> $DIR/top-level-alternation.rs:9:15
    |
+LL |         0
+   |         - matches all the values already
 LL |             | 0 => {}
-   |               ^
+   |               ^ unreachable pattern
 
 error: unreachable pattern
   --> $DIR/top-level-alternation.rs:14:15
    |
+LL |         Some(0)
+   |         ------- matches all the values already
 LL |             | Some(0) => {}
-   |               ^^^^^^^
+   |               ^^^^^^^ unreachable pattern
 
 error: unreachable pattern
   --> $DIR/top-level-alternation.rs:19:9
    |
+LL |         (0, _) | (_, 0) => {}
+   |         --------------- matches all the values already
 LL |         (0, 0) => {}
-   |         ^^^^^^
+   |         ^^^^^^ unreachable pattern
 
 error: unreachable pattern
   --> $DIR/top-level-alternation.rs:39:9
    |
+LL |         None | Some(_) => {}
+   |         -------------- matches all the values already
 LL |         _ => {}
-   |         ^
+   |         ^ unreachable pattern
 
 error: unreachable pattern
   --> $DIR/top-level-alternation.rs:43:9
    |
+LL |         None | Some(_) => {}
+   |         -------------- matches all the values already
 LL |         Some(_) => {}
-   |         ^^^^^^^
+   |         ^^^^^^^ unreachable pattern
 
 error: unreachable pattern
   --> $DIR/top-level-alternation.rs:44:9
    |
+LL |         None | Some(_) => {}
+   |         -------------- matches all the values already
+LL |         Some(_) => {}
 LL |         None => {}
-   |         ^^^^
+   |         ^^^^ unreachable pattern
 
 error: unreachable pattern
   --> $DIR/top-level-alternation.rs:49:9
    |
+LL |         Some(_) => {}
+   |         ------- matches some of the same values
+LL |         None => {}
+   |         ---- matches some of the same values
 LL |         None | Some(_) => {}
-   |         ^^^^^^^^^^^^^^
+   |         ^^^^^^^^^^^^^^ unreachable pattern
 
 error: unreachable pattern
   --> $DIR/top-level-alternation.rs:53:9
    |
+LL |         1 | 2 => {},
+   |         ----- matches all the values already
 LL |         1..=2 => {},
-   |         ^^^^^
+   |         ^^^^^ unreachable pattern
 
 error: unreachable pattern
   --> $DIR/top-level-alternation.rs:56:14
    |
 LL |     let (0 | 0) = 0 else { return };
-   |              ^
+   |          -   ^ unreachable pattern
+   |          |
+   |          matches all the values already
 
 error: aborting due to 11 previous errors