about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--compiler/rustc_mir_build/messages.ftl2
-rw-r--r--compiler/rustc_mir_build/src/errors.rs11
-rw-r--r--compiler/rustc_mir_build/src/thir/pattern/check_match.rs4
-rw-r--r--tests/ui/pattern/usefulness/empty-match-check-notes.exhaustive_patterns.stderr12
-rw-r--r--tests/ui/pattern/usefulness/empty-match-check-notes.normal.stderr12
-rw-r--r--tests/ui/pattern/usefulness/empty-types.exhaustive_patterns.stderr105
-rw-r--r--tests/ui/pattern/usefulness/empty-types.never_pats.stderr105
-rw-r--r--tests/ui/pattern/usefulness/empty-types.normal.stderr105
-rw-r--r--tests/ui/pattern/usefulness/explain-unreachable-pats.stderr9
-rw-r--r--tests/ui/pattern/usefulness/impl-trait.stderr24
-rw-r--r--tests/ui/reachable/unreachable-loop-patterns.stderr3
-rw-r--r--tests/ui/reachable/unreachable-try-pattern.stderr6
-rw-r--r--tests/ui/rfcs/rfc-0000-never_patterns/unreachable.stderr18
-rw-r--r--tests/ui/rfcs/rfc-2008-non-exhaustive/enum_same_crate_empty_match.stderr3
-rw-r--r--tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/patterns_same_crate.stderr15
-rw-r--r--tests/ui/uninhabited/uninhabited-patterns.stderr9
16 files changed, 149 insertions, 294 deletions
diff --git a/compiler/rustc_mir_build/messages.ftl b/compiler/rustc_mir_build/messages.ftl
index 15da430759b..7a10e627ccd 100644
--- a/compiler/rustc_mir_build/messages.ftl
+++ b/compiler/rustc_mir_build/messages.ftl
@@ -333,7 +333,7 @@ mir_build_unreachable_matches_same_values = matches some of the same values
 
 mir_build_unreachable_pattern = unreachable pattern
     .label = no value can reach this
-    .unreachable_matches_no_values = matches no values because `{$ty}` is uninhabited
+    .unreachable_matches_no_values = matches no values because `{$matches_no_values_ty}` is uninhabited
     .unreachable_uninhabited_note = to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
     .unreachable_covered_by_catchall = matches any value
     .unreachable_covered_by_one = matches all the relevant values
diff --git a/compiler/rustc_mir_build/src/errors.rs b/compiler/rustc_mir_build/src/errors.rs
index 76b765ad4cd..1e470f32eb0 100644
--- a/compiler/rustc_mir_build/src/errors.rs
+++ b/compiler/rustc_mir_build/src/errors.rs
@@ -586,8 +586,9 @@ pub(crate) struct NonConstPath {
 pub(crate) struct UnreachablePattern<'tcx> {
     #[label]
     pub(crate) span: Option<Span>,
-    #[subdiagnostic]
-    pub(crate) matches_no_values: Option<UnreachableMatchesNoValues<'tcx>>,
+    #[label(mir_build_unreachable_matches_no_values)]
+    pub(crate) matches_no_values: Option<Span>,
+    pub(crate) matches_no_values_ty: Ty<'tcx>,
     #[note(mir_build_unreachable_uninhabited_note)]
     pub(crate) uninhabited_note: Option<()>,
     #[label(mir_build_unreachable_covered_by_catchall)]
@@ -599,12 +600,6 @@ pub(crate) struct UnreachablePattern<'tcx> {
     pub(crate) covered_by_many_n_more_count: usize,
 }
 
-#[derive(Subdiagnostic)]
-#[note(mir_build_unreachable_matches_no_values)]
-pub(crate) struct UnreachableMatchesNoValues<'tcx> {
-    pub(crate) ty: Ty<'tcx>,
-}
-
 #[derive(Diagnostic)]
 #[diag(mir_build_const_pattern_depends_on_generic_parameter, code = E0158)]
 pub(crate) struct ConstPatternDependsOnGenericParameter {
diff --git a/compiler/rustc_mir_build/src/thir/pattern/check_match.rs b/compiler/rustc_mir_build/src/thir/pattern/check_match.rs
index ca563e01569..e5f9f64c220 100644
--- a/compiler/rustc_mir_build/src/thir/pattern/check_match.rs
+++ b/compiler/rustc_mir_build/src/thir/pattern/check_match.rs
@@ -922,6 +922,7 @@ fn report_unreachable_pattern<'p, 'tcx>(
     let mut lint = UnreachablePattern {
         span: Some(pat_span),
         matches_no_values: None,
+        matches_no_values_ty: **pat.ty(),
         uninhabited_note: None,
         covered_by_catchall: None,
         covered_by_one: None,
@@ -933,10 +934,11 @@ fn report_unreachable_pattern<'p, 'tcx>(
             // Empty pattern; we report the uninhabited type that caused the emptiness.
             lint.span = None; // Don't label the pattern itself
             lint.uninhabited_note = Some(()); // Give a link about empty types
+            lint.matches_no_values = Some(pat_span);
             pat.walk(&mut |subpat| {
                 let ty = **subpat.ty();
                 if cx.is_uninhabited(ty) {
-                    lint.matches_no_values = Some(UnreachableMatchesNoValues { ty });
+                    lint.matches_no_values_ty = ty;
                     false // No need to dig further.
                 } else if matches!(subpat.ctor(), Constructor::Ref | Constructor::UnionField) {
                     false // Don't explore further since they are not by-value.
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 5ec14a7597a..60ab4d52c30 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
@@ -2,9 +2,8 @@ error: unreachable pattern
   --> $DIR/empty-match-check-notes.rs:17:9
    |
 LL |         _ => {}
-   |         ^
+   |         ^ matches no values because `EmptyEnum` is uninhabited
    |
-   = note: matches no values because `EmptyEnum` is uninhabited
    = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
 note: the lint level is defined here
   --> $DIR/empty-match-check-notes.rs:7:9
@@ -16,27 +15,24 @@ error: unreachable pattern
   --> $DIR/empty-match-check-notes.rs:22:9
    |
 LL |         _ if false => {}
-   |         ^
+   |         ^ matches no values because `EmptyEnum` is uninhabited
    |
-   = note: matches no values because `EmptyEnum` is uninhabited
    = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
 
 error: unreachable pattern
   --> $DIR/empty-match-check-notes.rs:31:9
    |
 LL |         _ => {}
-   |         ^
+   |         ^ matches no values because `EmptyForeignEnum` is uninhabited
    |
-   = note: matches no values because `EmptyForeignEnum` is uninhabited
    = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
 
 error: unreachable pattern
   --> $DIR/empty-match-check-notes.rs:36:9
    |
 LL |         _ if false => {}
-   |         ^
+   |         ^ matches no values because `EmptyForeignEnum` is uninhabited
    |
-   = note: matches no values because `EmptyForeignEnum` is uninhabited
    = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
 
 error[E0005]: refutable pattern in local binding
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 5ec14a7597a..60ab4d52c30 100644
--- a/tests/ui/pattern/usefulness/empty-match-check-notes.normal.stderr
+++ b/tests/ui/pattern/usefulness/empty-match-check-notes.normal.stderr
@@ -2,9 +2,8 @@ error: unreachable pattern
   --> $DIR/empty-match-check-notes.rs:17:9
    |
 LL |         _ => {}
-   |         ^
+   |         ^ matches no values because `EmptyEnum` is uninhabited
    |
-   = note: matches no values because `EmptyEnum` is uninhabited
    = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
 note: the lint level is defined here
   --> $DIR/empty-match-check-notes.rs:7:9
@@ -16,27 +15,24 @@ error: unreachable pattern
   --> $DIR/empty-match-check-notes.rs:22:9
    |
 LL |         _ if false => {}
-   |         ^
+   |         ^ matches no values because `EmptyEnum` is uninhabited
    |
-   = note: matches no values because `EmptyEnum` is uninhabited
    = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
 
 error: unreachable pattern
   --> $DIR/empty-match-check-notes.rs:31:9
    |
 LL |         _ => {}
-   |         ^
+   |         ^ matches no values because `EmptyForeignEnum` is uninhabited
    |
-   = note: matches no values because `EmptyForeignEnum` is uninhabited
    = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
 
 error: unreachable pattern
   --> $DIR/empty-match-check-notes.rs:36:9
    |
 LL |         _ if false => {}
-   |         ^
+   |         ^ matches no values because `EmptyForeignEnum` is uninhabited
    |
-   = note: matches no values because `EmptyForeignEnum` is uninhabited
    = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
 
 error[E0005]: refutable pattern in local binding
diff --git a/tests/ui/pattern/usefulness/empty-types.exhaustive_patterns.stderr b/tests/ui/pattern/usefulness/empty-types.exhaustive_patterns.stderr
index 4e5f1d0ea8c..9decddfe5de 100644
--- a/tests/ui/pattern/usefulness/empty-types.exhaustive_patterns.stderr
+++ b/tests/ui/pattern/usefulness/empty-types.exhaustive_patterns.stderr
@@ -2,9 +2,8 @@ error: unreachable pattern
   --> $DIR/empty-types.rs:49:9
    |
 LL |         _ => {}
-   |         ^
+   |         ^ matches no values because `!` is uninhabited
    |
-   = note: matches no values because `!` is uninhabited
    = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
 note: the lint level is defined here
   --> $DIR/empty-types.rs:15:9
@@ -16,9 +15,8 @@ error: unreachable pattern
   --> $DIR/empty-types.rs:52:9
    |
 LL |         _x => {}
-   |         ^^
+   |         ^^ matches no values because `!` is uninhabited
    |
-   = note: matches no values because `!` is uninhabited
    = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
 
 error[E0004]: non-exhaustive patterns: type `&!` is non-empty
@@ -40,36 +38,32 @@ error: unreachable pattern
   --> $DIR/empty-types.rs:70:9
    |
 LL |         (_, _) => {}
-   |         ^^^^^^
+   |         ^^^^^^ matches no values because `(u32, !)` is uninhabited
    |
-   = note: matches no values because `(u32, !)` is uninhabited
    = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
 
 error: unreachable pattern
   --> $DIR/empty-types.rs:76:9
    |
 LL |         _ => {}
-   |         ^
+   |         ^ matches no values because `(!, !)` is uninhabited
    |
-   = note: matches no values because `(!, !)` is uninhabited
    = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
 
 error: unreachable pattern
   --> $DIR/empty-types.rs:79:9
    |
 LL |         (_, _) => {}
-   |         ^^^^^^
+   |         ^^^^^^ matches no values because `(!, !)` is uninhabited
    |
-   = note: matches no values because `(!, !)` is uninhabited
    = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
 
 error: unreachable pattern
   --> $DIR/empty-types.rs:83:9
    |
 LL |         _ => {}
-   |         ^
+   |         ^ matches no values because `!` is uninhabited
    |
-   = note: matches no values because `!` is uninhabited
    = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
 
 error[E0004]: non-exhaustive patterns: `Ok(_)` not covered
@@ -95,18 +89,16 @@ error: unreachable pattern
   --> $DIR/empty-types.rs:94:9
    |
 LL |         Err(_) => {}
-   |         ^^^^^^
+   |         ^^^^^^ matches no values because `!` is uninhabited
    |
-   = note: matches no values because `!` is uninhabited
    = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
 
 error: unreachable pattern
   --> $DIR/empty-types.rs:99:9
    |
 LL |         Err(_) => {}
-   |         ^^^^^^
+   |         ^^^^^^ matches no values because `!` is uninhabited
    |
-   = note: matches no values because `!` is uninhabited
    = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
 
 error[E0004]: non-exhaustive patterns: `Ok(1_u32..=u32::MAX)` not covered
@@ -145,81 +137,72 @@ error: unreachable pattern
   --> $DIR/empty-types.rs:112:9
    |
 LL |         _ => {}
-   |         ^
+   |         ^ matches no values because `Result<!, !>` is uninhabited
    |
-   = note: matches no values because `Result<!, !>` is uninhabited
    = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
 
 error: unreachable pattern
   --> $DIR/empty-types.rs:115:9
    |
 LL |         Ok(_) => {}
-   |         ^^^^^
+   |         ^^^^^ matches no values because `Result<!, !>` is uninhabited
    |
-   = note: matches no values because `Result<!, !>` is uninhabited
    = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
 
 error: unreachable pattern
   --> $DIR/empty-types.rs:118:9
    |
 LL |         Ok(_) => {}
-   |         ^^^^^
+   |         ^^^^^ matches no values because `Result<!, !>` is uninhabited
    |
-   = note: matches no values because `Result<!, !>` is uninhabited
    = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
 
 error: unreachable pattern
   --> $DIR/empty-types.rs:119:9
    |
 LL |         _ => {}
-   |         ^
+   |         ^ matches no values because `Result<!, !>` is uninhabited
    |
-   = note: matches no values because `Result<!, !>` is uninhabited
    = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
 
 error: unreachable pattern
   --> $DIR/empty-types.rs:122:9
    |
 LL |         Ok(_) => {}
-   |         ^^^^^
+   |         ^^^^^ matches no values because `Result<!, !>` is uninhabited
    |
-   = note: matches no values because `Result<!, !>` is uninhabited
    = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
 
 error: unreachable pattern
   --> $DIR/empty-types.rs:123:9
    |
 LL |         Err(_) => {}
-   |         ^^^^^^
+   |         ^^^^^^ matches no values because `Result<!, !>` is uninhabited
    |
-   = note: matches no values because `Result<!, !>` is uninhabited
    = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
 
 error: unreachable pattern
   --> $DIR/empty-types.rs:132:13
    |
 LL |             _ => {}
-   |             ^
+   |             ^ matches no values because `Void` is uninhabited
    |
-   = note: matches no values because `Void` is uninhabited
    = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
 
 error: unreachable pattern
   --> $DIR/empty-types.rs:135:13
    |
 LL |             _ if false => {}
-   |             ^
+   |             ^ matches no values because `Void` is uninhabited
    |
-   = note: matches no values because `Void` is uninhabited
    = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
 
 error: unreachable pattern
   --> $DIR/empty-types.rs:143:13
    |
 LL |             Some(_) => {}
-   |             ^^^^^^^
+   |             ^^^^^^^ matches no values because `Void` is uninhabited
    |
-   = note: matches no values because `Void` is uninhabited
    = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
 
 error: unreachable pattern
@@ -234,81 +217,72 @@ error: unreachable pattern
   --> $DIR/empty-types.rs:199:13
    |
 LL |             _ => {}
-   |             ^
+   |             ^ matches no values because `!` is uninhabited
    |
-   = note: matches no values because `!` is uninhabited
    = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
 
 error: unreachable pattern
   --> $DIR/empty-types.rs:204:13
    |
 LL |             _ => {}
-   |             ^
+   |             ^ matches no values because `!` is uninhabited
    |
-   = note: matches no values because `!` is uninhabited
    = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
 
 error: unreachable pattern
   --> $DIR/empty-types.rs:209:13
    |
 LL |             _ => {}
-   |             ^
+   |             ^ matches no values because `!` is uninhabited
    |
-   = note: matches no values because `!` is uninhabited
    = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
 
 error: unreachable pattern
   --> $DIR/empty-types.rs:214:13
    |
 LL |             _ => {}
-   |             ^
+   |             ^ matches no values because `!` is uninhabited
    |
-   = note: matches no values because `!` is uninhabited
    = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
 
 error: unreachable pattern
   --> $DIR/empty-types.rs:220:13
    |
 LL |             _ => {}
-   |             ^
+   |             ^ matches no values because `!` is uninhabited
    |
-   = note: matches no values because `!` is uninhabited
    = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
 
 error: unreachable pattern
   --> $DIR/empty-types.rs:281:9
    |
 LL |         _ => {}
-   |         ^
+   |         ^ matches no values because `!` is uninhabited
    |
-   = note: matches no values because `!` is uninhabited
    = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
 
 error: unreachable pattern
   --> $DIR/empty-types.rs:284:9
    |
 LL |         (_, _) => {}
-   |         ^^^^^^
+   |         ^^^^^^ matches no values because `(!, !)` is uninhabited
    |
-   = note: matches no values because `(!, !)` is uninhabited
    = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
 
 error: unreachable pattern
   --> $DIR/empty-types.rs:287:9
    |
 LL |         Ok(_) => {}
-   |         ^^^^^
+   |         ^^^^^ matches no values because `Result<!, !>` is uninhabited
    |
-   = note: matches no values because `Result<!, !>` is uninhabited
    = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
 
 error: unreachable pattern
   --> $DIR/empty-types.rs:288:9
    |
 LL |         Err(_) => {}
-   |         ^^^^^^
+   |         ^^^^^^ matches no values because `Result<!, !>` is uninhabited
    |
-   = note: matches no values because `Result<!, !>` is uninhabited
    = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
 
 error[E0004]: non-exhaustive patterns: type `&[!]` is non-empty
@@ -370,27 +344,24 @@ error: unreachable pattern
   --> $DIR/empty-types.rs:368:9
    |
 LL |         _ => {}
-   |         ^
+   |         ^ matches no values because `[!; 3]` is uninhabited
    |
-   = note: matches no values because `[!; 3]` is uninhabited
    = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
 
 error: unreachable pattern
   --> $DIR/empty-types.rs:371:9
    |
 LL |         [_, _, _] => {}
-   |         ^^^^^^^^^
+   |         ^^^^^^^^^ matches no values because `[!; 3]` is uninhabited
    |
-   = note: matches no values because `[!; 3]` is uninhabited
    = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
 
 error: unreachable pattern
   --> $DIR/empty-types.rs:374:9
    |
 LL |         [_, ..] => {}
-   |         ^^^^^^^
+   |         ^^^^^^^ matches no values because `[!; 3]` is uninhabited
    |
-   = note: matches no values because `[!; 3]` is uninhabited
    = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
 
 error[E0004]: non-exhaustive patterns: type `[!; 0]` is non-empty
@@ -433,18 +404,16 @@ error: unreachable pattern
   --> $DIR/empty-types.rs:416:9
    |
 LL |         Some(_) => {}
-   |         ^^^^^^^
+   |         ^^^^^^^ matches no values because `!` is uninhabited
    |
-   = note: matches no values because `!` is uninhabited
    = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
 
 error: unreachable pattern
   --> $DIR/empty-types.rs:421:9
    |
 LL |         Some(_a) => {}
-   |         ^^^^^^^^
+   |         ^^^^^^^^ matches no values because `!` is uninhabited
    |
-   = note: matches no values because `!` is uninhabited
    = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
 
 error: unreachable pattern
@@ -469,36 +438,32 @@ error: unreachable pattern
   --> $DIR/empty-types.rs:603:9
    |
 LL |         _ => {}
-   |         ^
+   |         ^ matches no values because `!` is uninhabited
    |
-   = note: matches no values because `!` is uninhabited
    = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
 
 error: unreachable pattern
   --> $DIR/empty-types.rs:606:9
    |
 LL |         _x => {}
-   |         ^^
+   |         ^^ matches no values because `!` is uninhabited
    |
-   = note: matches no values because `!` is uninhabited
    = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
 
 error: unreachable pattern
   --> $DIR/empty-types.rs:609:9
    |
 LL |         _ if false => {}
-   |         ^
+   |         ^ matches no values because `!` is uninhabited
    |
-   = note: matches no values because `!` is uninhabited
    = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
 
 error: unreachable pattern
   --> $DIR/empty-types.rs:612:9
    |
 LL |         _x if false => {}
-   |         ^^
+   |         ^^ matches no values because `!` is uninhabited
    |
-   = note: matches no values because `!` is uninhabited
    = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
 
 error: aborting due to 49 previous errors
diff --git a/tests/ui/pattern/usefulness/empty-types.never_pats.stderr b/tests/ui/pattern/usefulness/empty-types.never_pats.stderr
index 3332eab8a77..68213a2d661 100644
--- a/tests/ui/pattern/usefulness/empty-types.never_pats.stderr
+++ b/tests/ui/pattern/usefulness/empty-types.never_pats.stderr
@@ -11,9 +11,8 @@ error: unreachable pattern
   --> $DIR/empty-types.rs:49:9
    |
 LL |         _ => {}
-   |         ^
+   |         ^ matches no values because `!` is uninhabited
    |
-   = note: matches no values because `!` is uninhabited
    = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
 note: the lint level is defined here
   --> $DIR/empty-types.rs:15:9
@@ -25,9 +24,8 @@ error: unreachable pattern
   --> $DIR/empty-types.rs:52:9
    |
 LL |         _x => {}
-   |         ^^
+   |         ^^ matches no values because `!` is uninhabited
    |
-   = note: matches no values because `!` is uninhabited
    = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
 
 error[E0004]: non-exhaustive patterns: type `&!` is non-empty
@@ -49,36 +47,32 @@ error: unreachable pattern
   --> $DIR/empty-types.rs:70:9
    |
 LL |         (_, _) => {}
-   |         ^^^^^^
+   |         ^^^^^^ matches no values because `(u32, !)` is uninhabited
    |
-   = note: matches no values because `(u32, !)` is uninhabited
    = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
 
 error: unreachable pattern
   --> $DIR/empty-types.rs:76:9
    |
 LL |         _ => {}
-   |         ^
+   |         ^ matches no values because `(!, !)` is uninhabited
    |
-   = note: matches no values because `(!, !)` is uninhabited
    = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
 
 error: unreachable pattern
   --> $DIR/empty-types.rs:79:9
    |
 LL |         (_, _) => {}
-   |         ^^^^^^
+   |         ^^^^^^ matches no values because `(!, !)` is uninhabited
    |
-   = note: matches no values because `(!, !)` is uninhabited
    = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
 
 error: unreachable pattern
   --> $DIR/empty-types.rs:83:9
    |
 LL |         _ => {}
-   |         ^
+   |         ^ matches no values because `!` is uninhabited
    |
-   = note: matches no values because `!` is uninhabited
    = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
 
 error[E0004]: non-exhaustive patterns: `Ok(_)` not covered
@@ -104,18 +98,16 @@ error: unreachable pattern
   --> $DIR/empty-types.rs:94:9
    |
 LL |         Err(_) => {}
-   |         ^^^^^^
+   |         ^^^^^^ matches no values because `!` is uninhabited
    |
-   = note: matches no values because `!` is uninhabited
    = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
 
 error: unreachable pattern
   --> $DIR/empty-types.rs:99:9
    |
 LL |         Err(_) => {}
-   |         ^^^^^^
+   |         ^^^^^^ matches no values because `!` is uninhabited
    |
-   = note: matches no values because `!` is uninhabited
    = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
 
 error[E0004]: non-exhaustive patterns: `Ok(1_u32..=u32::MAX)` not covered
@@ -168,81 +160,72 @@ error: unreachable pattern
   --> $DIR/empty-types.rs:112:9
    |
 LL |         _ => {}
-   |         ^
+   |         ^ matches no values because `Result<!, !>` is uninhabited
    |
-   = note: matches no values because `Result<!, !>` is uninhabited
    = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
 
 error: unreachable pattern
   --> $DIR/empty-types.rs:115:9
    |
 LL |         Ok(_) => {}
-   |         ^^^^^
+   |         ^^^^^ matches no values because `Result<!, !>` is uninhabited
    |
-   = note: matches no values because `Result<!, !>` is uninhabited
    = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
 
 error: unreachable pattern
   --> $DIR/empty-types.rs:118:9
    |
 LL |         Ok(_) => {}
-   |         ^^^^^
+   |         ^^^^^ matches no values because `Result<!, !>` is uninhabited
    |
-   = note: matches no values because `Result<!, !>` is uninhabited
    = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
 
 error: unreachable pattern
   --> $DIR/empty-types.rs:119:9
    |
 LL |         _ => {}
-   |         ^
+   |         ^ matches no values because `Result<!, !>` is uninhabited
    |
-   = note: matches no values because `Result<!, !>` is uninhabited
    = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
 
 error: unreachable pattern
   --> $DIR/empty-types.rs:122:9
    |
 LL |         Ok(_) => {}
-   |         ^^^^^
+   |         ^^^^^ matches no values because `Result<!, !>` is uninhabited
    |
-   = note: matches no values because `Result<!, !>` is uninhabited
    = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
 
 error: unreachable pattern
   --> $DIR/empty-types.rs:123:9
    |
 LL |         Err(_) => {}
-   |         ^^^^^^
+   |         ^^^^^^ matches no values because `Result<!, !>` is uninhabited
    |
-   = note: matches no values because `Result<!, !>` is uninhabited
    = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
 
 error: unreachable pattern
   --> $DIR/empty-types.rs:132:13
    |
 LL |             _ => {}
-   |             ^
+   |             ^ matches no values because `Void` is uninhabited
    |
-   = note: matches no values because `Void` is uninhabited
    = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
 
 error: unreachable pattern
   --> $DIR/empty-types.rs:135:13
    |
 LL |             _ if false => {}
-   |             ^
+   |             ^ matches no values because `Void` is uninhabited
    |
-   = note: matches no values because `Void` is uninhabited
    = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
 
 error: unreachable pattern
   --> $DIR/empty-types.rs:143:13
    |
 LL |             Some(_) => {}
-   |             ^^^^^^^
+   |             ^^^^^^^ matches no values because `Void` is uninhabited
    |
-   = note: matches no values because `Void` is uninhabited
    = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
 
 error: unreachable pattern
@@ -276,81 +259,72 @@ error: unreachable pattern
   --> $DIR/empty-types.rs:199:13
    |
 LL |             _ => {}
-   |             ^
+   |             ^ matches no values because `!` is uninhabited
    |
-   = note: matches no values because `!` is uninhabited
    = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
 
 error: unreachable pattern
   --> $DIR/empty-types.rs:204:13
    |
 LL |             _ => {}
-   |             ^
+   |             ^ matches no values because `!` is uninhabited
    |
-   = note: matches no values because `!` is uninhabited
    = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
 
 error: unreachable pattern
   --> $DIR/empty-types.rs:209:13
    |
 LL |             _ => {}
-   |             ^
+   |             ^ matches no values because `!` is uninhabited
    |
-   = note: matches no values because `!` is uninhabited
    = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
 
 error: unreachable pattern
   --> $DIR/empty-types.rs:214:13
    |
 LL |             _ => {}
-   |             ^
+   |             ^ matches no values because `!` is uninhabited
    |
-   = note: matches no values because `!` is uninhabited
    = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
 
 error: unreachable pattern
   --> $DIR/empty-types.rs:220:13
    |
 LL |             _ => {}
-   |             ^
+   |             ^ matches no values because `!` is uninhabited
    |
-   = note: matches no values because `!` is uninhabited
    = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
 
 error: unreachable pattern
   --> $DIR/empty-types.rs:281:9
    |
 LL |         _ => {}
-   |         ^
+   |         ^ matches no values because `!` is uninhabited
    |
-   = note: matches no values because `!` is uninhabited
    = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
 
 error: unreachable pattern
   --> $DIR/empty-types.rs:284:9
    |
 LL |         (_, _) => {}
-   |         ^^^^^^
+   |         ^^^^^^ matches no values because `(!, !)` is uninhabited
    |
-   = note: matches no values because `(!, !)` is uninhabited
    = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
 
 error: unreachable pattern
   --> $DIR/empty-types.rs:287:9
    |
 LL |         Ok(_) => {}
-   |         ^^^^^
+   |         ^^^^^ matches no values because `Result<!, !>` is uninhabited
    |
-   = note: matches no values because `Result<!, !>` is uninhabited
    = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
 
 error: unreachable pattern
   --> $DIR/empty-types.rs:288:9
    |
 LL |         Err(_) => {}
-   |         ^^^^^^
+   |         ^^^^^^ matches no values because `Result<!, !>` is uninhabited
    |
-   = note: matches no values because `Result<!, !>` is uninhabited
    = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
 
 error[E0005]: refutable pattern in local binding
@@ -504,27 +478,24 @@ error: unreachable pattern
   --> $DIR/empty-types.rs:368:9
    |
 LL |         _ => {}
-   |         ^
+   |         ^ matches no values because `[!; 3]` is uninhabited
    |
-   = note: matches no values because `[!; 3]` is uninhabited
    = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
 
 error: unreachable pattern
   --> $DIR/empty-types.rs:371:9
    |
 LL |         [_, _, _] => {}
-   |         ^^^^^^^^^
+   |         ^^^^^^^^^ matches no values because `[!; 3]` is uninhabited
    |
-   = note: matches no values because `[!; 3]` is uninhabited
    = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
 
 error: unreachable pattern
   --> $DIR/empty-types.rs:374:9
    |
 LL |         [_, ..] => {}
-   |         ^^^^^^^
+   |         ^^^^^^^ matches no values because `[!; 3]` is uninhabited
    |
-   = note: matches no values because `[!; 3]` is uninhabited
    = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
 
 error[E0004]: non-exhaustive patterns: type `[!; 0]` is non-empty
@@ -567,18 +538,16 @@ error: unreachable pattern
   --> $DIR/empty-types.rs:416:9
    |
 LL |         Some(_) => {}
-   |         ^^^^^^^
+   |         ^^^^^^^ matches no values because `!` is uninhabited
    |
-   = note: matches no values because `!` is uninhabited
    = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
 
 error: unreachable pattern
   --> $DIR/empty-types.rs:421:9
    |
 LL |         Some(_a) => {}
-   |         ^^^^^^^^
+   |         ^^^^^^^^ matches no values because `!` is uninhabited
    |
-   = note: matches no values because `!` is uninhabited
    = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
 
 error: unreachable pattern
@@ -693,36 +662,32 @@ error: unreachable pattern
   --> $DIR/empty-types.rs:603:9
    |
 LL |         _ => {}
-   |         ^
+   |         ^ matches no values because `!` is uninhabited
    |
-   = note: matches no values because `!` is uninhabited
    = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
 
 error: unreachable pattern
   --> $DIR/empty-types.rs:606:9
    |
 LL |         _x => {}
-   |         ^^
+   |         ^^ matches no values because `!` is uninhabited
    |
-   = note: matches no values because `!` is uninhabited
    = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
 
 error: unreachable pattern
   --> $DIR/empty-types.rs:609:9
    |
 LL |         _ if false => {}
-   |         ^
+   |         ^ matches no values because `!` is uninhabited
    |
-   = note: matches no values because `!` is uninhabited
    = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
 
 error: unreachable pattern
   --> $DIR/empty-types.rs:612:9
    |
 LL |         _x if false => {}
-   |         ^^
+   |         ^^ matches no values because `!` is uninhabited
    |
-   = note: matches no values because `!` is uninhabited
    = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
 
 error[E0004]: non-exhaustive patterns: `&!` not covered
diff --git a/tests/ui/pattern/usefulness/empty-types.normal.stderr b/tests/ui/pattern/usefulness/empty-types.normal.stderr
index 89cf09f011e..8f60dad4467 100644
--- a/tests/ui/pattern/usefulness/empty-types.normal.stderr
+++ b/tests/ui/pattern/usefulness/empty-types.normal.stderr
@@ -2,9 +2,8 @@ error: unreachable pattern
   --> $DIR/empty-types.rs:49:9
    |
 LL |         _ => {}
-   |         ^
+   |         ^ matches no values because `!` is uninhabited
    |
-   = note: matches no values because `!` is uninhabited
    = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
 note: the lint level is defined here
   --> $DIR/empty-types.rs:15:9
@@ -16,9 +15,8 @@ error: unreachable pattern
   --> $DIR/empty-types.rs:52:9
    |
 LL |         _x => {}
-   |         ^^
+   |         ^^ matches no values because `!` is uninhabited
    |
-   = note: matches no values because `!` is uninhabited
    = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
 
 error[E0004]: non-exhaustive patterns: type `&!` is non-empty
@@ -40,36 +38,32 @@ error: unreachable pattern
   --> $DIR/empty-types.rs:70:9
    |
 LL |         (_, _) => {}
-   |         ^^^^^^
+   |         ^^^^^^ matches no values because `(u32, !)` is uninhabited
    |
-   = note: matches no values because `(u32, !)` is uninhabited
    = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
 
 error: unreachable pattern
   --> $DIR/empty-types.rs:76:9
    |
 LL |         _ => {}
-   |         ^
+   |         ^ matches no values because `(!, !)` is uninhabited
    |
-   = note: matches no values because `(!, !)` is uninhabited
    = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
 
 error: unreachable pattern
   --> $DIR/empty-types.rs:79:9
    |
 LL |         (_, _) => {}
-   |         ^^^^^^
+   |         ^^^^^^ matches no values because `(!, !)` is uninhabited
    |
-   = note: matches no values because `(!, !)` is uninhabited
    = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
 
 error: unreachable pattern
   --> $DIR/empty-types.rs:83:9
    |
 LL |         _ => {}
-   |         ^
+   |         ^ matches no values because `!` is uninhabited
    |
-   = note: matches no values because `!` is uninhabited
    = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
 
 error[E0004]: non-exhaustive patterns: `Ok(_)` not covered
@@ -95,18 +89,16 @@ error: unreachable pattern
   --> $DIR/empty-types.rs:94:9
    |
 LL |         Err(_) => {}
-   |         ^^^^^^
+   |         ^^^^^^ matches no values because `!` is uninhabited
    |
-   = note: matches no values because `!` is uninhabited
    = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
 
 error: unreachable pattern
   --> $DIR/empty-types.rs:99:9
    |
 LL |         Err(_) => {}
-   |         ^^^^^^
+   |         ^^^^^^ matches no values because `!` is uninhabited
    |
-   = note: matches no values because `!` is uninhabited
    = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
 
 error[E0004]: non-exhaustive patterns: `Ok(1_u32..=u32::MAX)` not covered
@@ -159,81 +151,72 @@ error: unreachable pattern
   --> $DIR/empty-types.rs:112:9
    |
 LL |         _ => {}
-   |         ^
+   |         ^ matches no values because `Result<!, !>` is uninhabited
    |
-   = note: matches no values because `Result<!, !>` is uninhabited
    = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
 
 error: unreachable pattern
   --> $DIR/empty-types.rs:115:9
    |
 LL |         Ok(_) => {}
-   |         ^^^^^
+   |         ^^^^^ matches no values because `Result<!, !>` is uninhabited
    |
-   = note: matches no values because `Result<!, !>` is uninhabited
    = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
 
 error: unreachable pattern
   --> $DIR/empty-types.rs:118:9
    |
 LL |         Ok(_) => {}
-   |         ^^^^^
+   |         ^^^^^ matches no values because `Result<!, !>` is uninhabited
    |
-   = note: matches no values because `Result<!, !>` is uninhabited
    = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
 
 error: unreachable pattern
   --> $DIR/empty-types.rs:119:9
    |
 LL |         _ => {}
-   |         ^
+   |         ^ matches no values because `Result<!, !>` is uninhabited
    |
-   = note: matches no values because `Result<!, !>` is uninhabited
    = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
 
 error: unreachable pattern
   --> $DIR/empty-types.rs:122:9
    |
 LL |         Ok(_) => {}
-   |         ^^^^^
+   |         ^^^^^ matches no values because `Result<!, !>` is uninhabited
    |
-   = note: matches no values because `Result<!, !>` is uninhabited
    = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
 
 error: unreachable pattern
   --> $DIR/empty-types.rs:123:9
    |
 LL |         Err(_) => {}
-   |         ^^^^^^
+   |         ^^^^^^ matches no values because `Result<!, !>` is uninhabited
    |
-   = note: matches no values because `Result<!, !>` is uninhabited
    = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
 
 error: unreachable pattern
   --> $DIR/empty-types.rs:132:13
    |
 LL |             _ => {}
-   |             ^
+   |             ^ matches no values because `Void` is uninhabited
    |
-   = note: matches no values because `Void` is uninhabited
    = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
 
 error: unreachable pattern
   --> $DIR/empty-types.rs:135:13
    |
 LL |             _ if false => {}
-   |             ^
+   |             ^ matches no values because `Void` is uninhabited
    |
-   = note: matches no values because `Void` is uninhabited
    = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
 
 error: unreachable pattern
   --> $DIR/empty-types.rs:143:13
    |
 LL |             Some(_) => {}
-   |             ^^^^^^^
+   |             ^^^^^^^ matches no values because `Void` is uninhabited
    |
-   = note: matches no values because `Void` is uninhabited
    = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
 
 error: unreachable pattern
@@ -267,81 +250,72 @@ error: unreachable pattern
   --> $DIR/empty-types.rs:199:13
    |
 LL |             _ => {}
-   |             ^
+   |             ^ matches no values because `!` is uninhabited
    |
-   = note: matches no values because `!` is uninhabited
    = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
 
 error: unreachable pattern
   --> $DIR/empty-types.rs:204:13
    |
 LL |             _ => {}
-   |             ^
+   |             ^ matches no values because `!` is uninhabited
    |
-   = note: matches no values because `!` is uninhabited
    = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
 
 error: unreachable pattern
   --> $DIR/empty-types.rs:209:13
    |
 LL |             _ => {}
-   |             ^
+   |             ^ matches no values because `!` is uninhabited
    |
-   = note: matches no values because `!` is uninhabited
    = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
 
 error: unreachable pattern
   --> $DIR/empty-types.rs:214:13
    |
 LL |             _ => {}
-   |             ^
+   |             ^ matches no values because `!` is uninhabited
    |
-   = note: matches no values because `!` is uninhabited
    = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
 
 error: unreachable pattern
   --> $DIR/empty-types.rs:220:13
    |
 LL |             _ => {}
-   |             ^
+   |             ^ matches no values because `!` is uninhabited
    |
-   = note: matches no values because `!` is uninhabited
    = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
 
 error: unreachable pattern
   --> $DIR/empty-types.rs:281:9
    |
 LL |         _ => {}
-   |         ^
+   |         ^ matches no values because `!` is uninhabited
    |
-   = note: matches no values because `!` is uninhabited
    = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
 
 error: unreachable pattern
   --> $DIR/empty-types.rs:284:9
    |
 LL |         (_, _) => {}
-   |         ^^^^^^
+   |         ^^^^^^ matches no values because `(!, !)` is uninhabited
    |
-   = note: matches no values because `(!, !)` is uninhabited
    = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
 
 error: unreachable pattern
   --> $DIR/empty-types.rs:287:9
    |
 LL |         Ok(_) => {}
-   |         ^^^^^
+   |         ^^^^^ matches no values because `Result<!, !>` is uninhabited
    |
-   = note: matches no values because `Result<!, !>` is uninhabited
    = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
 
 error: unreachable pattern
   --> $DIR/empty-types.rs:288:9
    |
 LL |         Err(_) => {}
-   |         ^^^^^^
+   |         ^^^^^^ matches no values because `Result<!, !>` is uninhabited
    |
-   = note: matches no values because `Result<!, !>` is uninhabited
    = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
 
 error[E0005]: refutable pattern in local binding
@@ -495,27 +469,24 @@ error: unreachable pattern
   --> $DIR/empty-types.rs:368:9
    |
 LL |         _ => {}
-   |         ^
+   |         ^ matches no values because `[!; 3]` is uninhabited
    |
-   = note: matches no values because `[!; 3]` is uninhabited
    = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
 
 error: unreachable pattern
   --> $DIR/empty-types.rs:371:9
    |
 LL |         [_, _, _] => {}
-   |         ^^^^^^^^^
+   |         ^^^^^^^^^ matches no values because `[!; 3]` is uninhabited
    |
-   = note: matches no values because `[!; 3]` is uninhabited
    = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
 
 error: unreachable pattern
   --> $DIR/empty-types.rs:374:9
    |
 LL |         [_, ..] => {}
-   |         ^^^^^^^
+   |         ^^^^^^^ matches no values because `[!; 3]` is uninhabited
    |
-   = note: matches no values because `[!; 3]` is uninhabited
    = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
 
 error[E0004]: non-exhaustive patterns: type `[!; 0]` is non-empty
@@ -558,18 +529,16 @@ error: unreachable pattern
   --> $DIR/empty-types.rs:416:9
    |
 LL |         Some(_) => {}
-   |         ^^^^^^^
+   |         ^^^^^^^ matches no values because `!` is uninhabited
    |
-   = note: matches no values because `!` is uninhabited
    = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
 
 error: unreachable pattern
   --> $DIR/empty-types.rs:421:9
    |
 LL |         Some(_a) => {}
-   |         ^^^^^^^^
+   |         ^^^^^^^^ matches no values because `!` is uninhabited
    |
-   = note: matches no values because `!` is uninhabited
    = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
 
 error: unreachable pattern
@@ -684,36 +653,32 @@ error: unreachable pattern
   --> $DIR/empty-types.rs:603:9
    |
 LL |         _ => {}
-   |         ^
+   |         ^ matches no values because `!` is uninhabited
    |
-   = note: matches no values because `!` is uninhabited
    = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
 
 error: unreachable pattern
   --> $DIR/empty-types.rs:606:9
    |
 LL |         _x => {}
-   |         ^^
+   |         ^^ matches no values because `!` is uninhabited
    |
-   = note: matches no values because `!` is uninhabited
    = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
 
 error: unreachable pattern
   --> $DIR/empty-types.rs:609:9
    |
 LL |         _ if false => {}
-   |         ^
+   |         ^ matches no values because `!` is uninhabited
    |
-   = note: matches no values because `!` is uninhabited
    = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
 
 error: unreachable pattern
   --> $DIR/empty-types.rs:612:9
    |
 LL |         _x if false => {}
-   |         ^^
+   |         ^^ matches no values because `!` is uninhabited
    |
-   = note: matches no values because `!` is uninhabited
    = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
 
 error[E0004]: non-exhaustive patterns: `&_` not covered
diff --git a/tests/ui/pattern/usefulness/explain-unreachable-pats.stderr b/tests/ui/pattern/usefulness/explain-unreachable-pats.stderr
index 1378dce6063..7023c2775e9 100644
--- a/tests/ui/pattern/usefulness/explain-unreachable-pats.stderr
+++ b/tests/ui/pattern/usefulness/explain-unreachable-pats.stderr
@@ -59,27 +59,24 @@ error: unreachable pattern
   --> $DIR/explain-unreachable-pats.rs:51:9
    |
 LL |         Err(_) => {}
-   |         ^^^^^^
+   |         ^^^^^^ matches no values because `!` is uninhabited
    |
-   = note: matches no values because `!` is uninhabited
    = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
 
 error: unreachable pattern
   --> $DIR/explain-unreachable-pats.rs:65:9
    |
 LL |         (Err(_), Err(_)) => {}
-   |         ^^^^^^^^^^^^^^^^
+   |         ^^^^^^^^^^^^^^^^ matches no values because `Void2` is uninhabited
    |
-   = note: matches no values because `Void2` is uninhabited
    = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
 
 error: unreachable pattern
   --> $DIR/explain-unreachable-pats.rs:72:9
    |
 LL |         (Err(_), Err(_)) => {}
-   |         ^^^^^^^^^^^^^^^^
+   |         ^^^^^^^^^^^^^^^^ matches no values because `Void1` is uninhabited
    |
-   = note: matches no values because `Void1` is uninhabited
    = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
 
 error: unreachable pattern
diff --git a/tests/ui/pattern/usefulness/impl-trait.stderr b/tests/ui/pattern/usefulness/impl-trait.stderr
index 0abfeb5b529..34b157f0fc4 100644
--- a/tests/ui/pattern/usefulness/impl-trait.stderr
+++ b/tests/ui/pattern/usefulness/impl-trait.stderr
@@ -2,9 +2,8 @@ error: unreachable pattern
   --> $DIR/impl-trait.rs:16:13
    |
 LL |             _ => {}
-   |             ^
+   |             ^ matches no values because `Void` is uninhabited
    |
-   = note: matches no values because `Void` is uninhabited
    = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
 note: the lint level is defined here
   --> $DIR/impl-trait.rs:4:9
@@ -16,18 +15,16 @@ error: unreachable pattern
   --> $DIR/impl-trait.rs:30:13
    |
 LL |             _ => {}
-   |             ^
+   |             ^ matches no values because `Void` is uninhabited
    |
-   = note: matches no values because `Void` is uninhabited
    = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
 
 error: unreachable pattern
   --> $DIR/impl-trait.rs:44:13
    |
 LL |             Some(_) => {}
-   |             ^^^^^^^
+   |             ^^^^^^^ matches no values because `Void` is uninhabited
    |
-   = note: matches no values because `Void` is uninhabited
    = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
 
 error: unreachable pattern
@@ -42,9 +39,8 @@ error: unreachable pattern
   --> $DIR/impl-trait.rs:58:13
    |
 LL |             Some(_) => {}
-   |             ^^^^^^^
+   |             ^^^^^^^ matches no values because `Void` is uninhabited
    |
-   = note: matches no values because `Void` is uninhabited
    = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
 
 error: unreachable pattern
@@ -59,9 +55,8 @@ error: unreachable pattern
   --> $DIR/impl-trait.rs:75:9
    |
 LL |         _ => {}
-   |         ^
+   |         ^ matches no values because `Void` is uninhabited
    |
-   = note: matches no values because `Void` is uninhabited
    = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
 
 error: unreachable pattern
@@ -76,9 +71,8 @@ error: unreachable pattern
   --> $DIR/impl-trait.rs:93:13
    |
 LL |             _ => {}
-   |             ^
+   |             ^ matches no values because `Void` is uninhabited
    |
-   = note: matches no values because `Void` is uninhabited
    = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
 
 error: unreachable pattern
@@ -101,18 +95,16 @@ error: unreachable pattern
   --> $DIR/impl-trait.rs:137:13
    |
 LL |             _ => {}
-   |             ^
+   |             ^ matches no values because `SecretelyVoid` is uninhabited
    |
-   = note: matches no values because `SecretelyVoid` is uninhabited
    = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
 
 error: unreachable pattern
   --> $DIR/impl-trait.rs:150:13
    |
 LL |             _ => {}
-   |             ^
+   |             ^ matches no values because `SecretelyDoubleVoid` is uninhabited
    |
-   = note: matches no values because `SecretelyDoubleVoid` is uninhabited
    = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
 
 error[E0004]: non-exhaustive patterns: type `impl Copy` is non-empty
diff --git a/tests/ui/reachable/unreachable-loop-patterns.stderr b/tests/ui/reachable/unreachable-loop-patterns.stderr
index f34ca3258ca..03959ac1606 100644
--- a/tests/ui/reachable/unreachable-loop-patterns.stderr
+++ b/tests/ui/reachable/unreachable-loop-patterns.stderr
@@ -2,9 +2,8 @@ error: unreachable pattern
   --> $DIR/unreachable-loop-patterns.rs:16:9
    |
 LL |     for _ in unimplemented!() as Void {}
-   |         ^
+   |         ^ matches no values because `Void` is uninhabited
    |
-   = note: matches no values because `Void` is uninhabited
    = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
 note: the lint level is defined here
   --> $DIR/unreachable-loop-patterns.rs:3:9
diff --git a/tests/ui/reachable/unreachable-try-pattern.stderr b/tests/ui/reachable/unreachable-try-pattern.stderr
index 2ead661a658..b082bc11603 100644
--- a/tests/ui/reachable/unreachable-try-pattern.stderr
+++ b/tests/ui/reachable/unreachable-try-pattern.stderr
@@ -17,9 +17,8 @@ warning: unreachable pattern
   --> $DIR/unreachable-try-pattern.rs:19:24
    |
 LL |     let y = (match x { Ok(n) => Ok(n as u32), Err(e) => Err(e) })?;
-   |                        ^^^^^
+   |                        ^^^^^ matches no values because `!` is uninhabited
    |
-   = note: matches no values because `!` is uninhabited
    = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
 note: the lint level is defined here
   --> $DIR/unreachable-try-pattern.rs:4:9
@@ -31,9 +30,8 @@ warning: unreachable pattern
   --> $DIR/unreachable-try-pattern.rs:30:40
    |
 LL |     let y = (match x { Ok(n) => Ok(n), Err(e) => Err(e) })?;
-   |                                        ^^^^^^
+   |                                        ^^^^^^ matches no values because `Void` is uninhabited
    |
-   = note: matches no values because `Void` is uninhabited
    = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
 
 warning: 3 warnings emitted
diff --git a/tests/ui/rfcs/rfc-0000-never_patterns/unreachable.stderr b/tests/ui/rfcs/rfc-0000-never_patterns/unreachable.stderr
index b7a5f3e5513..6b3f303eeab 100644
--- a/tests/ui/rfcs/rfc-0000-never_patterns/unreachable.stderr
+++ b/tests/ui/rfcs/rfc-0000-never_patterns/unreachable.stderr
@@ -2,9 +2,8 @@ error: unreachable pattern
   --> $DIR/unreachable.rs:14:9
    |
 LL |         Err(!),
-   |         ^^^^^^
+   |         ^^^^^^ matches no values because `Void` is uninhabited
    |
-   = note: matches no values because `Void` is uninhabited
    = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
 note: the lint level is defined here
   --> $DIR/unreachable.rs:4:9
@@ -16,45 +15,40 @@ error: unreachable pattern
   --> $DIR/unreachable.rs:17:19
    |
 LL |     let (Ok(_x) | Err(!)) = res_void;
-   |                   ^^^^^^
+   |                   ^^^^^^ matches no values because `Void` is uninhabited
    |
-   = note: matches no values because `Void` is uninhabited
    = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
 
 error: unreachable pattern
   --> $DIR/unreachable.rs:19:12
    |
 LL |     if let Err(!) = res_void {}
-   |            ^^^^^^
+   |            ^^^^^^ matches no values because `Void` is uninhabited
    |
-   = note: matches no values because `Void` is uninhabited
    = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
 
 error: unreachable pattern
   --> $DIR/unreachable.rs:21:24
    |
 LL |     if let (Ok(true) | Err(!)) = res_void {}
-   |                        ^^^^^^
+   |                        ^^^^^^ matches no values because `Void` is uninhabited
    |
-   = note: matches no values because `Void` is uninhabited
    = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
 
 error: unreachable pattern
   --> $DIR/unreachable.rs:23:23
    |
 LL |     for (Ok(mut _x) | Err(!)) in [res_void] {}
-   |                       ^^^^^^
+   |                       ^^^^^^ matches no values because `Void` is uninhabited
    |
-   = note: matches no values because `Void` is uninhabited
    = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
 
 error: unreachable pattern
   --> $DIR/unreachable.rs:27:18
    |
 LL | fn foo((Ok(_x) | Err(!)): Result<bool, Void>) {}
-   |                  ^^^^^^
+   |                  ^^^^^^ matches no values because `Void` is uninhabited
    |
-   = note: matches no values because `Void` is uninhabited
    = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
 
 error: aborting due to 6 previous errors
diff --git a/tests/ui/rfcs/rfc-2008-non-exhaustive/enum_same_crate_empty_match.stderr b/tests/ui/rfcs/rfc-2008-non-exhaustive/enum_same_crate_empty_match.stderr
index 88fab333c74..dfd7f9d6300 100644
--- a/tests/ui/rfcs/rfc-2008-non-exhaustive/enum_same_crate_empty_match.stderr
+++ b/tests/ui/rfcs/rfc-2008-non-exhaustive/enum_same_crate_empty_match.stderr
@@ -2,9 +2,8 @@ error: unreachable pattern
   --> $DIR/enum_same_crate_empty_match.rs:28:9
    |
 LL |         _ => {}
-   |         ^
+   |         ^ matches no values because `EmptyNonExhaustiveEnum` is uninhabited
    |
-   = note: matches no values because `EmptyNonExhaustiveEnum` is uninhabited
    = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
 note: the lint level is defined here
   --> $DIR/enum_same_crate_empty_match.rs:1:9
diff --git a/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/patterns_same_crate.stderr b/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/patterns_same_crate.stderr
index 5dbe7a2dc5a..7e7dc802e7f 100644
--- a/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/patterns_same_crate.stderr
+++ b/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/patterns_same_crate.stderr
@@ -2,9 +2,8 @@ error: unreachable pattern
   --> $DIR/patterns_same_crate.rs:51:9
    |
 LL |         Some(_x) => (),
-   |         ^^^^^^^^
+   |         ^^^^^^^^ matches no values because `UninhabitedEnum` is uninhabited
    |
-   = note: matches no values because `UninhabitedEnum` is uninhabited
    = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
 note: the lint level is defined here
   --> $DIR/patterns_same_crate.rs:1:9
@@ -16,36 +15,32 @@ error: unreachable pattern
   --> $DIR/patterns_same_crate.rs:56:9
    |
 LL |         Some(_x) => (),
-   |         ^^^^^^^^
+   |         ^^^^^^^^ matches no values because `UninhabitedVariants` is uninhabited
    |
-   = note: matches no values because `UninhabitedVariants` is uninhabited
    = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
 
 error: unreachable pattern
   --> $DIR/patterns_same_crate.rs:60:15
    |
 LL |     while let PartiallyInhabitedVariants::Struct { x } = partially_inhabited_variant() {
-   |               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ matches no values because `!` is uninhabited
    |
-   = note: matches no values because `!` is uninhabited
    = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
 
 error: unreachable pattern
   --> $DIR/patterns_same_crate.rs:64:15
    |
 LL |     while let Some(_x) = uninhabited_struct() {
-   |               ^^^^^^^^
+   |               ^^^^^^^^ matches no values because `UninhabitedStruct` is uninhabited
    |
-   = note: matches no values because `UninhabitedStruct` is uninhabited
    = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
 
 error: unreachable pattern
   --> $DIR/patterns_same_crate.rs:67:15
    |
 LL |     while let Some(_x) = uninhabited_tuple_struct() {
-   |               ^^^^^^^^
+   |               ^^^^^^^^ matches no values because `UninhabitedTupleStruct` is uninhabited
    |
-   = note: matches no values because `UninhabitedTupleStruct` is uninhabited
    = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
 
 error: aborting due to 5 previous errors
diff --git a/tests/ui/uninhabited/uninhabited-patterns.stderr b/tests/ui/uninhabited/uninhabited-patterns.stderr
index c9b9242384d..0e1c9d31a73 100644
--- a/tests/ui/uninhabited/uninhabited-patterns.stderr
+++ b/tests/ui/uninhabited/uninhabited-patterns.stderr
@@ -2,9 +2,8 @@ error: unreachable pattern
   --> $DIR/uninhabited-patterns.rs:29:9
    |
 LL |         Ok(box _) => (),
-   |         ^^^^^^^^^
+   |         ^^^^^^^^^ matches no values because `NotSoSecretlyEmpty` is uninhabited
    |
-   = note: matches no values because `NotSoSecretlyEmpty` is uninhabited
    = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
 note: the lint level is defined here
   --> $DIR/uninhabited-patterns.rs:3:9
@@ -16,18 +15,16 @@ error: unreachable pattern
   --> $DIR/uninhabited-patterns.rs:38:9
    |
 LL |         Err(Ok(_y)) => (),
-   |         ^^^^^^^^^^^
+   |         ^^^^^^^^^^^ matches no values because `NotSoSecretlyEmpty` is uninhabited
    |
-   = note: matches no values because `NotSoSecretlyEmpty` is uninhabited
    = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
 
 error: unreachable pattern
   --> $DIR/uninhabited-patterns.rs:41:15
    |
 LL |     while let Some(_y) = foo() {
-   |               ^^^^^^^^
+   |               ^^^^^^^^ matches no values because `NotSoSecretlyEmpty` is uninhabited
    |
-   = note: matches no values because `NotSoSecretlyEmpty` is uninhabited
    = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
 
 error: aborting due to 3 previous errors