diff --git a/compiler/rustc_mir_build/messages.ftl b/compiler/rustc_mir_build/messages.ftl index ae13485ce73..b6258045566 100644 --- a/compiler/rustc_mir_build/messages.ftl +++ b/compiler/rustc_mir_build/messages.ftl @@ -332,6 +332,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_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 .unreachable_covered_by_many = multiple earlier patterns match some of the same values diff --git a/compiler/rustc_mir_build/src/errors.rs b/compiler/rustc_mir_build/src/errors.rs index 34577f102d1..a45a0311e32 100644 --- a/compiler/rustc_mir_build/src/errors.rs +++ b/compiler/rustc_mir_build/src/errors.rs @@ -588,6 +588,8 @@ pub(crate) struct UnreachablePattern<'tcx> { pub(crate) span: Option, #[subdiagnostic] pub(crate) matches_no_values: Option>, + #[note(mir_build_unreachable_uninhabited_note)] + pub(crate) uninhabited_note: Option<()>, #[label(mir_build_unreachable_covered_by_catchall)] pub(crate) covered_by_catchall: Option, #[label(mir_build_unreachable_covered_by_one)] 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 85b9dacb129..a948e5d0c21 100644 --- a/compiler/rustc_mir_build/src/thir/pattern/check_match.rs +++ b/compiler/rustc_mir_build/src/thir/pattern/check_match.rs @@ -921,6 +921,7 @@ fn report_unreachable_pattern<'p, 'tcx>( let mut lint = UnreachablePattern { span: Some(pat_span), matches_no_values: None, + uninhabited_note: None, covered_by_catchall: None, covered_by_one: None, covered_by_many: None, @@ -929,6 +930,7 @@ 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 pat.walk(&mut |subpat| { let ty = **subpat.ty(); if cx.is_uninhabited(ty) { 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 4cfa6182752..5ec14a7597a 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 @@ -5,6 +5,7 @@ LL | _ => {} | ^ | = 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 | @@ -12,31 +13,34 @@ LL | #![deny(unreachable_patterns)] | ^^^^^^^^^^^^^^^^^^^^ error: unreachable pattern - --> $DIR/empty-match-check-notes.rs:21:9 + --> $DIR/empty-match-check-notes.rs:22:9 | LL | _ if false => {} | ^ | = 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:29:9 + --> $DIR/empty-match-check-notes.rs:31:9 | LL | _ => {} | ^ | = 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:33:9 + --> $DIR/empty-match-check-notes.rs:36:9 | LL | _ if false => {} | ^ | = 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 - --> $DIR/empty-match-check-notes.rs:39:9 + --> $DIR/empty-match-check-notes.rs:43:9 | LL | let None = *x; | ^^^^ pattern `Some(_)` not covered @@ -51,7 +55,7 @@ LL | if let None = *x { todo!() }; | ++ +++++++++++ error[E0004]: non-exhaustive patterns: `0_u8..=u8::MAX` not covered - --> $DIR/empty-match-check-notes.rs:49:11 + --> $DIR/empty-match-check-notes.rs:53: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 4cfa6182752..5ec14a7597a 100644 --- a/tests/ui/pattern/usefulness/empty-match-check-notes.normal.stderr +++ b/tests/ui/pattern/usefulness/empty-match-check-notes.normal.stderr @@ -5,6 +5,7 @@ LL | _ => {} | ^ | = 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 | @@ -12,31 +13,34 @@ LL | #![deny(unreachable_patterns)] | ^^^^^^^^^^^^^^^^^^^^ error: unreachable pattern - --> $DIR/empty-match-check-notes.rs:21:9 + --> $DIR/empty-match-check-notes.rs:22:9 | LL | _ if false => {} | ^ | = 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:29:9 + --> $DIR/empty-match-check-notes.rs:31:9 | LL | _ => {} | ^ | = 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:33:9 + --> $DIR/empty-match-check-notes.rs:36:9 | LL | _ if false => {} | ^ | = 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 - --> $DIR/empty-match-check-notes.rs:39:9 + --> $DIR/empty-match-check-notes.rs:43:9 | LL | let None = *x; | ^^^^ pattern `Some(_)` not covered @@ -51,7 +55,7 @@ LL | if let None = *x { todo!() }; | ++ +++++++++++ error[E0004]: non-exhaustive patterns: `0_u8..=u8::MAX` not covered - --> $DIR/empty-match-check-notes.rs:49:11 + --> $DIR/empty-match-check-notes.rs:53: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 61a75e6c801..48d20fd2d5c 100644 --- a/tests/ui/pattern/usefulness/empty-match-check-notes.rs +++ b/tests/ui/pattern/usefulness/empty-match-check-notes.rs @@ -16,10 +16,12 @@ fn empty_enum(x: EmptyEnum) { match x { _ => {} //~ ERROR unreachable pattern //~^ NOTE matches no values + //~| NOTE to learn more about uninhabited types, see } match x { _ if false => {} //~ ERROR unreachable pattern //~^ NOTE matches no values + //~| NOTE to learn more about uninhabited types, see } } @@ -28,10 +30,12 @@ fn empty_foreign_enum(x: empty::EmptyForeignEnum) { match x { _ => {} //~ ERROR unreachable pattern //~^ NOTE matches no values + //~| NOTE to learn more about uninhabited types, see } match x { _ if false => {} //~ ERROR unreachable pattern //~^ NOTE matches no values + //~| NOTE to learn more about uninhabited types, see } } diff --git a/tests/ui/pattern/usefulness/empty-types.exhaustive_patterns.stderr b/tests/ui/pattern/usefulness/empty-types.exhaustive_patterns.stderr index 74cf75f3b40..4e5f1d0ea8c 100644 --- a/tests/ui/pattern/usefulness/empty-types.exhaustive_patterns.stderr +++ b/tests/ui/pattern/usefulness/empty-types.exhaustive_patterns.stderr @@ -5,6 +5,7 @@ LL | _ => {} | ^ | = 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 | @@ -18,6 +19,7 @@ LL | _x => {} | ^^ | = 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 --> $DIR/empty-types.rs:56:11 @@ -41,6 +43,7 @@ LL | (_, _) => {} | ^^^^^^ | = 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 @@ -49,6 +52,7 @@ LL | _ => {} | ^ | = 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 @@ -57,6 +61,7 @@ LL | (_, _) => {} | ^^^^^^ | = 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 @@ -65,6 +70,7 @@ LL | _ => {} | ^ | = 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 --> $DIR/empty-types.rs:87:11 @@ -92,6 +98,7 @@ LL | Err(_) => {} | ^^^^^^ | = 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 @@ -100,6 +107,7 @@ LL | Err(_) => {} | ^^^^^^ | = 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 --> $DIR/empty-types.rs:96:11 @@ -140,6 +148,7 @@ LL | _ => {} | ^ | = 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 @@ -148,6 +157,7 @@ LL | Ok(_) => {} | ^^^^^ | = 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 @@ -156,6 +166,7 @@ LL | Ok(_) => {} | ^^^^^ | = 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 @@ -164,6 +175,7 @@ LL | _ => {} | ^ | = 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 @@ -172,6 +184,7 @@ LL | Ok(_) => {} | ^^^^^ | = 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 @@ -180,6 +193,7 @@ LL | Err(_) => {} | ^^^^^^ | = 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 @@ -188,6 +202,7 @@ LL | _ => {} | ^ | = 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 @@ -196,6 +211,7 @@ LL | _ if false => {} | ^ | = 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 @@ -204,6 +220,7 @@ LL | Some(_) => {} | ^^^^^^^ | = 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:147:13 @@ -220,6 +237,7 @@ LL | _ => {} | ^ | = 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 @@ -228,6 +246,7 @@ LL | _ => {} | ^ | = 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 @@ -236,6 +255,7 @@ LL | _ => {} | ^ | = 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 @@ -244,6 +264,7 @@ LL | _ => {} | ^ | = 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 @@ -252,6 +273,7 @@ LL | _ => {} | ^ | = 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 @@ -260,6 +282,7 @@ LL | _ => {} | ^ | = 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 @@ -268,6 +291,7 @@ LL | (_, _) => {} | ^^^^^^ | = 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 @@ -276,6 +300,7 @@ LL | Ok(_) => {} | ^^^^^ | = 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 @@ -284,6 +309,7 @@ LL | Err(_) => {} | ^^^^^^ | = 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 --> $DIR/empty-types.rs:327:11 @@ -347,6 +373,7 @@ LL | _ => {} | ^ | = 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 @@ -355,6 +382,7 @@ LL | [_, _, _] => {} | ^^^^^^^^^ | = 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 @@ -363,6 +391,7 @@ LL | [_, ..] => {} | ^^^^^^^ | = 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 --> $DIR/empty-types.rs:388:11 @@ -407,6 +436,7 @@ LL | Some(_) => {} | ^^^^^^^ | = 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 @@ -415,6 +445,7 @@ LL | Some(_a) => {} | ^^^^^^^^ | = 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:426:9 @@ -441,6 +472,7 @@ LL | _ => {} | ^ | = 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 @@ -449,6 +481,7 @@ LL | _x => {} | ^^ | = 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 @@ -457,6 +490,7 @@ LL | _ if false => {} | ^ | = 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 @@ -465,6 +499,7 @@ LL | _x if false => {} | ^^ | = 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 e1a8458e5f8..3332eab8a77 100644 --- a/tests/ui/pattern/usefulness/empty-types.never_pats.stderr +++ b/tests/ui/pattern/usefulness/empty-types.never_pats.stderr @@ -14,6 +14,7 @@ LL | _ => {} | ^ | = 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 | @@ -27,6 +28,7 @@ LL | _x => {} | ^^ | = 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 --> $DIR/empty-types.rs:56:11 @@ -50,6 +52,7 @@ LL | (_, _) => {} | ^^^^^^ | = 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 @@ -58,6 +61,7 @@ LL | _ => {} | ^ | = 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 @@ -66,6 +70,7 @@ LL | (_, _) => {} | ^^^^^^ | = 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 @@ -74,6 +79,7 @@ LL | _ => {} | ^ | = 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 --> $DIR/empty-types.rs:87:11 @@ -101,6 +107,7 @@ LL | Err(_) => {} | ^^^^^^ | = 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 @@ -109,6 +116,7 @@ LL | Err(_) => {} | ^^^^^^ | = 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 --> $DIR/empty-types.rs:96:11 @@ -163,6 +171,7 @@ LL | _ => {} | ^ | = 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 @@ -171,6 +180,7 @@ LL | Ok(_) => {} | ^^^^^ | = 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 @@ -179,6 +189,7 @@ LL | Ok(_) => {} | ^^^^^ | = 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 @@ -187,6 +198,7 @@ LL | _ => {} | ^ | = 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 @@ -195,6 +207,7 @@ LL | Ok(_) => {} | ^^^^^ | = 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 @@ -203,6 +216,7 @@ LL | Err(_) => {} | ^^^^^^ | = 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 @@ -211,6 +225,7 @@ LL | _ => {} | ^ | = 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 @@ -219,6 +234,7 @@ LL | _ if false => {} | ^ | = 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 @@ -227,6 +243,7 @@ LL | Some(_) => {} | ^^^^^^^ | = 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:147:13 @@ -262,6 +279,7 @@ LL | _ => {} | ^ | = 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 @@ -270,6 +288,7 @@ LL | _ => {} | ^ | = 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 @@ -278,6 +297,7 @@ LL | _ => {} | ^ | = 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 @@ -286,6 +306,7 @@ LL | _ => {} | ^ | = 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 @@ -294,6 +315,7 @@ LL | _ => {} | ^ | = 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 @@ -302,6 +324,7 @@ LL | _ => {} | ^ | = 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 @@ -310,6 +333,7 @@ LL | (_, _) => {} | ^^^^^^ | = 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 @@ -318,6 +342,7 @@ LL | Ok(_) => {} | ^^^^^ | = 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 @@ -326,6 +351,7 @@ LL | Err(_) => {} | ^^^^^^ | = 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 --> $DIR/empty-types.rs:297:13 @@ -481,6 +507,7 @@ LL | _ => {} | ^ | = 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 @@ -489,6 +516,7 @@ LL | [_, _, _] => {} | ^^^^^^^^^ | = 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 @@ -497,6 +525,7 @@ LL | [_, ..] => {} | ^^^^^^^ | = 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 --> $DIR/empty-types.rs:388:11 @@ -541,6 +570,7 @@ LL | Some(_) => {} | ^^^^^^^ | = 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 @@ -549,6 +579,7 @@ LL | Some(_a) => {} | ^^^^^^^^ | = 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:426:9 @@ -665,6 +696,7 @@ LL | _ => {} | ^ | = 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 @@ -673,6 +705,7 @@ LL | _x => {} | ^^ | = 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 @@ -681,6 +714,7 @@ LL | _ if false => {} | ^ | = 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 @@ -689,6 +723,7 @@ LL | _x if false => {} | ^^ | = 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 --> $DIR/empty-types.rs:637:11 diff --git a/tests/ui/pattern/usefulness/empty-types.normal.stderr b/tests/ui/pattern/usefulness/empty-types.normal.stderr index c9bd25d5f9d..89cf09f011e 100644 --- a/tests/ui/pattern/usefulness/empty-types.normal.stderr +++ b/tests/ui/pattern/usefulness/empty-types.normal.stderr @@ -5,6 +5,7 @@ LL | _ => {} | ^ | = 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 | @@ -18,6 +19,7 @@ LL | _x => {} | ^^ | = 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 --> $DIR/empty-types.rs:56:11 @@ -41,6 +43,7 @@ LL | (_, _) => {} | ^^^^^^ | = 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 @@ -49,6 +52,7 @@ LL | _ => {} | ^ | = 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 @@ -57,6 +61,7 @@ LL | (_, _) => {} | ^^^^^^ | = 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 @@ -65,6 +70,7 @@ LL | _ => {} | ^ | = 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 --> $DIR/empty-types.rs:87:11 @@ -92,6 +98,7 @@ LL | Err(_) => {} | ^^^^^^ | = 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 @@ -100,6 +107,7 @@ LL | Err(_) => {} | ^^^^^^ | = 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 --> $DIR/empty-types.rs:96:11 @@ -154,6 +162,7 @@ LL | _ => {} | ^ | = 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 @@ -162,6 +171,7 @@ LL | Ok(_) => {} | ^^^^^ | = 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 @@ -170,6 +180,7 @@ LL | Ok(_) => {} | ^^^^^ | = 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 @@ -178,6 +189,7 @@ LL | _ => {} | ^ | = 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 @@ -186,6 +198,7 @@ LL | Ok(_) => {} | ^^^^^ | = 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 @@ -194,6 +207,7 @@ LL | Err(_) => {} | ^^^^^^ | = 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 @@ -202,6 +216,7 @@ LL | _ => {} | ^ | = 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 @@ -210,6 +225,7 @@ LL | _ if false => {} | ^ | = 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 @@ -218,6 +234,7 @@ LL | Some(_) => {} | ^^^^^^^ | = 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:147:13 @@ -253,6 +270,7 @@ LL | _ => {} | ^ | = 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 @@ -261,6 +279,7 @@ LL | _ => {} | ^ | = 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 @@ -269,6 +288,7 @@ LL | _ => {} | ^ | = 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 @@ -277,6 +297,7 @@ LL | _ => {} | ^ | = 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 @@ -285,6 +306,7 @@ LL | _ => {} | ^ | = 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 @@ -293,6 +315,7 @@ LL | _ => {} | ^ | = 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 @@ -301,6 +324,7 @@ LL | (_, _) => {} | ^^^^^^ | = 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 @@ -309,6 +333,7 @@ LL | Ok(_) => {} | ^^^^^ | = 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 @@ -317,6 +342,7 @@ LL | Err(_) => {} | ^^^^^^ | = 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 --> $DIR/empty-types.rs:297:13 @@ -472,6 +498,7 @@ LL | _ => {} | ^ | = 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 @@ -480,6 +507,7 @@ LL | [_, _, _] => {} | ^^^^^^^^^ | = 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 @@ -488,6 +516,7 @@ LL | [_, ..] => {} | ^^^^^^^ | = 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 --> $DIR/empty-types.rs:388:11 @@ -532,6 +561,7 @@ LL | Some(_) => {} | ^^^^^^^ | = 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 @@ -540,6 +570,7 @@ LL | Some(_a) => {} | ^^^^^^^^ | = 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:426:9 @@ -656,6 +687,7 @@ LL | _ => {} | ^ | = 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 @@ -664,6 +696,7 @@ LL | _x => {} | ^^ | = 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 @@ -672,6 +705,7 @@ LL | _ if false => {} | ^ | = 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 @@ -680,6 +714,7 @@ LL | _x if false => {} | ^^ | = 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 --> $DIR/empty-types.rs:637:11 diff --git a/tests/ui/pattern/usefulness/explain-unreachable-pats.rs b/tests/ui/pattern/usefulness/explain-unreachable-pats.rs index bc4abd343ad..746343246c6 100644 --- a/tests/ui/pattern/usefulness/explain-unreachable-pats.rs +++ b/tests/ui/pattern/usefulness/explain-unreachable-pats.rs @@ -32,6 +32,7 @@ fn main() { Err(_) => {} //~^ ERROR unreachable pattern //~| NOTE matches no values because `!` is uninhabited + //~| NOTE to learn more about uninhabited types, see } #[derive(Copy, Clone)] @@ -45,12 +46,14 @@ fn main() { (Err(_), Err(_)) => {} //~^ ERROR unreachable pattern //~| NOTE matches no values because `Void2` is uninhabited + //~| NOTE to learn more about uninhabited types, see _ => {} } match (res1, &res2) { (Err(_), Err(_)) => {} //~^ ERROR unreachable pattern //~| NOTE matches no values because `Void1` is uninhabited + //~| NOTE to learn more about uninhabited types, see _ => {} } diff --git a/tests/ui/pattern/usefulness/explain-unreachable-pats.stderr b/tests/ui/pattern/usefulness/explain-unreachable-pats.stderr index da9bf30aa58..0dfd0980050 100644 --- a/tests/ui/pattern/usefulness/explain-unreachable-pats.stderr +++ b/tests/ui/pattern/usefulness/explain-unreachable-pats.stderr @@ -38,25 +38,28 @@ LL | Err(_) => {} | ^^^^^^ | = 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:45:9 + --> $DIR/explain-unreachable-pats.rs:46:9 | LL | (Err(_), Err(_)) => {} | ^^^^^^^^^^^^^^^^ | = 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:51:9 + --> $DIR/explain-unreachable-pats.rs:53:9 | LL | (Err(_), Err(_)) => {} | ^^^^^^^^^^^^^^^^ | = 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 - --> $DIR/explain-unreachable-pats.rs:60:11 + --> $DIR/explain-unreachable-pats.rs:63:11 | LL | if let (0 | - matches all the relevant values @@ -65,13 +68,13 @@ LL | | 0, _) = (0, 0) {} | ^ no value can reach this error: unreachable pattern - --> $DIR/explain-unreachable-pats.rs:70:9 + --> $DIR/explain-unreachable-pats.rs:73:9 | LL | (_, true) => {} | ^^^^^^^^^ no value can reach this | note: multiple earlier patterns match some of the same values - --> $DIR/explain-unreachable-pats.rs:70:9 + --> $DIR/explain-unreachable-pats.rs:73:9 | LL | (true, _) => {} | --------- matches some of the same values @@ -83,7 +86,7 @@ LL | (_, true) => {} | ^^^^^^^^^ collectively making this unreachable error: unreachable pattern - --> $DIR/explain-unreachable-pats.rs:83:9 + --> $DIR/explain-unreachable-pats.rs:86:9 | LL | (true, _) => {} | --------- matches all the relevant values @@ -92,7 +95,7 @@ LL | (true, true) => {} | ^^^^^^^^^^^^ no value can reach this error: unreachable pattern - --> $DIR/explain-unreachable-pats.rs:95:9 + --> $DIR/explain-unreachable-pats.rs:98:9 | LL | (_, true, 0..10) => {} | ---------------- matches all the relevant values diff --git a/tests/ui/pattern/usefulness/impl-trait.stderr b/tests/ui/pattern/usefulness/impl-trait.stderr index 04d6671bb9a..0abfeb5b529 100644 --- a/tests/ui/pattern/usefulness/impl-trait.stderr +++ b/tests/ui/pattern/usefulness/impl-trait.stderr @@ -5,6 +5,7 @@ LL | _ => {} | ^ | = 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 | @@ -18,6 +19,7 @@ LL | _ => {} | ^ | = 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 @@ -26,6 +28,7 @@ LL | Some(_) => {} | ^^^^^^^ | = 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:48:13 @@ -42,6 +45,7 @@ LL | Some(_) => {} | ^^^^^^^ | = 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:62:13 @@ -58,6 +62,7 @@ LL | _ => {} | ^ | = 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:85:9 @@ -74,6 +79,7 @@ LL | _ => {} | ^ | = 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:104:9 @@ -98,6 +104,7 @@ LL | _ => {} | ^ | = 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 @@ -106,6 +113,7 @@ LL | _ => {} | ^ | = 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 --> $DIR/impl-trait.rs:22:11 diff --git a/tests/ui/reachable/unreachable-loop-patterns.stderr b/tests/ui/reachable/unreachable-loop-patterns.stderr index 9781a976686..f34ca3258ca 100644 --- a/tests/ui/reachable/unreachable-loop-patterns.stderr +++ b/tests/ui/reachable/unreachable-loop-patterns.stderr @@ -5,6 +5,7 @@ LL | for _ in unimplemented!() as Void {} | ^ | = 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 83040d35c0f..2ead661a658 100644 --- a/tests/ui/reachable/unreachable-try-pattern.stderr +++ b/tests/ui/reachable/unreachable-try-pattern.stderr @@ -20,6 +20,7 @@ LL | let y = (match x { Ok(n) => Ok(n as u32), Err(e) => Err(e) })?; | ^^^^^ | = 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 | @@ -33,6 +34,7 @@ LL | let y = (match x { Ok(n) => Ok(n), Err(e) => Err(e) })?; | ^^^^^^ | = 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 be8b38f6942..b7a5f3e5513 100644 --- a/tests/ui/rfcs/rfc-0000-never_patterns/unreachable.stderr +++ b/tests/ui/rfcs/rfc-0000-never_patterns/unreachable.stderr @@ -5,6 +5,7 @@ LL | Err(!), | ^^^^^^ | = 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 | @@ -18,6 +19,7 @@ LL | let (Ok(_x) | Err(!)) = res_void; | ^^^^^^ | = 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 @@ -26,6 +28,7 @@ LL | if let Err(!) = res_void {} | ^^^^^^ | = 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 @@ -34,6 +37,7 @@ LL | if let (Ok(true) | Err(!)) = res_void {} | ^^^^^^ | = 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 @@ -42,6 +46,7 @@ LL | for (Ok(mut _x) | Err(!)) in [res_void] {} | ^^^^^^ | = 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 @@ -50,6 +55,7 @@ LL | fn foo((Ok(_x) | Err(!)): Result) {} | ^^^^^^ | = 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 06bc901ffdf..88fab333c74 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 @@ -5,6 +5,7 @@ LL | _ => {} | ^ | = 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 982129046b8..5dbe7a2dc5a 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 @@ -5,6 +5,7 @@ LL | Some(_x) => (), | ^^^^^^^^ | = 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 | @@ -18,6 +19,7 @@ LL | Some(_x) => (), | ^^^^^^^^ | = 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 @@ -26,6 +28,7 @@ LL | while let PartiallyInhabitedVariants::Struct { x } = partially_inhabite | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = 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 @@ -34,6 +37,7 @@ LL | while let Some(_x) = uninhabited_struct() { | ^^^^^^^^ | = 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 @@ -42,6 +46,7 @@ LL | while let Some(_x) = uninhabited_tuple_struct() { | ^^^^^^^^ | = 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 4bac1bc52f4..c9b9242384d 100644 --- a/tests/ui/uninhabited/uninhabited-patterns.stderr +++ b/tests/ui/uninhabited/uninhabited-patterns.stderr @@ -5,6 +5,7 @@ LL | Ok(box _) => (), | ^^^^^^^^^ | = 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 | @@ -18,6 +19,7 @@ LL | Err(Ok(_y)) => (), | ^^^^^^^^^^^ | = 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 @@ -26,6 +28,7 @@ LL | while let Some(_y) = foo() { | ^^^^^^^^ | = 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