Rollup merge of #129281 - Nadrieril:tweak-unreachable-lint-wording, r=estebank

Tweak unreachable lint wording

Some tweaks to the notes added in https://github.com/rust-lang/rust/pull/128034.

r? `@estebank`
This commit is contained in:
Matthias Krüger 2024-08-21 18:15:03 +02:00 committed by GitHub
commit 9bb17d345a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
47 changed files with 742 additions and 673 deletions

View file

@ -327,14 +327,17 @@ mir_build_union_pattern = cannot use unions in constant patterns
mir_build_unreachable_making_this_unreachable = collectively making this unreachable
mir_build_unreachable_making_this_unreachable_n_more = ...and {$covered_by_many_n_more_count} other patterns collectively make this unreachable
mir_build_unreachable_matches_same_values = matches some of the same values
mir_build_unreachable_pattern = unreachable pattern
.label = unreachable pattern
.unreachable_matches_no_values = this pattern matches no values because `{$ty}` is uninhabited
.label = no value can reach this
.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 values already
.unreachable_covered_by_many = these patterns collectively make the last one unreachable
.unreachable_covered_by_one = matches all the relevant values
.unreachable_covered_by_many = multiple earlier patterns match some of the same values
mir_build_unsafe_fn_safe_body = an unsafe function restricts its caller, but its body is safe by default
mir_build_unsafe_not_inherited = items do not inherit unsafety from separate enclosing items

View file

@ -586,20 +586,18 @@ 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)]
pub(crate) covered_by_catchall: Option<Span>,
#[label(mir_build_unreachable_covered_by_one)]
pub(crate) covered_by_one: Option<Span>,
#[note(mir_build_unreachable_covered_by_many)]
pub(crate) covered_by_many: Option<MultiSpan>,
}
#[derive(Subdiagnostic)]
#[note(mir_build_unreachable_matches_no_values)]
pub(crate) struct UnreachableMatchesNoValues<'tcx> {
pub(crate) ty: Ty<'tcx>,
pub(crate) covered_by_many_n_more_count: usize,
}
#[derive(Diagnostic)]

View file

@ -917,22 +917,28 @@ fn report_unreachable_pattern<'p, 'tcx>(
pat: &DeconstructedPat<'p, 'tcx>,
explanation: &RedundancyExplanation<'p, 'tcx>,
) {
static CAP_COVERED_BY_MANY: usize = 4;
let pat_span = pat.data().span;
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,
covered_by_many: None,
covered_by_many_n_more_count: 0,
};
match explanation.covered_by.as_slice() {
[] => {
// 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.
@ -948,15 +954,27 @@ fn report_unreachable_pattern<'p, 'tcx>(
lint.covered_by_one = Some(covering_pat.data().span);
}
covering_pats => {
let mut iter = covering_pats.iter();
let mut multispan = MultiSpan::from_span(pat_span);
for p in covering_pats {
for p in iter.by_ref().take(CAP_COVERED_BY_MANY) {
multispan.push_span_label(
p.data().span,
fluent::mir_build_unreachable_matches_same_values,
);
}
multispan
.push_span_label(pat_span, fluent::mir_build_unreachable_making_this_unreachable);
let remain = iter.count();
if remain == 0 {
multispan.push_span_label(
pat_span,
fluent::mir_build_unreachable_making_this_unreachable,
);
} else {
lint.covered_by_many_n_more_count = remain;
multispan.push_span_label(
pat_span,
fluent::mir_build_unreachable_making_this_unreachable_n_more,
);
}
lint.covered_by_many = Some(multispan);
}
}

View file

@ -2,9 +2,9 @@ warning: unreachable pattern
--> $DIR/packed_pattern.rs:16:9
|
LL | Foo { field: (5, 6, 7, 8) } => {},
| --------------------------- matches all the values already
| --------------------------- matches all the relevant values
LL | FOO => unreachable!(),
| ^^^ unreachable pattern
| ^^^ no value can reach this
|
= note: `#[warn(unreachable_patterns)]` on by default

View file

@ -2,9 +2,9 @@ warning: unreachable pattern
--> $DIR/packed_pattern2.rs:24:9
|
LL | Bar { a: Foo { field: (5, 6) } } => {},
| -------------------------------- matches all the values already
| -------------------------------- matches all the relevant values
LL | FOO => unreachable!(),
| ^^^ unreachable pattern
| ^^^ no value can reach this
|
= note: `#[warn(unreachable_patterns)]` on by default

View file

@ -2,9 +2,9 @@ error: unreachable pattern
--> $DIR/E0001.rs:8:9
|
LL | _ => {/* ... */}
| ^ unreachable pattern
| ^ no value can reach this
|
note: these patterns collectively make the last one unreachable
note: multiple earlier patterns match some of the same values
--> $DIR/E0001.rs:8:9
|
LL | Some(_) => {/* ... */}

View file

@ -13,7 +13,7 @@ LL | Nil => true,
| --- matches any value
LL |
LL | _ => false
| ^ unreachable pattern
| ^ no value can reach this
|
note: the lint level is defined here
--> $DIR/issue-30302.rs:4:9

View file

@ -2,9 +2,9 @@ error: unreachable pattern
--> $DIR/exhaustiveness-unreachable-pattern.rs:8:9
|
LL | (1 | 2,) => {}
| -------- matches all the values already
| -------- matches all the relevant values
LL | (1,) => {}
| ^^^^ unreachable pattern
| ^^^^ no value can reach this
|
note: the lint level is defined here
--> $DIR/exhaustiveness-unreachable-pattern.rs:1:9
@ -16,17 +16,17 @@ error: unreachable pattern
--> $DIR/exhaustiveness-unreachable-pattern.rs:13:9
|
LL | (1 | 2,) => {}
| -------- matches all the values already
| -------- matches all the relevant values
LL | (2,) => {}
| ^^^^ unreachable pattern
| ^^^^ no value can reach this
error: unreachable pattern
--> $DIR/exhaustiveness-unreachable-pattern.rs:19:9
|
LL | (1 | 2,) => {}
| ^^^^^^^^ unreachable pattern
| ^^^^^^^^ no value can reach this
|
note: these patterns collectively make the last one unreachable
note: multiple earlier patterns match some of the same values
--> $DIR/exhaustiveness-unreachable-pattern.rs:19:9
|
LL | (1,) => {}
@ -40,44 +40,44 @@ error: unreachable pattern
--> $DIR/exhaustiveness-unreachable-pattern.rs:24:9
|
LL | (1 | 2, 3 | 4) => {}
| -------------- matches all the values already
| -------------- matches all the relevant values
LL | (1, 3) => {}
| ^^^^^^ unreachable pattern
| ^^^^^^ no value can reach this
error: unreachable pattern
--> $DIR/exhaustiveness-unreachable-pattern.rs:25:9
|
LL | (1 | 2, 3 | 4) => {}
| -------------- matches all the values already
| -------------- matches all the relevant values
LL | (1, 3) => {}
LL | (1, 4) => {}
| ^^^^^^ unreachable pattern
| ^^^^^^ no value can reach this
error: unreachable pattern
--> $DIR/exhaustiveness-unreachable-pattern.rs:26:9
|
LL | (1 | 2, 3 | 4) => {}
| -------------- matches all the values already
| -------------- matches all the relevant values
...
LL | (2, 4) => {}
| ^^^^^^ unreachable pattern
| ^^^^^^ no value can reach this
error: unreachable pattern
--> $DIR/exhaustiveness-unreachable-pattern.rs:27:9
|
LL | (1 | 2, 3 | 4) => {}
| -------------- matches all the values already
| -------------- matches all the relevant values
...
LL | (2 | 1, 4) => {}
| ^^^^^^^^^^ unreachable pattern
| ^^^^^^^^^^ no value can reach this
error: unreachable pattern
--> $DIR/exhaustiveness-unreachable-pattern.rs:29:9
|
LL | (1, 4 | 5) => {}
| ^^^^^^^^^^ unreachable pattern
| ^^^^^^^^^^ no value can reach this
|
note: these patterns collectively make the last one unreachable
note: multiple earlier patterns match some of the same values
--> $DIR/exhaustiveness-unreachable-pattern.rs:29:9
|
LL | (1 | 2, 3 | 4) => {}
@ -92,107 +92,107 @@ error: unreachable pattern
--> $DIR/exhaustiveness-unreachable-pattern.rs:34:13
|
LL | (0, 0, 0) => {}
| - matches all the values already
| - matches all the relevant values
LL | (0, 0 | 1, 0) => {}
| ^ unreachable pattern
| ^ no value can reach this
error: unreachable pattern
--> $DIR/exhaustiveness-unreachable-pattern.rs:42:9
|
LL | (None | Some(1 | 2),) => {}
| --------------------- matches all the values already
| --------------------- matches all the relevant values
LL | (Some(1),) => {}
| ^^^^^^^^^^ unreachable pattern
| ^^^^^^^^^^ no value can reach this
error: unreachable pattern
--> $DIR/exhaustiveness-unreachable-pattern.rs:43:9
|
LL | (None | Some(1 | 2),) => {}
| --------------------- matches all the values already
| --------------------- matches all the relevant values
LL | (Some(1),) => {}
LL | (None,) => {}
| ^^^^^^^ unreachable pattern
| ^^^^^^^ no value can reach this
error: unreachable pattern
--> $DIR/exhaustiveness-unreachable-pattern.rs:48:9
|
LL | ((1 | 2,) | (3 | 4,),) => {}
| ---------------------- matches all the values already
| ---------------------- matches all the relevant values
LL | ((1..=4,),) => {}
| ^^^^^^^^^^^ unreachable pattern
| ^^^^^^^^^^^ no value can reach this
error: unreachable pattern
--> $DIR/exhaustiveness-unreachable-pattern.rs:53:14
|
LL | (1 | 1,) => {}
| - ^ unreachable pattern
| - ^ no value can reach this
| |
| matches all the values already
| matches all the relevant values
error: unreachable pattern
--> $DIR/exhaustiveness-unreachable-pattern.rs:57:19
|
LL | (0 | 1) | 1 => {}
| - ^ unreachable pattern
| - ^ no value can reach this
| |
| matches all the values already
| matches all the relevant values
error: unreachable pattern
--> $DIR/exhaustiveness-unreachable-pattern.rs:63:14
|
LL | 0 | (0 | 0) => {}
| - ^ unreachable pattern
| - ^ no value can reach this
| |
| matches all the values already
| matches all the relevant values
error: unreachable pattern
--> $DIR/exhaustiveness-unreachable-pattern.rs:63:18
|
LL | 0 | (0 | 0) => {}
| - ^ unreachable pattern
| - ^ no value can reach this
| |
| matches all the values already
| matches all the relevant values
error: unreachable pattern
--> $DIR/exhaustiveness-unreachable-pattern.rs:71:13
|
LL | Some(0) |
| ------- matches all the values already
| ------- matches all the relevant values
LL | / Some(
LL | | 0 | 0) => {}
| |______________________^ unreachable pattern
| |______________________^ no value can reach this
error: unreachable pattern
--> $DIR/exhaustiveness-unreachable-pattern.rs:77:15
|
LL | [0
| - matches all the values already
| - matches all the relevant values
LL | | 0
| ^ unreachable pattern
| ^ no value can reach this
error: unreachable pattern
--> $DIR/exhaustiveness-unreachable-pattern.rs:79:15
|
LL | , 0
| - matches all the values already
| - matches all the relevant values
LL | | 0] => {}
| ^ unreachable pattern
| ^ no value can reach this
error: unreachable pattern
--> $DIR/exhaustiveness-unreachable-pattern.rs:83:20
|
LL | (true, 0 | 0) => {}
| - ^ unreachable pattern
| - ^ no value can reach this
| |
| matches all the values already
| matches all the relevant values
error: unreachable pattern
--> $DIR/exhaustiveness-unreachable-pattern.rs:84:17
|
LL | (_, 0 | 0) => {}
| ^ unreachable pattern
| ^ no value can reach this
|
note: these patterns collectively make the last one unreachable
note: multiple earlier patterns match some of the same values
--> $DIR/exhaustiveness-unreachable-pattern.rs:84:17
|
LL | (true, 0 | 0) => {}
@ -206,25 +206,25 @@ error: unreachable pattern
--> $DIR/exhaustiveness-unreachable-pattern.rs:92:10
|
LL | [1, ..] => {}
| - matches all the values already
| - matches all the relevant values
LL | [1
| ^ unreachable pattern
| ^ no value can reach this
error: unreachable pattern
--> $DIR/exhaustiveness-unreachable-pattern.rs:104:10
|
LL | [true, ..] => {}
| ---- matches all the values already
| ---- matches all the relevant values
LL | [true
| ^^^^ unreachable pattern
| ^^^^ no value can reach this
error: unreachable pattern
--> $DIR/exhaustiveness-unreachable-pattern.rs:111:36
|
LL | (true | false, None | Some(true
| ^^^^ unreachable pattern
| ^^^^ no value can reach this
|
note: these patterns collectively make the last one unreachable
note: multiple earlier patterns match some of the same values
--> $DIR/exhaustiveness-unreachable-pattern.rs:111:36
|
LL | (true, Some(_)) => {}
@ -238,12 +238,12 @@ error: unreachable pattern
--> $DIR/exhaustiveness-unreachable-pattern.rs:116:14
|
LL | (true
| ^^^^ unreachable pattern
| ^^^^ no value can reach this
...
LL | (true | false, None | Some(t_or_f!())) => {}
| --------- in this macro invocation
|
note: these patterns collectively make the last one unreachable
note: multiple earlier patterns match some of the same values
--> $DIR/exhaustiveness-unreachable-pattern.rs:116:14
|
LL | (true
@ -261,26 +261,26 @@ error: unreachable pattern
--> $DIR/exhaustiveness-unreachable-pattern.rs:127:14
|
LL | Some(0) => {}
| - matches all the values already
| - matches all the relevant values
LL | Some(0
| ^ unreachable pattern
| ^ no value can reach this
error: unreachable pattern
--> $DIR/exhaustiveness-unreachable-pattern.rs:146:19
|
LL | Some(false) => {}
| ----- matches all the values already
| ----- matches all the relevant values
LL | None | Some(true
LL | | false) => {}
| ^^^^^ unreachable pattern
| ^^^^^ no value can reach this
error: unreachable pattern
--> $DIR/exhaustiveness-unreachable-pattern.rs:154:15
|
LL | | true) => {}
| ^^^^ unreachable pattern
| ^^^^ no value can reach this
|
note: these patterns collectively make the last one unreachable
note: multiple earlier patterns match some of the same values
--> $DIR/exhaustiveness-unreachable-pattern.rs:154:15
|
LL | (false, true) => {}
@ -295,9 +295,9 @@ error: unreachable pattern
--> $DIR/exhaustiveness-unreachable-pattern.rs:160:15
|
LL | | true,
| ^^^^ unreachable pattern
| ^^^^ no value can reach this
|
note: these patterns collectively make the last one unreachable
note: multiple earlier patterns match some of the same values
--> $DIR/exhaustiveness-unreachable-pattern.rs:160:15
|
LL | (true, false) => {}
@ -314,13 +314,13 @@ error: unreachable pattern
LL | (x, y)
| ------ matches any value
LL | | (y, x) => {}
| ^^^^^^ unreachable pattern
| ^^^^^^ no value can reach this
error: unreachable pattern
--> $DIR/exhaustiveness-unreachable-pattern.rs:169:30
|
LL | fn unreachable_in_param((_ | (_, _)): (bool, bool)) {}
| - ^^^^^^ unreachable pattern
| - ^^^^^^ no value can reach this
| |
| matches any value
@ -328,7 +328,7 @@ error: unreachable pattern
--> $DIR/exhaustiveness-unreachable-pattern.rs:176:14
|
LL | let (_ | (_, _)) = bool_pair;
| - ^^^^^^ unreachable pattern
| - ^^^^^^ no value can reach this
| |
| matches any value
@ -336,7 +336,7 @@ error: unreachable pattern
--> $DIR/exhaustiveness-unreachable-pattern.rs:178:14
|
LL | for (_ | (_, _)) in [bool_pair] {}
| - ^^^^^^ unreachable pattern
| - ^^^^^^ no value can reach this
| |
| matches any value
@ -344,25 +344,25 @@ error: unreachable pattern
--> $DIR/exhaustiveness-unreachable-pattern.rs:181:20
|
LL | let (Some(_) | Some(true)) = bool_option else { return };
| ------- ^^^^^^^^^^ unreachable pattern
| ------- ^^^^^^^^^^ no value can reach this
| |
| matches all the values already
| matches all the relevant values
error: unreachable pattern
--> $DIR/exhaustiveness-unreachable-pattern.rs:183:22
|
LL | if let Some(_) | Some(true) = bool_option {}
| ------- ^^^^^^^^^^ unreachable pattern
| ------- ^^^^^^^^^^ no value can reach this
| |
| matches all the values already
| matches all the relevant values
error: unreachable pattern
--> $DIR/exhaustiveness-unreachable-pattern.rs:185:25
|
LL | while let Some(_) | Some(true) = bool_option {}
| ------- ^^^^^^^^^^ unreachable pattern
| ------- ^^^^^^^^^^ no value can reach this
| |
| matches all the values already
| matches all the relevant values
error: aborting due to 36 previous errors

View file

@ -19,7 +19,7 @@ LL | A => "A",
| - matches any value
LL |
LL | B => "B",
| ^ unreachable pattern
| ^ no value can reach this
|
note: the lint level is defined here
--> $DIR/issue-14221.rs:1:9

View file

@ -52,7 +52,7 @@ error: unreachable pattern
LL | Bar => {}
| --- matches any value
LL | BAR => {}
| ^^^ unreachable pattern
| ^^^ no value can reach this
|
note: the lint level is defined here
--> $DIR/consts-opaque.rs:6:9
@ -67,7 +67,7 @@ LL | Bar => {}
| --- matches any value
...
LL | _ => {}
| ^ unreachable pattern
| ^ no value can reach this
error: unreachable pattern
--> $DIR/consts-opaque.rs:56:9
@ -75,7 +75,7 @@ error: unreachable pattern
LL | BAR => {}
| --- matches any value
LL | Bar => {}
| ^^^ unreachable pattern
| ^^^ no value can reach this
error: unreachable pattern
--> $DIR/consts-opaque.rs:58:9
@ -84,7 +84,7 @@ LL | BAR => {}
| --- matches any value
...
LL | _ => {}
| ^ unreachable pattern
| ^ no value can reach this
error: unreachable pattern
--> $DIR/consts-opaque.rs:64:9
@ -92,7 +92,7 @@ error: unreachable pattern
LL | BAR => {}
| --- matches any value
LL | BAR => {} // should not be emitting unreachable warning
| ^^^ unreachable pattern
| ^^^ no value can reach this
error: unreachable pattern
--> $DIR/consts-opaque.rs:66:9
@ -101,31 +101,31 @@ LL | BAR => {}
| --- matches any value
...
LL | _ => {} // should not be emitting unreachable warning
| ^ unreachable pattern
| ^ no value can reach this
error: unreachable pattern
--> $DIR/consts-opaque.rs:72:9
|
LL | BAZ => {}
| --- matches all the values already
| --- matches all the relevant values
LL | Baz::Baz1 => {} // should not be emitting unreachable warning
| ^^^^^^^^^ unreachable pattern
| ^^^^^^^^^ no value can reach this
error: unreachable pattern
--> $DIR/consts-opaque.rs:79:9
|
LL | Baz::Baz1 => {}
| --------- matches all the values already
| --------- matches all the relevant values
LL | BAZ => {}
| ^^^ unreachable pattern
| ^^^ no value can reach this
error: unreachable pattern
--> $DIR/consts-opaque.rs:87:9
|
LL | _ => {} // should not be emitting unreachable warning
| ^ unreachable pattern
| ^ no value can reach this
|
note: these patterns collectively make the last one unreachable
note: multiple earlier patterns match some of the same values
--> $DIR/consts-opaque.rs:87:9
|
LL | BAZ => {}

View file

@ -2,9 +2,9 @@ error: unreachable pattern
--> $DIR/empty-match-check-notes.rs:17:9
|
LL | _ => {}
| ^
| ^ matches no values because `EmptyEnum` is uninhabited
|
= note: this pattern 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 +12,31 @@ 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 => {}
| ^
| ^ matches no values because `EmptyEnum` is uninhabited
|
= note: this pattern 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 | _ => {}
| ^
| ^ matches no values because `EmptyForeignEnum` is uninhabited
|
= note: this pattern 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 => {}
| ^
| ^ matches no values because `EmptyForeignEnum` is uninhabited
|
= note: this pattern 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 +51,7 @@ LL | if let None = *x { todo!() };
| ++ +++++++++++
error[E0004]: non-exhaustive patterns: `0_u8..=u8::MAX` not covered
--> $DIR/empty-match-check-notes.rs:49:11
--> $DIR/empty-match-check-notes.rs:53:11
|
LL | match 0u8 {
| ^^^ pattern `0_u8..=u8::MAX` not covered

View file

@ -2,9 +2,9 @@ error: unreachable pattern
--> $DIR/empty-match-check-notes.rs:17:9
|
LL | _ => {}
| ^
| ^ matches no values because `EmptyEnum` is uninhabited
|
= note: this pattern 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 +12,31 @@ 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 => {}
| ^
| ^ matches no values because `EmptyEnum` is uninhabited
|
= note: this pattern 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 | _ => {}
| ^
| ^ matches no values because `EmptyForeignEnum` is uninhabited
|
= note: this pattern 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 => {}
| ^
| ^ matches no values because `EmptyForeignEnum` is uninhabited
|
= note: this pattern 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 +51,7 @@ LL | if let None = *x { todo!() };
| ++ +++++++++++
error[E0004]: non-exhaustive patterns: `0_u8..=u8::MAX` not covered
--> $DIR/empty-match-check-notes.rs:49:11
--> $DIR/empty-match-check-notes.rs:53:11
|
LL | match 0u8 {
| ^^^ pattern `0_u8..=u8::MAX` not covered

View file

@ -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
}
}

View file

@ -2,9 +2,9 @@ error: unreachable pattern
--> $DIR/empty-types.rs:49:9
|
LL | _ => {}
| ^
| ^ matches no values because `!` is uninhabited
|
= note: this pattern 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
|
@ -15,9 +15,9 @@ error: unreachable pattern
--> $DIR/empty-types.rs:52:9
|
LL | _x => {}
| ^^
| ^^ matches no values because `!` is uninhabited
|
= note: this pattern 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
@ -38,33 +38,33 @@ error: unreachable pattern
--> $DIR/empty-types.rs:70:9
|
LL | (_, _) => {}
| ^^^^^^
| ^^^^^^ matches no values because `(u32, !)` is uninhabited
|
= note: this pattern 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: this pattern 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: this pattern 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: this pattern 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
@ -89,17 +89,17 @@ error: unreachable pattern
--> $DIR/empty-types.rs:94:9
|
LL | Err(_) => {}
| ^^^^^^
| ^^^^^^ matches no values because `!` is uninhabited
|
= note: this pattern 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: this pattern 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
@ -137,153 +137,153 @@ error: unreachable pattern
--> $DIR/empty-types.rs:112:9
|
LL | _ => {}
| ^
| ^ matches no values because `Result<!, !>` is uninhabited
|
= note: this pattern 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: this pattern 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: this pattern 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: this pattern 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: this pattern 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: this pattern 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: this pattern 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: this pattern 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: this pattern 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
|
LL | None => {}
| ---- matches all the values already
| ---- matches all the relevant values
LL | _ => {}
| ^ unreachable pattern
| ^ no value can reach this
error: unreachable pattern
--> $DIR/empty-types.rs:199:13
|
LL | _ => {}
| ^
| ^ matches no values because `!` is uninhabited
|
= note: this pattern 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: this pattern 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: this pattern 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: this pattern 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: this pattern 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: this pattern 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: this pattern 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: this pattern 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: this pattern 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
@ -344,25 +344,25 @@ error: unreachable pattern
--> $DIR/empty-types.rs:368:9
|
LL | _ => {}
| ^
| ^ matches no values because `[!; 3]` is uninhabited
|
= note: this pattern 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: this pattern 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: this pattern 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
@ -382,9 +382,9 @@ error: unreachable pattern
--> $DIR/empty-types.rs:395:9
|
LL | [] => {}
| -- matches all the values already
| -- matches all the relevant values
LL | _ => {}
| ^ unreachable pattern
| ^ no value can reach this
error[E0004]: non-exhaustive patterns: `[]` not covered
--> $DIR/empty-types.rs:397:11
@ -404,67 +404,67 @@ error: unreachable pattern
--> $DIR/empty-types.rs:416:9
|
LL | Some(_) => {}
| ^^^^^^^
| ^^^^^^^ matches no values because `!` is uninhabited
|
= note: this pattern 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: this pattern 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
|
LL | None => {}
| ---- matches all the values already
| ---- matches all the relevant values
LL | // !useful, !reachable
LL | _ => {}
| ^ unreachable pattern
| ^ no value can reach this
error: unreachable pattern
--> $DIR/empty-types.rs:431:9
|
LL | None => {}
| ---- matches all the values already
| ---- matches all the relevant values
LL | // !useful, !reachable
LL | _a => {}
| ^^ unreachable pattern
| ^^ no value can reach this
error: unreachable pattern
--> $DIR/empty-types.rs:603:9
|
LL | _ => {}
| ^
| ^ matches no values because `!` is uninhabited
|
= note: this pattern 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: this pattern 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: this pattern 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: this pattern 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

View file

@ -11,9 +11,9 @@ error: unreachable pattern
--> $DIR/empty-types.rs:49:9
|
LL | _ => {}
| ^
| ^ matches no values because `!` is uninhabited
|
= note: this pattern 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
|
@ -24,9 +24,9 @@ error: unreachable pattern
--> $DIR/empty-types.rs:52:9
|
LL | _x => {}
| ^^
| ^^ matches no values because `!` is uninhabited
|
= note: this pattern 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
@ -47,33 +47,33 @@ error: unreachable pattern
--> $DIR/empty-types.rs:70:9
|
LL | (_, _) => {}
| ^^^^^^
| ^^^^^^ matches no values because `(u32, !)` is uninhabited
|
= note: this pattern 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: this pattern 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: this pattern 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: this pattern 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
@ -98,17 +98,17 @@ error: unreachable pattern
--> $DIR/empty-types.rs:94:9
|
LL | Err(_) => {}
| ^^^^^^
| ^^^^^^ matches no values because `!` is uninhabited
|
= note: this pattern 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: this pattern 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
@ -160,81 +160,81 @@ error: unreachable pattern
--> $DIR/empty-types.rs:112:9
|
LL | _ => {}
| ^
| ^ matches no values because `Result<!, !>` is uninhabited
|
= note: this pattern 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: this pattern 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: this pattern 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: this pattern 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: this pattern 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: this pattern 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: this pattern 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: this pattern 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: this pattern 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
|
LL | None => {}
| ---- matches all the values already
| ---- matches all the relevant values
LL | _ => {}
| ^ unreachable pattern
| ^ no value can reach this
error[E0004]: non-exhaustive patterns: `Some(!)` not covered
--> $DIR/empty-types.rs:156:15
@ -259,73 +259,73 @@ error: unreachable pattern
--> $DIR/empty-types.rs:199:13
|
LL | _ => {}
| ^
| ^ matches no values because `!` is uninhabited
|
= note: this pattern 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: this pattern 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: this pattern 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: this pattern 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: this pattern 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: this pattern 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: this pattern 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: this pattern 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: this pattern 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
@ -478,25 +478,25 @@ error: unreachable pattern
--> $DIR/empty-types.rs:368:9
|
LL | _ => {}
| ^
| ^ matches no values because `[!; 3]` is uninhabited
|
= note: this pattern 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: this pattern 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: this pattern 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
@ -516,9 +516,9 @@ error: unreachable pattern
--> $DIR/empty-types.rs:395:9
|
LL | [] => {}
| -- matches all the values already
| -- matches all the relevant values
LL | _ => {}
| ^ unreachable pattern
| ^ no value can reach this
error[E0004]: non-exhaustive patterns: `[]` not covered
--> $DIR/empty-types.rs:397:11
@ -538,35 +538,35 @@ error: unreachable pattern
--> $DIR/empty-types.rs:416:9
|
LL | Some(_) => {}
| ^^^^^^^
| ^^^^^^^ matches no values because `!` is uninhabited
|
= note: this pattern 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: this pattern 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
|
LL | None => {}
| ---- matches all the values already
| ---- matches all the relevant values
LL | // !useful, !reachable
LL | _ => {}
| ^ unreachable pattern
| ^ no value can reach this
error: unreachable pattern
--> $DIR/empty-types.rs:431:9
|
LL | None => {}
| ---- matches all the values already
| ---- matches all the relevant values
LL | // !useful, !reachable
LL | _a => {}
| ^^ unreachable pattern
| ^^ no value can reach this
error[E0004]: non-exhaustive patterns: `&Some(!)` not covered
--> $DIR/empty-types.rs:451:11
@ -662,33 +662,33 @@ error: unreachable pattern
--> $DIR/empty-types.rs:603:9
|
LL | _ => {}
| ^
| ^ matches no values because `!` is uninhabited
|
= note: this pattern 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: this pattern 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: this pattern 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: this pattern 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

View file

@ -2,9 +2,9 @@ error: unreachable pattern
--> $DIR/empty-types.rs:49:9
|
LL | _ => {}
| ^
| ^ matches no values because `!` is uninhabited
|
= note: this pattern 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
|
@ -15,9 +15,9 @@ error: unreachable pattern
--> $DIR/empty-types.rs:52:9
|
LL | _x => {}
| ^^
| ^^ matches no values because `!` is uninhabited
|
= note: this pattern 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
@ -38,33 +38,33 @@ error: unreachable pattern
--> $DIR/empty-types.rs:70:9
|
LL | (_, _) => {}
| ^^^^^^
| ^^^^^^ matches no values because `(u32, !)` is uninhabited
|
= note: this pattern 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: this pattern 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: this pattern 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: this pattern 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
@ -89,17 +89,17 @@ error: unreachable pattern
--> $DIR/empty-types.rs:94:9
|
LL | Err(_) => {}
| ^^^^^^
| ^^^^^^ matches no values because `!` is uninhabited
|
= note: this pattern 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: this pattern 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
@ -151,81 +151,81 @@ error: unreachable pattern
--> $DIR/empty-types.rs:112:9
|
LL | _ => {}
| ^
| ^ matches no values because `Result<!, !>` is uninhabited
|
= note: this pattern 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: this pattern 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: this pattern 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: this pattern 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: this pattern 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: this pattern 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: this pattern 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: this pattern 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: this pattern 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
|
LL | None => {}
| ---- matches all the values already
| ---- matches all the relevant values
LL | _ => {}
| ^ unreachable pattern
| ^ no value can reach this
error[E0004]: non-exhaustive patterns: `Some(_)` not covered
--> $DIR/empty-types.rs:156:15
@ -250,73 +250,73 @@ error: unreachable pattern
--> $DIR/empty-types.rs:199:13
|
LL | _ => {}
| ^
| ^ matches no values because `!` is uninhabited
|
= note: this pattern 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: this pattern 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: this pattern 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: this pattern 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: this pattern 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: this pattern 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: this pattern 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: this pattern 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: this pattern 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
@ -469,25 +469,25 @@ error: unreachable pattern
--> $DIR/empty-types.rs:368:9
|
LL | _ => {}
| ^
| ^ matches no values because `[!; 3]` is uninhabited
|
= note: this pattern 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: this pattern 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: this pattern 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
@ -507,9 +507,9 @@ error: unreachable pattern
--> $DIR/empty-types.rs:395:9
|
LL | [] => {}
| -- matches all the values already
| -- matches all the relevant values
LL | _ => {}
| ^ unreachable pattern
| ^ no value can reach this
error[E0004]: non-exhaustive patterns: `[]` not covered
--> $DIR/empty-types.rs:397:11
@ -529,35 +529,35 @@ error: unreachable pattern
--> $DIR/empty-types.rs:416:9
|
LL | Some(_) => {}
| ^^^^^^^
| ^^^^^^^ matches no values because `!` is uninhabited
|
= note: this pattern 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: this pattern 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
|
LL | None => {}
| ---- matches all the values already
| ---- matches all the relevant values
LL | // !useful, !reachable
LL | _ => {}
| ^ unreachable pattern
| ^ no value can reach this
error: unreachable pattern
--> $DIR/empty-types.rs:431:9
|
LL | None => {}
| ---- matches all the values already
| ---- matches all the relevant values
LL | // !useful, !reachable
LL | _a => {}
| ^^ unreachable pattern
| ^^ no value can reach this
error[E0004]: non-exhaustive patterns: `&Some(_)` not covered
--> $DIR/empty-types.rs:451:11
@ -653,33 +653,33 @@ error: unreachable pattern
--> $DIR/empty-types.rs:603:9
|
LL | _ => {}
| ^
| ^ matches no values because `!` is uninhabited
|
= note: this pattern 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: this pattern 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: this pattern 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: this pattern 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

View file

@ -6,10 +6,10 @@
fn main() {
match (0u8,) {
(1 | 2,) => {}
//~^ NOTE matches all the values already
//~^ NOTE matches all the relevant values
(2,) => {}
//~^ ERROR unreachable pattern
//~| NOTE unreachable pattern
//~| NOTE no value can reach this
_ => {}
}
@ -20,18 +20,38 @@ fn main() {
//~^ NOTE matches some of the same values
(1 | 2,) => {}
//~^ ERROR unreachable pattern
//~| NOTE unreachable pattern
//~| NOTE these patterns collectively make the last one unreachable
//~| NOTE no value can reach this
//~| NOTE multiple earlier patterns match some of the same values
//~| NOTE collectively making this unreachable
_ => {}
}
match 0u8 {
1 => {}
//~^ NOTE matches some of the same values
2 => {}
//~^ NOTE matches some of the same values
3 => {}
//~^ NOTE matches some of the same values
4 => {}
//~^ NOTE matches some of the same values
5 => {}
6 => {}
1 ..= 6 => {}
//~^ ERROR unreachable pattern
//~| NOTE no value can reach this
//~| NOTE multiple earlier patterns match some of the same values
//~| NOTE ...and 2 other patterns
_ => {}
}
let res: Result<(),!> = Ok(());
match res {
Ok(_) => {}
Err(_) => {}
//~^ ERROR unreachable pattern
//~| NOTE this pattern matches no values because `!` is uninhabited
//~| NOTE matches no values because `!` is uninhabited
//~| NOTE to learn more about uninhabited types, see
}
#[derive(Copy, Clone)]
@ -44,22 +64,24 @@ fn main() {
match (&res1, res2) {
(Err(_), Err(_)) => {}
//~^ ERROR unreachable pattern
//~| NOTE this pattern matches no values because `Void2` is uninhabited
//~| 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 this pattern matches no values because `Void1` is uninhabited
//~| NOTE matches no values because `Void1` is uninhabited
//~| NOTE to learn more about uninhabited types, see
_ => {}
}
if let (0
//~^ NOTE matches all the values already
//~^ NOTE matches all the relevant values
| 0, _) = (0, 0) {}
//~^ ERROR unreachable pattern
//~| NOTE unreachable pattern
//~| NOTE no value can reach this
match (true, true) {
(_, true) if false => {} // Guarded patterns don't cover others
@ -69,20 +91,20 @@ fn main() {
//~^ NOTE matches some of the same values
(_, true) => {}
//~^ ERROR unreachable pattern
//~| NOTE unreachable pattern
//~| NOTE these patterns collectively make the last one unreachable
//~| NOTE no value can reach this
//~| NOTE multiple earlier patterns match some of the same values
//~| NOTE collectively making this unreachable
}
match (true, true) {
(true, _) => {}
//~^ NOTE matches all the values already
//~^ NOTE matches all the relevant values
(false, _) => {}
#[allow(unreachable_patterns)]
(_, true) => {} // Doesn't cover below because it's already unreachable.
(true, true) => {}
//~^ ERROR unreachable pattern
//~| NOTE unreachable pattern
//~| NOTE no value can reach this
}
// Despite skipping some irrelevant cases, we still report a set of rows that covers the
@ -90,11 +112,11 @@ fn main() {
match (true, true, 0) {
(true, _, _) => {}
(_, true, 0..10) => {}
//~^ NOTE matches all the values already
//~^ NOTE matches all the relevant values
(_, true, 10..) => {}
(_, true, 3) => {}
//~^ ERROR unreachable pattern
//~| NOTE unreachable pattern
//~| NOTE no value can reach this
_ => {}
}
}

View file

@ -2,10 +2,10 @@ error: unreachable pattern
--> $DIR/explain-unreachable-pats.rs:10:9
|
LL | (1 | 2,) => {}
| -------- matches all the values already
| -------- matches all the relevant values
LL |
LL | (2,) => {}
| ^^^^ unreachable pattern
| ^^^^ no value can reach this
|
note: the lint level is defined here
--> $DIR/explain-unreachable-pats.rs:2:9
@ -17,9 +17,9 @@ error: unreachable pattern
--> $DIR/explain-unreachable-pats.rs:21:9
|
LL | (1 | 2,) => {}
| ^^^^^^^^ unreachable pattern
| ^^^^^^^^ no value can reach this
|
note: these patterns collectively make the last one unreachable
note: multiple earlier patterns match some of the same values
--> $DIR/explain-unreachable-pats.rs:21:9
|
LL | (1,) => {}
@ -32,46 +32,70 @@ LL | (1 | 2,) => {}
| ^^^^^^^^ collectively making this unreachable
error: unreachable pattern
--> $DIR/explain-unreachable-pats.rs:32:9
--> $DIR/explain-unreachable-pats.rs:40:9
|
LL | Err(_) => {}
| ^^^^^^
LL | 1 ..= 6 => {}
| ^^^^^^^ no value can reach this
|
= note: this pattern matches no values because `!` is uninhabited
error: unreachable pattern
--> $DIR/explain-unreachable-pats.rs:45:9
note: multiple earlier patterns match some of the same values
--> $DIR/explain-unreachable-pats.rs:40:9
|
LL | (Err(_), Err(_)) => {}
| ^^^^^^^^^^^^^^^^
|
= note: this pattern matches no values because `Void2` is uninhabited
LL | 1 => {}
| - matches some of the same values
LL |
LL | 2 => {}
| - matches some of the same values
LL |
LL | 3 => {}
| - matches some of the same values
LL |
LL | 4 => {}
| - matches some of the same values
...
LL | 1 ..= 6 => {}
| ^^^^^^^ ...and 2 other patterns collectively make this unreachable
error: unreachable pattern
--> $DIR/explain-unreachable-pats.rs:51:9
|
LL | (Err(_), Err(_)) => {}
| ^^^^^^^^^^^^^^^^
LL | Err(_) => {}
| ^^^^^^ matches no values because `!` is uninhabited
|
= note: this pattern 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:65:9
|
LL | (Err(_), Err(_)) => {}
| ^^^^^^^^^^^^^^^^ 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: 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:82:11
|
LL | if let (0
| - matches all the values already
| - matches all the relevant values
LL |
LL | | 0, _) = (0, 0) {}
| ^ unreachable pattern
| ^ no value can reach this
error: unreachable pattern
--> $DIR/explain-unreachable-pats.rs:70:9
--> $DIR/explain-unreachable-pats.rs:92:9
|
LL | (_, true) => {}
| ^^^^^^^^^ unreachable pattern
| ^^^^^^^^^ no value can reach this
|
note: these patterns collectively make the last one unreachable
--> $DIR/explain-unreachable-pats.rs:70:9
note: multiple earlier patterns match some of the same values
--> $DIR/explain-unreachable-pats.rs:92:9
|
LL | (true, _) => {}
| --------- matches some of the same values
@ -83,22 +107,22 @@ LL | (_, true) => {}
| ^^^^^^^^^ collectively making this unreachable
error: unreachable pattern
--> $DIR/explain-unreachable-pats.rs:83:9
--> $DIR/explain-unreachable-pats.rs:105:9
|
LL | (true, _) => {}
| --------- matches all the values already
| --------- matches all the relevant values
...
LL | (true, true) => {}
| ^^^^^^^^^^^^ unreachable pattern
| ^^^^^^^^^^^^ no value can reach this
error: unreachable pattern
--> $DIR/explain-unreachable-pats.rs:95:9
--> $DIR/explain-unreachable-pats.rs:117:9
|
LL | (_, true, 0..10) => {}
| ---------------- matches all the values already
| ---------------- matches all the relevant values
...
LL | (_, true, 3) => {}
| ^^^^^^^^^^^^ unreachable pattern
| ^^^^^^^^^^^^ no value can reach this
error: aborting due to 9 previous errors
error: aborting due to 10 previous errors

View file

@ -15,9 +15,9 @@ error: unreachable pattern
--> $DIR/floats.rs:18:9
|
LL | 0.01f16..=6.5f16 => {}
| ---------------- matches all the values already
| ---------------- matches all the relevant values
LL | 0.01f16 => {}
| ^^^^^^^ unreachable pattern
| ^^^^^^^ no value can reach this
|
note: the lint level is defined here
--> $DIR/floats.rs:1:9
@ -29,117 +29,117 @@ error: unreachable pattern
--> $DIR/floats.rs:19:9
|
LL | 0.01f16..=6.5f16 => {}
| ---------------- matches all the values already
| ---------------- matches all the relevant values
LL | 0.01f16 => {}
LL | 0.02f16 => {}
| ^^^^^^^ unreachable pattern
| ^^^^^^^ no value can reach this
error: unreachable pattern
--> $DIR/floats.rs:20:9
|
LL | 0.01f16..=6.5f16 => {}
| ---------------- matches all the values already
| ---------------- matches all the relevant values
...
LL | 6.5f16 => {}
| ^^^^^^ unreachable pattern
| ^^^^^^ no value can reach this
error: unreachable pattern
--> $DIR/floats.rs:31:9
|
LL | 0.01f32..=6.5f32 => {}
| ---------------- matches all the values already
| ---------------- matches all the relevant values
LL | 0.01f32 => {}
| ^^^^^^^ unreachable pattern
| ^^^^^^^ no value can reach this
error: unreachable pattern
--> $DIR/floats.rs:32:9
|
LL | 0.01f32..=6.5f32 => {}
| ---------------- matches all the values already
| ---------------- matches all the relevant values
LL | 0.01f32 => {}
LL | 0.02f32 => {}
| ^^^^^^^ unreachable pattern
| ^^^^^^^ no value can reach this
error: unreachable pattern
--> $DIR/floats.rs:33:9
|
LL | 0.01f32..=6.5f32 => {}
| ---------------- matches all the values already
| ---------------- matches all the relevant values
...
LL | 6.5f32 => {}
| ^^^^^^ unreachable pattern
| ^^^^^^ no value can reach this
error: unreachable pattern
--> $DIR/floats.rs:45:9
|
LL | 0.01f64..=6.5f64 => {}
| ---------------- matches all the values already
| ---------------- matches all the relevant values
LL | 0.005f64 => {}
LL | 0.01f64 => {}
| ^^^^^^^ unreachable pattern
| ^^^^^^^ no value can reach this
error: unreachable pattern
--> $DIR/floats.rs:46:9
|
LL | 0.01f64..=6.5f64 => {}
| ---------------- matches all the values already
| ---------------- matches all the relevant values
...
LL | 0.02f64 => {}
| ^^^^^^^ unreachable pattern
| ^^^^^^^ no value can reach this
error: unreachable pattern
--> $DIR/floats.rs:47:9
|
LL | 0.01f64..=6.5f64 => {}
| ---------------- matches all the values already
| ---------------- matches all the relevant values
...
LL | 6.5f64 => {}
| ^^^^^^ unreachable pattern
| ^^^^^^ no value can reach this
error: unreachable pattern
--> $DIR/floats.rs:49:9
|
LL | 0.01f64..=6.5f64 => {}
| ---------------- matches all the values already
| ---------------- matches all the relevant values
...
LL | 1.0f64..=4.0f64 => {}
| ^^^^^^^^^^^^^^^ unreachable pattern
| ^^^^^^^^^^^^^^^ no value can reach this
error: unreachable pattern
--> $DIR/floats.rs:62:9
|
LL | 0.01f128..=6.5f128 => {}
| ------------------ matches all the values already
| ------------------ matches all the relevant values
LL | 0.005f128 => {}
LL | 0.01f128 => {}
| ^^^^^^^^ unreachable pattern
| ^^^^^^^^ no value can reach this
error: unreachable pattern
--> $DIR/floats.rs:63:9
|
LL | 0.01f128..=6.5f128 => {}
| ------------------ matches all the values already
| ------------------ matches all the relevant values
...
LL | 0.02f128 => {}
| ^^^^^^^^ unreachable pattern
| ^^^^^^^^ no value can reach this
error: unreachable pattern
--> $DIR/floats.rs:64:9
|
LL | 0.01f128..=6.5f128 => {}
| ------------------ matches all the values already
| ------------------ matches all the relevant values
...
LL | 6.5f128 => {}
| ^^^^^^^ unreachable pattern
| ^^^^^^^ no value can reach this
error: unreachable pattern
--> $DIR/floats.rs:66:9
|
LL | 0.01f128..=6.5f128 => {}
| ------------------ matches all the values already
| ------------------ matches all the relevant values
...
LL | 1.0f128..=4.0f128 => {}
| ^^^^^^^^^^^^^^^^^ unreachable pattern
| ^^^^^^^^^^^^^^^^^ no value can reach this
error: aborting due to 15 previous errors

View file

@ -2,9 +2,9 @@ error: unreachable pattern
--> $DIR/impl-trait.rs:16:13
|
LL | _ => {}
| ^
| ^ matches no values because `Void` is uninhabited
|
= note: this pattern 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
|
@ -15,49 +15,49 @@ error: unreachable pattern
--> $DIR/impl-trait.rs:30:13
|
LL | _ => {}
| ^
| ^ matches no values because `Void` is uninhabited
|
= note: this pattern 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: this pattern 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
|
LL | None => {}
| ---- matches all the values already
| ---- matches all the relevant values
LL | _ => {}
| ^ unreachable pattern
| ^ no value can reach this
error: unreachable pattern
--> $DIR/impl-trait.rs:58:13
|
LL | Some(_) => {}
| ^^^^^^^
| ^^^^^^^ matches no values because `Void` is uninhabited
|
= note: this pattern 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
|
LL | None => {}
| ---- matches all the values already
| ---- matches all the relevant values
LL | _ => {}
| ^ unreachable pattern
| ^ no value can reach this
error: unreachable pattern
--> $DIR/impl-trait.rs:75:9
|
LL | _ => {}
| ^
| ^ matches no values because `Void` is uninhabited
|
= note: this pattern 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
@ -65,23 +65,23 @@ error: unreachable pattern
LL | _ => {}
| - matches any value
LL | Some((a, b)) => {}
| ^^^^^^^^^^^^ unreachable pattern
| ^^^^^^^^^^^^ no value can reach this
error: unreachable pattern
--> $DIR/impl-trait.rs:93:13
|
LL | _ => {}
| ^
| ^ matches no values because `Void` is uninhabited
|
= note: this pattern 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
|
LL | Some((a, b)) => {}
| ------------ matches all the values already
| ------------ matches all the relevant values
LL | Some((mut x, mut y)) => {
| ^^^^^^^^^^^^^^^^^^^^ unreachable pattern
| ^^^^^^^^^^^^^^^^^^^^ no value can reach this
error: unreachable pattern
--> $DIR/impl-trait.rs:123:13
@ -89,23 +89,23 @@ error: unreachable pattern
LL | _ => {}
| - matches any value
LL | Rec { n: 0, w: Some(Rec { n: 0, w: _ }) } => {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unreachable pattern
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no value can reach this
error: unreachable pattern
--> $DIR/impl-trait.rs:137:13
|
LL | _ => {}
| ^
| ^ matches no values because `SecretelyVoid` is uninhabited
|
= note: this pattern 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: this pattern 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

View file

@ -2,9 +2,9 @@ error: unreachable pattern
--> $DIR/reachability.rs:18:17
|
LL | m!(0u8, 42, 42);
| -- ^^ unreachable pattern
| -- ^^ no value can reach this
| |
| matches all the values already
| matches all the relevant values
|
note: the lint level is defined here
--> $DIR/reachability.rs:3:9
@ -16,129 +16,129 @@ error: unreachable pattern
--> $DIR/reachability.rs:22:22
|
LL | m!(0u8, 20..=30, 20);
| ------- ^^ unreachable pattern
| ------- ^^ no value can reach this
| |
| matches all the values already
| matches all the relevant values
error: unreachable pattern
--> $DIR/reachability.rs:23:22
|
LL | m!(0u8, 20..=30, 21);
| ------- ^^ unreachable pattern
| ------- ^^ no value can reach this
| |
| matches all the values already
| matches all the relevant values
error: unreachable pattern
--> $DIR/reachability.rs:24:22
|
LL | m!(0u8, 20..=30, 25);
| ------- ^^ unreachable pattern
| ------- ^^ no value can reach this
| |
| matches all the values already
| matches all the relevant values
error: unreachable pattern
--> $DIR/reachability.rs:25:22
|
LL | m!(0u8, 20..=30, 29);
| ------- ^^ unreachable pattern
| ------- ^^ no value can reach this
| |
| matches all the values already
| matches all the relevant values
error: unreachable pattern
--> $DIR/reachability.rs:26:22
|
LL | m!(0u8, 20..=30, 30);
| ------- ^^ unreachable pattern
| ------- ^^ no value can reach this
| |
| matches all the values already
| matches all the relevant values
error: unreachable pattern
--> $DIR/reachability.rs:29:21
|
LL | m!(0u8, 20..30, 20);
| ------ ^^ unreachable pattern
| ------ ^^ no value can reach this
| |
| matches all the values already
| matches all the relevant values
error: unreachable pattern
--> $DIR/reachability.rs:30:21
|
LL | m!(0u8, 20..30, 21);
| ------ ^^ unreachable pattern
| ------ ^^ no value can reach this
| |
| matches all the values already
| matches all the relevant values
error: unreachable pattern
--> $DIR/reachability.rs:31:21
|
LL | m!(0u8, 20..30, 25);
| ------ ^^ unreachable pattern
| ------ ^^ no value can reach this
| |
| matches all the values already
| matches all the relevant values
error: unreachable pattern
--> $DIR/reachability.rs:32:21
|
LL | m!(0u8, 20..30, 29);
| ------ ^^ unreachable pattern
| ------ ^^ no value can reach this
| |
| matches all the values already
| matches all the relevant values
error: unreachable pattern
--> $DIR/reachability.rs:36:22
|
LL | m!(0u8, 20..=30, 20..=30);
| ------- ^^^^^^^ unreachable pattern
| ------- ^^^^^^^ no value can reach this
| |
| matches all the values already
| matches all the relevant values
error: unreachable pattern
--> $DIR/reachability.rs:37:22
|
LL | m!(0u8, 20.. 30, 20.. 30);
| ------- ^^^^^^^ unreachable pattern
| ------- ^^^^^^^ no value can reach this
| |
| matches all the values already
| matches all the relevant values
error: unreachable pattern
--> $DIR/reachability.rs:38:22
|
LL | m!(0u8, 20..=30, 20.. 30);
| ------- ^^^^^^^ unreachable pattern
| ------- ^^^^^^^ no value can reach this
| |
| matches all the values already
| matches all the relevant values
error: unreachable pattern
--> $DIR/reachability.rs:40:22
|
LL | m!(0u8, 20..=30, 21..=30);
| ------- ^^^^^^^ unreachable pattern
| ------- ^^^^^^^ no value can reach this
| |
| matches all the values already
| matches all the relevant values
error: unreachable pattern
--> $DIR/reachability.rs:41:22
|
LL | m!(0u8, 20..=30, 20..=29);
| ------- ^^^^^^^ unreachable pattern
| ------- ^^^^^^^ no value can reach this
| |
| matches all the values already
| matches all the relevant values
error: unreachable pattern
--> $DIR/reachability.rs:43:24
|
LL | m!('a', 'A'..='z', 'a'..='z');
| --------- ^^^^^^^^^ unreachable pattern
| --------- ^^^^^^^^^ no value can reach this
| |
| matches all the values already
| matches all the relevant values
error: unreachable pattern
--> $DIR/reachability.rs:50:9
|
LL | 5..=8 => {},
| ^^^^^ unreachable pattern
| ^^^^^ no value can reach this
|
note: these patterns collectively make the last one unreachable
note: multiple earlier patterns match some of the same values
--> $DIR/reachability.rs:50:9
|
LL | 5 => {},
@ -156,9 +156,9 @@ error: unreachable pattern
--> $DIR/reachability.rs:56:9
|
LL | 5..15 => {},
| ^^^^^ unreachable pattern
| ^^^^^ no value can reach this
|
note: these patterns collectively make the last one unreachable
note: multiple earlier patterns match some of the same values
--> $DIR/reachability.rs:56:9
|
LL | 0..10 => {},
@ -172,9 +172,9 @@ error: unreachable pattern
--> $DIR/reachability.rs:63:9
|
LL | 5..25 => {},
| ^^^^^ unreachable pattern
| ^^^^^ no value can reach this
|
note: these patterns collectively make the last one unreachable
note: multiple earlier patterns match some of the same values
--> $DIR/reachability.rs:63:9
|
LL | 0..10 => {},
@ -190,9 +190,9 @@ error: unreachable pattern
--> $DIR/reachability.rs:71:9
|
LL | 5..25 => {},
| ^^^^^ unreachable pattern
| ^^^^^ no value can reach this
|
note: these patterns collectively make the last one unreachable
note: multiple earlier patterns match some of the same values
--> $DIR/reachability.rs:71:9
|
LL | 0..10 => {},
@ -210,9 +210,9 @@ error: unreachable pattern
--> $DIR/reachability.rs:77:9
|
LL | 5..15 => {},
| ^^^^^ unreachable pattern
| ^^^^^ no value can reach this
|
note: these patterns collectively make the last one unreachable
note: multiple earlier patterns match some of the same values
--> $DIR/reachability.rs:77:9
|
LL | 0..10 => {},
@ -228,15 +228,15 @@ error: unreachable pattern
LL | _ => {},
| - matches any value
LL | '\u{D7FF}'..='\u{E000}' => {},
| ^^^^^^^^^^^^^^^^^^^^^^^ unreachable pattern
| ^^^^^^^^^^^^^^^^^^^^^^^ no value can reach this
error: unreachable pattern
--> $DIR/reachability.rs:89:9
|
LL | '\u{D7FF}'..='\u{E000}' => {},
| ^^^^^^^^^^^^^^^^^^^^^^^ unreachable pattern
| ^^^^^^^^^^^^^^^^^^^^^^^ no value can reach this
|
note: these patterns collectively make the last one unreachable
note: multiple earlier patterns match some of the same values
--> $DIR/reachability.rs:89:9
|
LL | '\u{0}'..='\u{D7FF}' => {},
@ -250,18 +250,18 @@ error: unreachable pattern
--> $DIR/reachability.rs:105:9
|
LL | &42 => {}
| --- matches all the values already
| --- matches all the relevant values
LL | &FOO => {}
| ^^^^ unreachable pattern
| ^^^^ no value can reach this
error: unreachable pattern
--> $DIR/reachability.rs:106:9
|
LL | &42 => {}
| --- matches all the values already
| --- matches all the relevant values
LL | &FOO => {}
LL | BAR => {}
| ^^^ unreachable pattern
| ^^^ no value can reach this
error: aborting due to 25 previous errors

View file

@ -2,9 +2,9 @@ error: unreachable pattern
--> $DIR/issue-12116.rs:15:9
|
LL | &IntList::Cons(val, box ref next_list) => tail(next_list),
| -------------------------------------- matches all the values already
| -------------------------------------- matches all the relevant values
LL | &IntList::Cons(val, box IntList::Nil) => IntList::Cons(val, Box::new(IntList::Nil)),
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unreachable pattern
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no value can reach this
|
note: the lint level is defined here
--> $DIR/issue-12116.rs:4:9

View file

@ -2,9 +2,9 @@ error: unreachable pattern
--> $DIR/issue-12369.rs:9:9
|
LL | &[10,a, ref rest @ ..] => 10
| ^^^^^^^^^^^^^^^^^^^^^^ unreachable pattern
| ^^^^^^^^^^^^^^^^^^^^^^ no value can reach this
|
note: these patterns collectively make the last one unreachable
note: multiple earlier patterns match some of the same values
--> $DIR/issue-12369.rs:9:9
|
LL | &[a,b,c] => 3,

View file

@ -2,9 +2,9 @@ error: unreachable pattern
--> $DIR/issue-13727.rs:7:5
|
LL | 256 => print!("0b1110\n"),
| --- matches all the values already
| --- matches all the relevant values
LL | 512 => print!("0b1111\n"),
| ^^^ unreachable pattern
| ^^^ no value can reach this
|
note: the lint level is defined here
--> $DIR/issue-13727.rs:2:9

View file

@ -2,9 +2,9 @@ error: unreachable pattern
--> $DIR/issue-30240-b.rs:12:9
|
LL | "hello" => {}
| ------- matches all the values already
| ------- matches all the relevant values
LL | "hello" => {}
| ^^^^^^^ unreachable pattern
| ^^^^^^^ no value can reach this
|
note: the lint level is defined here
--> $DIR/issue-30240-b.rs:1:9

View file

@ -4,7 +4,7 @@ error: unreachable pattern
LL | Var3 => (),
| ---- matches any value
LL | Var2 => (),
| ^^^^ unreachable pattern
| ^^^^ no value can reach this
|
note: the lint level is defined here
--> $DIR/issue-31221.rs:4:9
@ -18,15 +18,15 @@ error: unreachable pattern
LL | &Var3 => (),
| ----- matches any value
LL | &Var2 => (),
| ^^^^^ unreachable pattern
| ^^^^^ no value can reach this
error: unreachable pattern
--> $DIR/issue-31221.rs:31:9
|
LL | anything => ()
| ^^^^^^^^ unreachable pattern
| ^^^^^^^^ no value can reach this
|
note: these patterns collectively make the last one unreachable
note: multiple earlier patterns match some of the same values
--> $DIR/issue-31221.rs:31:9
|
LL | (Var1, b) => (),

View file

@ -2,9 +2,9 @@ error: unreachable pattern
--> $DIR/issue-57472.rs:15:13
|
LL | Punned { foo: [_], .. } => println!("foo"),
| ----------------------- matches all the values already
| ----------------------- matches all the relevant values
LL | Punned { bar: [_], .. } => println!("bar"),
| ^^^^^^^^^^^^^^^^^^^^^^^ unreachable pattern
| ^^^^^^^^^^^^^^^^^^^^^^^ no value can reach this
|
note: the lint level is defined here
--> $DIR/issue-57472.rs:2:9
@ -16,9 +16,9 @@ error: unreachable pattern
--> $DIR/issue-57472.rs:32:17
|
LL | Punned { foo: [_] } => println!("foo"),
| ------------------- matches all the values already
| ------------------- matches all the relevant values
LL | Punned { bar: [_] } => println!("bar"),
| ^^^^^^^^^^^^^^^^^^^ unreachable pattern
| ^^^^^^^^^^^^^^^^^^^ no value can reach this
error: aborting due to 2 previous errors

View file

@ -2,10 +2,10 @@ error: unreachable pattern
--> $DIR/match-arm-statics.rs:25:9
|
LL | TRUE_TRUE => (),
| --------- matches all the values already
| --------- matches all the relevant values
...
LL | (true, true) => ()
| ^^^^^^^^^^^^ unreachable pattern
| ^^^^^^^^^^^^ no value can reach this
|
note: the lint level is defined here
--> $DIR/match-arm-statics.rs:2:9
@ -17,18 +17,18 @@ error: unreachable pattern
--> $DIR/match-arm-statics.rs:40:9
|
LL | Some(Some(EAST)) => (),
| ---------------- matches all the values already
| ---------------- matches all the relevant values
...
LL | Some(Some(East)) => (),
| ^^^^^^^^^^^^^^^^ unreachable pattern
| ^^^^^^^^^^^^^^^^ no value can reach this
error: unreachable pattern
--> $DIR/match-arm-statics.rs:60:9
|
LL | Foo { bar: Some(EAST), baz: NewBool(false) } => ()
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unreachable pattern
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no value can reach this
|
note: these patterns collectively make the last one unreachable
note: multiple earlier patterns match some of the same values
--> $DIR/match-arm-statics.rs:60:9
|
LL | Foo { bar: _, baz: NEW_FALSE } => (),

View file

@ -2,9 +2,9 @@ error: unreachable pattern
--> $DIR/match-byte-array-patterns.rs:8:9
|
LL | b"AAAA" => {},
| ------- matches all the values already
| ------- matches all the relevant values
LL | &[0x41, 0x41, 0x41, 0x41] => {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^ unreachable pattern
| ^^^^^^^^^^^^^^^^^^^^^^^^^ no value can reach this
|
note: the lint level is defined here
--> $DIR/match-byte-array-patterns.rs:1:9
@ -16,57 +16,57 @@ error: unreachable pattern
--> $DIR/match-byte-array-patterns.rs:14:9
|
LL | &[0x41, 0x41, 0x41, 0x41] => {}
| ------------------------- matches all the values already
| ------------------------- matches all the relevant values
LL | b"AAAA" => {},
| ^^^^^^^ unreachable pattern
| ^^^^^^^ no value can reach this
error: unreachable pattern
--> $DIR/match-byte-array-patterns.rs:20:9
|
LL | &[_, 0x41, 0x41, 0x41] => {},
| ---------------------- matches all the values already
| ---------------------- matches all the relevant values
LL | b"AAAA" => {},
| ^^^^^^^ unreachable pattern
| ^^^^^^^ no value can reach this
error: unreachable pattern
--> $DIR/match-byte-array-patterns.rs:26:9
|
LL | &[0x41, .., 0x41] => {}
| ----------------- matches all the values already
| ----------------- matches all the relevant values
LL | b"AAAA" => {},
| ^^^^^^^ unreachable pattern
| ^^^^^^^ no value can reach this
error: unreachable pattern
--> $DIR/match-byte-array-patterns.rs:34:9
|
LL | b"AAAA" => {},
| ------- matches all the values already
| ------- matches all the relevant values
LL | &[0x41, 0x41, 0x41, 0x41] => {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^ unreachable pattern
| ^^^^^^^^^^^^^^^^^^^^^^^^^ no value can reach this
error: unreachable pattern
--> $DIR/match-byte-array-patterns.rs:40:9
|
LL | &[0x41, 0x41, 0x41, 0x41] => {}
| ------------------------- matches all the values already
| ------------------------- matches all the relevant values
LL | b"AAAA" => {},
| ^^^^^^^ unreachable pattern
| ^^^^^^^ no value can reach this
error: unreachable pattern
--> $DIR/match-byte-array-patterns.rs:46:9
|
LL | &[_, 0x41, 0x41, 0x41] => {},
| ---------------------- matches all the values already
| ---------------------- matches all the relevant values
LL | b"AAAA" => {},
| ^^^^^^^ unreachable pattern
| ^^^^^^^ no value can reach this
error: unreachable pattern
--> $DIR/match-byte-array-patterns.rs:52:9
|
LL | &[0x41, .., 0x41] => {}
| ----------------- matches all the values already
| ----------------- matches all the relevant values
LL | b"AAAA" => {},
| ^^^^^^^ unreachable pattern
| ^^^^^^^ no value can reach this
error: aborting due to 8 previous errors

View file

@ -2,9 +2,9 @@ error: unreachable pattern
--> $DIR/match-ref-ice.rs:13:9
|
LL | [1, ref _madoka, 3] => (),
| ------------------- matches all the values already
| ------------------- matches all the relevant values
LL | [1, 2, 3] => (),
| ^^^^^^^^^ unreachable pattern
| ^^^^^^^^^ no value can reach this
|
note: the lint level is defined here
--> $DIR/match-ref-ice.rs:1:9

View file

@ -2,9 +2,9 @@ error: unreachable pattern
--> $DIR/match-vec-fixed.rs:7:9
|
LL | [_, _, _] => {}
| --------- matches all the values already
| --------- matches all the relevant values
LL | [_, _, _] => {}
| ^^^^^^^^^ unreachable pattern
| ^^^^^^^^^ no value can reach this
|
note: the lint level is defined here
--> $DIR/match-vec-fixed.rs:1:9
@ -16,9 +16,9 @@ error: unreachable pattern
--> $DIR/match-vec-fixed.rs:11:9
|
LL | [_, 1, _] => {}
| --------- matches all the values already
| --------- matches all the relevant values
LL | [_, 1, _] => {}
| ^^^^^^^^^ unreachable pattern
| ^^^^^^^^^ no value can reach this
error: aborting due to 2 previous errors

View file

@ -2,9 +2,9 @@ error: unreachable pattern
--> $DIR/match-vec-unreachable.rs:8:9
|
LL | [a, (2, 3), _] => (),
| -------------- matches all the values already
| -------------- matches all the relevant values
LL | [(1, 2), (2, 3), b] => (),
| ^^^^^^^^^^^^^^^^^^^ unreachable pattern
| ^^^^^^^^^^^^^^^^^^^ no value can reach this
|
note: the lint level is defined here
--> $DIR/match-vec-unreachable.rs:1:9
@ -16,17 +16,17 @@ error: unreachable pattern
--> $DIR/match-vec-unreachable.rs:18:9
|
LL | [ref a, _, _, ..] => { println!("{}", a); }
| ----------------- matches all the values already
| ----------------- matches all the relevant values
LL | [_, _, _, _, _] => { }
| ^^^^^^^^^^^^^^^ unreachable pattern
| ^^^^^^^^^^^^^^^ no value can reach this
error: unreachable pattern
--> $DIR/match-vec-unreachable.rs:26:9
|
LL | ['a', 'b', 'c', ref _tail @ ..] => {}
| ------------------------------- matches all the values already
| ------------------------------- matches all the relevant values
LL | ['a', 'b', 'c'] => {}
| ^^^^^^^^^^^^^^^ unreachable pattern
| ^^^^^^^^^^^^^^^ no value can reach this
error: aborting due to 3 previous errors

View file

@ -2,10 +2,10 @@ error: unreachable pattern
--> $DIR/slice-pattern-const-2.rs:9:9
|
LL | MAGIC_TEST => (),
| ---------- matches all the values already
| ---------- matches all the relevant values
LL | [0x00, 0x00, 0x00, 0x00] => (),
LL | [4, 5, 6, 7] => (),
| ^^^^^^^^^^^^ unreachable pattern
| ^^^^^^^^^^^^ no value can reach this
|
note: the lint level is defined here
--> $DIR/slice-pattern-const-2.rs:1:9
@ -17,25 +17,25 @@ error: unreachable pattern
--> $DIR/slice-pattern-const-2.rs:15:9
|
LL | MAGIC_TEST => (),
| ---------- matches all the values already
| ---------- matches all the relevant values
LL | [4, 5, 6, 7] => (),
| ^^^^^^^^^^^^ unreachable pattern
| ^^^^^^^^^^^^ no value can reach this
error: unreachable pattern
--> $DIR/slice-pattern-const-2.rs:21:9
|
LL | [4, 5, 6, 7] => (),
| ------------ matches all the values already
| ------------ matches all the relevant values
LL | MAGIC_TEST => (),
| ^^^^^^^^^^ unreachable pattern
| ^^^^^^^^^^ no value can reach this
error: unreachable pattern
--> $DIR/slice-pattern-const-2.rs:28:9
|
LL | [4] => (),
| --- matches all the values already
| --- matches all the relevant values
LL | FOO => (),
| ^^^ unreachable pattern
| ^^^ no value can reach this
error: aborting due to 4 previous errors

View file

@ -2,10 +2,10 @@ error: unreachable pattern
--> $DIR/slice-pattern-const-3.rs:9:9
|
LL | MAGIC_TEST => (),
| ---------- matches all the values already
| ---------- matches all the relevant values
LL | ["0x00", "0x00", "0x00", "0x00"] => (),
LL | ["4", "5", "6", "7"] => (),
| ^^^^^^^^^^^^^^^^^^^^ unreachable pattern
| ^^^^^^^^^^^^^^^^^^^^ no value can reach this
|
note: the lint level is defined here
--> $DIR/slice-pattern-const-3.rs:1:9
@ -17,25 +17,25 @@ error: unreachable pattern
--> $DIR/slice-pattern-const-3.rs:15:9
|
LL | MAGIC_TEST => (),
| ---------- matches all the values already
| ---------- matches all the relevant values
LL | ["4", "5", "6", "7"] => (),
| ^^^^^^^^^^^^^^^^^^^^ unreachable pattern
| ^^^^^^^^^^^^^^^^^^^^ no value can reach this
error: unreachable pattern
--> $DIR/slice-pattern-const-3.rs:21:9
|
LL | ["4", "5", "6", "7"] => (),
| -------------------- matches all the values already
| -------------------- matches all the relevant values
LL | MAGIC_TEST => (),
| ^^^^^^^^^^ unreachable pattern
| ^^^^^^^^^^ no value can reach this
error: unreachable pattern
--> $DIR/slice-pattern-const-3.rs:28:9
|
LL | ["boo"] => (),
| ------- matches all the values already
| ------- matches all the relevant values
LL | FOO => (),
| ^^^ unreachable pattern
| ^^^ no value can reach this
error: aborting due to 4 previous errors

View file

@ -2,10 +2,10 @@ error: unreachable pattern
--> $DIR/slice-pattern-const.rs:9:9
|
LL | MAGIC_TEST => (),
| ---------- matches all the values already
| ---------- matches all the relevant values
LL | [0x00, 0x00, 0x00, 0x00] => (),
LL | [84, 69, 83, 84] => (),
| ^^^^^^^^^^^^^^^^ unreachable pattern
| ^^^^^^^^^^^^^^^^ no value can reach this
|
note: the lint level is defined here
--> $DIR/slice-pattern-const.rs:1:9
@ -17,67 +17,67 @@ error: unreachable pattern
--> $DIR/slice-pattern-const.rs:15:9
|
LL | MAGIC_TEST => (),
| ---------- matches all the values already
| ---------- matches all the relevant values
LL | [84, 69, 83, 84] => (),
| ^^^^^^^^^^^^^^^^ unreachable pattern
| ^^^^^^^^^^^^^^^^ no value can reach this
error: unreachable pattern
--> $DIR/slice-pattern-const.rs:21:9
|
LL | [84, 69, 83, 84] => (),
| ---------------- matches all the values already
| ---------------- matches all the relevant values
LL | MAGIC_TEST => (),
| ^^^^^^^^^^ unreachable pattern
| ^^^^^^^^^^ no value can reach this
error: unreachable pattern
--> $DIR/slice-pattern-const.rs:28:9
|
LL | [4] => (),
| --- matches all the values already
| --- matches all the relevant values
LL | FOO => (),
| ^^^ unreachable pattern
| ^^^ no value can reach this
error: unreachable pattern
--> $DIR/slice-pattern-const.rs:35:9
|
LL | [4] => (),
| --- matches all the values already
| --- matches all the relevant values
LL | BAR => (),
| ^^^ unreachable pattern
| ^^^ no value can reach this
error: unreachable pattern
--> $DIR/slice-pattern-const.rs:43:9
|
LL | [] => (),
| -- matches all the values already
| -- matches all the relevant values
LL | BOO => (),
| ^^^ unreachable pattern
| ^^^ no value can reach this
error: unreachable pattern
--> $DIR/slice-pattern-const.rs:44:9
|
LL | [] => (),
| -- matches all the values already
| -- matches all the relevant values
LL | BOO => (),
LL | b"" => (),
| ^^^ unreachable pattern
| ^^^ no value can reach this
error: unreachable pattern
--> $DIR/slice-pattern-const.rs:45:9
|
LL | [] => (),
| -- matches all the values already
| -- matches all the relevant values
...
LL | _ => (),
| ^ unreachable pattern
| ^ no value can reach this
error: unreachable pattern
--> $DIR/slice-pattern-const.rs:51:9
|
LL | CONST1 => {}
| ------ matches all the values already
| ------ matches all the relevant values
LL | [true] => {}
| ^^^^^^ unreachable pattern
| ^^^^^^ no value can reach this
error: aborting due to 9 previous errors

View file

@ -2,9 +2,9 @@ error: unreachable pattern
--> $DIR/slice-patterns-reachability.rs:8:9
|
LL | [true, ..] => {}
| ---------- matches all the values already
| ---------- matches all the relevant values
LL | [true, ..] => {}
| ^^^^^^^^^^ unreachable pattern
| ^^^^^^^^^^ no value can reach this
|
note: the lint level is defined here
--> $DIR/slice-patterns-reachability.rs:1:9
@ -16,44 +16,44 @@ error: unreachable pattern
--> $DIR/slice-patterns-reachability.rs:9:9
|
LL | [true, ..] => {}
| ---------- matches all the values already
| ---------- matches all the relevant values
LL | [true, ..] => {}
LL | [true] => {}
| ^^^^^^ unreachable pattern
| ^^^^^^ no value can reach this
error: unreachable pattern
--> $DIR/slice-patterns-reachability.rs:14:9
|
LL | [.., true] => {}
| ---------- matches all the values already
| ---------- matches all the relevant values
LL | [.., true] => {}
| ^^^^^^^^^^ unreachable pattern
| ^^^^^^^^^^ no value can reach this
error: unreachable pattern
--> $DIR/slice-patterns-reachability.rs:15:9
|
LL | [.., true] => {}
| ---------- matches all the values already
| ---------- matches all the relevant values
LL | [.., true] => {}
LL | [true] => {}
| ^^^^^^ unreachable pattern
| ^^^^^^ no value can reach this
error: unreachable pattern
--> $DIR/slice-patterns-reachability.rs:20:9
|
LL | [false, .., true] => {}
| ----------------- matches all the values already
| ----------------- matches all the relevant values
LL | [false, .., true] => {}
| ^^^^^^^^^^^^^^^^^ unreachable pattern
| ^^^^^^^^^^^^^^^^^ no value can reach this
error: unreachable pattern
--> $DIR/slice-patterns-reachability.rs:21:9
|
LL | [false, .., true] => {}
| ----------------- matches all the values already
| ----------------- matches all the relevant values
LL | [false, .., true] => {}
LL | [false, true] => {}
| ^^^^^^^^^^^^^ unreachable pattern
| ^^^^^^^^^^^^^ no value can reach this
error: aborting due to 6 previous errors

View file

@ -4,7 +4,7 @@ error: unreachable pattern
LL | Foo { x: _x, y: _y } => (),
| -------------------- matches any value
LL | Foo { .. } => ()
| ^^^^^^^^^^ unreachable pattern
| ^^^^^^^^^^ no value can reach this
|
note: the lint level is defined here
--> $DIR/struct-pattern-match-useless.rs:1:9

View file

@ -2,9 +2,9 @@ error: unreachable pattern
--> $DIR/top-level-alternation.rs:4:23
|
LL | while let 0..=2 | 1 = 0 {}
| ----- ^ unreachable pattern
| ----- ^ no value can reach this
| |
| matches all the values already
| matches all the relevant values
|
note: the lint level is defined here
--> $DIR/top-level-alternation.rs:1:9
@ -16,66 +16,66 @@ error: unreachable pattern
--> $DIR/top-level-alternation.rs:5:20
|
LL | if let 0..=2 | 1 = 0 {}
| ----- ^ unreachable pattern
| ----- ^ no value can reach this
| |
| matches all the values already
| matches all the relevant values
error: unreachable pattern
--> $DIR/top-level-alternation.rs:9:15
|
LL | 0
| - matches all the values already
| - matches all the relevant values
LL | | 0 => {}
| ^ unreachable pattern
| ^ no value can reach this
error: unreachable pattern
--> $DIR/top-level-alternation.rs:14:15
|
LL | Some(0)
| ------- matches all the values already
| ------- matches all the relevant values
LL | | Some(0) => {}
| ^^^^^^^ unreachable pattern
| ^^^^^^^ no value can reach this
error: unreachable pattern
--> $DIR/top-level-alternation.rs:19:9
|
LL | (0, _) | (_, 0) => {}
| --------------- matches all the values already
| --------------- matches all the relevant values
LL | (0, 0) => {}
| ^^^^^^ unreachable pattern
| ^^^^^^ no value can reach this
error: unreachable pattern
--> $DIR/top-level-alternation.rs:39:9
|
LL | None | Some(_) => {}
| -------------- matches all the values already
| -------------- matches all the relevant values
LL | _ => {}
| ^ unreachable pattern
| ^ no value can reach this
error: unreachable pattern
--> $DIR/top-level-alternation.rs:43:9
|
LL | None | Some(_) => {}
| -------------- matches all the values already
| -------------- matches all the relevant values
LL | Some(_) => {}
| ^^^^^^^ unreachable pattern
| ^^^^^^^ no value can reach this
error: unreachable pattern
--> $DIR/top-level-alternation.rs:44:9
|
LL | None | Some(_) => {}
| -------------- matches all the values already
| -------------- matches all the relevant values
LL | Some(_) => {}
LL | None => {}
| ^^^^ unreachable pattern
| ^^^^ no value can reach this
error: unreachable pattern
--> $DIR/top-level-alternation.rs:49:9
|
LL | None | Some(_) => {}
| ^^^^^^^^^^^^^^ unreachable pattern
| ^^^^^^^^^^^^^^ no value can reach this
|
note: these patterns collectively make the last one unreachable
note: multiple earlier patterns match some of the same values
--> $DIR/top-level-alternation.rs:49:9
|
LL | Some(_) => {}
@ -89,17 +89,17 @@ error: unreachable pattern
--> $DIR/top-level-alternation.rs:53:9
|
LL | 1 | 2 => {},
| ----- matches all the values already
| ----- matches all the relevant values
LL | 1..=2 => {},
| ^^^^^ unreachable pattern
| ^^^^^ no value can reach this
error: unreachable pattern
--> $DIR/top-level-alternation.rs:56:14
|
LL | let (0 | 0) = 0 else { return };
| - ^ unreachable pattern
| - ^ no value can reach this
| |
| matches all the values already
| matches all the relevant values
error: aborting due to 11 previous errors

View file

@ -2,9 +2,9 @@ error: unreachable pattern
--> $DIR/unreachable-arm.rs:11:9
|
LL | Foo::B(_) | Foo::A(box _, 1) => { }
| ---------------------------- matches all the values already
| ---------------------------- matches all the relevant values
LL | Foo::A(_, 1) => { }
| ^^^^^^^^^^^^ unreachable pattern
| ^^^^^^^^^^^^ no value can reach this
|
note: the lint level is defined here
--> $DIR/unreachable-arm.rs:4:9

View file

@ -2,9 +2,9 @@ error: unreachable pattern
--> $DIR/unreachable-loop-patterns.rs:16:9
|
LL | for _ in unimplemented!() as Void {}
| ^
| ^ matches no values because `Void` is uninhabited
|
= note: this pattern 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
|

View file

@ -17,9 +17,9 @@ 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: this pattern 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
|
@ -30,9 +30,9 @@ 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: this pattern 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

View file

@ -2,9 +2,9 @@ error: unreachable pattern
--> $DIR/unreachable.rs:14:9
|
LL | Err(!),
| ^^^^^^
| ^^^^^^ matches no values because `Void` is uninhabited
|
= note: this pattern 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
|
@ -15,41 +15,41 @@ error: unreachable pattern
--> $DIR/unreachable.rs:17:19
|
LL | let (Ok(_x) | Err(!)) = res_void;
| ^^^^^^
| ^^^^^^ matches no values because `Void` is uninhabited
|
= note: this pattern 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: this pattern 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: this pattern 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: this pattern 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: this pattern 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

View file

@ -2,9 +2,9 @@ error: unreachable pattern
--> $DIR/enum_same_crate_empty_match.rs:28:9
|
LL | _ => {}
| ^
| ^ matches no values because `EmptyNonExhaustiveEnum` is uninhabited
|
= note: this pattern 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
|

View file

@ -2,9 +2,9 @@ error: unreachable pattern
--> $DIR/issue-65157-repeated-match-arm.rs:15:9
|
LL | PartiallyInhabitedVariants::Struct { .. } => {},
| ----------------------------------------- matches all the values already
| ----------------------------------------- matches all the relevant values
LL | PartiallyInhabitedVariants::Struct { .. } => {},
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unreachable pattern
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no value can reach this
|
note: the lint level is defined here
--> $DIR/issue-65157-repeated-match-arm.rs:2:9

View file

@ -2,9 +2,9 @@ error: unreachable pattern
--> $DIR/patterns_same_crate.rs:51:9
|
LL | Some(_x) => (),
| ^^^^^^^^
| ^^^^^^^^ matches no values because `UninhabitedEnum` is uninhabited
|
= note: this pattern 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
|
@ -15,33 +15,33 @@ error: unreachable pattern
--> $DIR/patterns_same_crate.rs:56:9
|
LL | Some(_x) => (),
| ^^^^^^^^
| ^^^^^^^^ matches no values because `UninhabitedVariants` is uninhabited
|
= note: this pattern 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: this pattern 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: this pattern 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: this pattern 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

View file

@ -16,9 +16,9 @@ error: unreachable pattern
--> $DIR/warns.rs:15:25
|
LL | x if let None | None = x => {}
| ---- ^^^^ unreachable pattern
| ---- ^^^^ no value can reach this
| |
| matches all the values already
| matches all the relevant values
|
note: the lint level is defined here
--> $DIR/warns.rs:12:8

View file

@ -2,9 +2,9 @@ error: unreachable pattern
--> $DIR/uninhabited-patterns.rs:29:9
|
LL | Ok(box _) => (),
| ^^^^^^^^^
| ^^^^^^^^^ matches no values because `NotSoSecretlyEmpty` is uninhabited
|
= note: this pattern 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
|
@ -15,17 +15,17 @@ error: unreachable pattern
--> $DIR/uninhabited-patterns.rs:38:9
|
LL | Err(Ok(_y)) => (),
| ^^^^^^^^^^^
| ^^^^^^^^^^^ matches no values because `NotSoSecretlyEmpty` is uninhabited
|
= note: this pattern 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: this pattern 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