Point at uncovered variants in enum definition in note instead of a span_label

This makes the order of the output always consistent:

1. Place of the `match` missing arms
2. The `enum` definition span
3. The structured suggestion to add a fallthrough arm
This commit is contained in:
Esteban Kuber 2021-12-16 05:06:44 +00:00
parent 084ca79e7c
commit ab4feea50d
45 changed files with 1018 additions and 681 deletions

View File

@ -20,7 +20,7 @@ use rustc_session::lint::builtin::{
}; };
use rustc_session::Session; use rustc_session::Session;
use rustc_span::source_map::Spanned; use rustc_span::source_map::Spanned;
use rustc_span::{DesugaringKind, ExpnKind, Span}; use rustc_span::{DesugaringKind, ExpnKind, MultiSpan, Span};
crate fn check_match(tcx: TyCtxt<'_>, def_id: DefId) { crate fn check_match(tcx: TyCtxt<'_>, def_id: DefId) {
let body_id = match def_id.as_local() { let body_id = match def_id.as_local() {
@ -669,15 +669,27 @@ fn adt_defined_here<'p, 'tcx>(
) { ) {
let ty = ty.peel_refs(); let ty = ty.peel_refs();
if let ty::Adt(def, _) = ty.kind() { if let ty::Adt(def, _) = ty.kind() {
if let Some(sp) = cx.tcx.hir().span_if_local(def.did) { let mut spans = vec![];
err.span_label(sp, format!("`{}` defined here", ty)); if witnesses.len() < 5 {
}
if witnesses.len() < 4 {
for sp in maybe_point_at_variant(cx, def, witnesses.iter()) { for sp in maybe_point_at_variant(cx, def, witnesses.iter()) {
err.span_label(sp, "not covered"); spans.push(sp);
} }
} }
let def_span = cx
.tcx
.hir()
.get_if_local(def.did)
.and_then(|node| node.ident())
.map(|ident| ident.span)
.unwrap_or_else(|| cx.tcx.def_span(def.did));
let mut span: MultiSpan =
if spans.is_empty() { def_span.into() } else { spans.clone().into() };
span.push_span_label(def_span, String::new());
for pat in spans {
span.push_span_label(pat, "not covered".to_string());
}
err.span_note(span, &format!("`{}` defined here", ty));
} }
} }

View File

@ -1,12 +1,14 @@
error[E0004]: non-exhaustive patterns: `Opcode(0_u8)` and `Opcode(2_u8..=u8::MAX)` not covered error[E0004]: non-exhaustive patterns: `Opcode(0_u8)` and `Opcode(2_u8..=u8::MAX)` not covered
--> $DIR/issue-88331.rs:11:20 --> $DIR/issue-88331.rs:11:20
| |
LL | pub struct Opcode(pub u8);
| -------------------------- `Opcode` defined here
...
LL | move |i| match msg_type { LL | move |i| match msg_type {
| ^^^^^^^^ patterns `Opcode(0_u8)` and `Opcode(2_u8..=u8::MAX)` not covered | ^^^^^^^^ patterns `Opcode(0_u8)` and `Opcode(2_u8..=u8::MAX)` not covered
| |
note: `Opcode` defined here
--> $DIR/issue-88331.rs:4:12
|
LL | pub struct Opcode(pub u8);
| ^^^^^^
= note: the matched value is of type `Opcode` = note: the matched value is of type `Opcode`
help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
| |
@ -17,12 +19,14 @@ LL ~ Opcode(0_u8) | Opcode(2_u8..=u8::MAX) => todo!(),
error[E0004]: non-exhaustive patterns: `Opcode2(Opcode(0_u8))` and `Opcode2(Opcode(2_u8..=u8::MAX))` not covered error[E0004]: non-exhaustive patterns: `Opcode2(Opcode(0_u8))` and `Opcode2(Opcode(2_u8..=u8::MAX))` not covered
--> $DIR/issue-88331.rs:27:20 --> $DIR/issue-88331.rs:27:20
| |
LL | pub struct Opcode2(Opcode);
| --------------------------- `Opcode2` defined here
...
LL | move |i| match msg_type { LL | move |i| match msg_type {
| ^^^^^^^^ patterns `Opcode2(Opcode(0_u8))` and `Opcode2(Opcode(2_u8..=u8::MAX))` not covered | ^^^^^^^^ patterns `Opcode2(Opcode(0_u8))` and `Opcode2(Opcode(2_u8..=u8::MAX))` not covered
| |
note: `Opcode2` defined here
--> $DIR/issue-88331.rs:18:12
|
LL | pub struct Opcode2(Opcode);
| ^^^^^^^
= note: the matched value is of type `Opcode2` = note: the matched value is of type `Opcode2`
help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
| |

View File

@ -1,15 +1,14 @@
error[E0004]: non-exhaustive patterns: `B` not covered error[E0004]: non-exhaustive patterns: `B` not covered
--> $DIR/non-exhaustive-match.rs:26:25 --> $DIR/non-exhaustive-match.rs:26:25
| |
LL | enum L1 { A, B }
| ----------------
| | |
| | not covered
| `L1` defined here
...
LL | let _b = || { match l1 { L1::A => () } }; LL | let _b = || { match l1 { L1::A => () } };
| ^^ pattern `B` not covered | ^^ pattern `B` not covered
| |
note: `L1` defined here
--> $DIR/non-exhaustive-match.rs:12:14
|
LL | enum L1 { A, B }
| -- ^ not covered
= note: the matched value is of type `L1` = note: the matched value is of type `L1`
help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
| |
@ -22,6 +21,11 @@ error[E0004]: non-exhaustive patterns: type `E1` is non-empty
LL | let _d = || { match e1 {} }; LL | let _d = || { match e1 {} };
| ^^ | ^^
| |
note: `E1` defined here
--> $DIR/auxiliary/match_non_exhaustive_lib.rs:2:1
|
LL | pub enum E1 {}
| ^^^^^^^^^^^^^^
= note: the matched value is of type `E1`, which is marked as non-exhaustive = note: the matched value is of type `E1`, which is marked as non-exhaustive
help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
| |
@ -36,6 +40,11 @@ error[E0004]: non-exhaustive patterns: `_` not covered
LL | let _e = || { match e2 { E2::A => (), E2::B => () } }; LL | let _e = || { match e2 { E2::A => (), E2::B => () } };
| ^^ pattern `_` not covered | ^^ pattern `_` not covered
| |
note: `E2` defined here
--> $DIR/auxiliary/match_non_exhaustive_lib.rs:5:1
|
LL | pub enum E2 { A, B }
| ^^^^^^^^^^^^^^^^^^^^
= note: the matched value is of type `E2`, which is marked as non-exhaustive = note: the matched value is of type `E2`, which is marked as non-exhaustive
help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
| |

View File

@ -1,19 +1,18 @@
error[E0005]: refutable pattern in local binding: `T(_, _)` not covered error[E0005]: refutable pattern in local binding: `T(_, _)` not covered
--> $DIR/empty-never-array.rs:10:9 --> $DIR/empty-never-array.rs:10:9
| |
LL | / enum Helper<T, U> { LL | let Helper::U(u) = Helper::T(t, []);
LL | | T(T, [!; 0]), | ^^^^^^^^^^^^ pattern `T(_, _)` not covered
| | - not covered
LL | | #[allow(dead_code)]
LL | | U(U),
LL | | }
| |_- `Helper<T, U>` defined here
...
LL | let Helper::U(u) = Helper::T(t, []);
| ^^^^^^^^^^^^ pattern `T(_, _)` not covered
| |
= note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant = note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant
= note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html = note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html
note: `Helper<T, U>` defined here
--> $DIR/empty-never-array.rs:4:5
|
LL | enum Helper<T, U> {
| ------
LL | T(T, [!; 0]),
| ^ not covered
= note: the matched value is of type `Helper<T, U>` = note: the matched value is of type `Helper<T, U>`
help: you might want to use `if let` to ignore the variant that isn't matched help: you might want to use `if let` to ignore the variant that isn't matched
| |

View File

@ -4,14 +4,20 @@ error[E0004]: non-exhaustive patterns: `None` and `Some(_)` not covered
LL | match x { } LL | match x { }
| ^ patterns `None` and `Some(_)` not covered | ^ patterns `None` and `Some(_)` not covered
| |
::: $SRC_DIR/core/src/option.rs:LL:COL note: `Option<i32>` defined here
| --> $SRC_DIR/core/src/option.rs:LL:COL
LL | None,
| ---- not covered
...
LL | Some(#[stable(feature = "rust1", since = "1.0.0")] T),
| ---- not covered
| |
LL | / pub enum Option<T> {
LL | | /// No value.
LL | | #[lang = "None"]
LL | | #[stable(feature = "rust1", since = "1.0.0")]
LL | | None,
| | ^^^^ not covered
... |
LL | | Some(#[stable(feature = "rust1", since = "1.0.0")] T),
| | ^^^^ not covered
LL | | }
| |_-
= note: the matched value is of type `Option<i32>` = note: the matched value is of type `Option<i32>`
help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
| |

View File

@ -1,16 +1,16 @@
error[E0004]: non-exhaustive patterns: `HastaLaVistaBaby` not covered error[E0004]: non-exhaustive patterns: `HastaLaVistaBaby` not covered
--> $DIR/E0004.rs:9:11 --> $DIR/E0004.rs:9:11
| |
LL | / enum Terminator { LL | match x {
LL | | HastaLaVistaBaby, | ^ pattern `HastaLaVistaBaby` not covered
| | ---------------- not covered
LL | | TalkToMyHand,
LL | | }
| |_- `Terminator` defined here
...
LL | match x {
| ^ pattern `HastaLaVistaBaby` not covered
| |
note: `Terminator` defined here
--> $DIR/E0004.rs:2:5
|
LL | enum Terminator {
| ----------
LL | HastaLaVistaBaby,
| ^^^^^^^^^^^^^^^^ not covered
= note: the matched value is of type `Terminator` = note: the matched value is of type `Terminator`
help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
| |

View File

@ -4,13 +4,21 @@ error[E0005]: refutable pattern in local binding: `None` not covered
LL | let Some(y) = x; LL | let Some(y) = x;
| ^^^^^^^ pattern `None` not covered | ^^^^^^^ pattern `None` not covered
| |
::: $SRC_DIR/core/src/option.rs:LL:COL
|
LL | None,
| ---- not covered
|
= note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant = note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant
= note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html = note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html
note: `Option<i32>` defined here
--> $SRC_DIR/core/src/option.rs:LL:COL
|
LL | / pub enum Option<T> {
LL | | /// No value.
LL | | #[lang = "None"]
LL | | #[stable(feature = "rust1", since = "1.0.0")]
LL | | None,
| | ^^^^ not covered
... |
LL | | Some(#[stable(feature = "rust1", since = "1.0.0")] T),
LL | | }
| |_-
= note: the matched value is of type `Option<i32>` = note: the matched value is of type `Option<i32>`
help: you might want to use `if let` to ignore the variant that isn't matched help: you might want to use `if let` to ignore the variant that isn't matched
| |

View File

@ -4,11 +4,19 @@ error[E0005]: refutable pattern in `for` loop binding: `None` not covered
LL | for Some(x) in xs {} LL | for Some(x) in xs {}
| ^^^^^^^ pattern `None` not covered | ^^^^^^^ pattern `None` not covered
| |
::: $SRC_DIR/core/src/option.rs:LL:COL note: `Option<i32>` defined here
| --> $SRC_DIR/core/src/option.rs:LL:COL
LL | None,
| ---- not covered
| |
LL | / pub enum Option<T> {
LL | | /// No value.
LL | | #[lang = "None"]
LL | | #[stable(feature = "rust1", since = "1.0.0")]
LL | | None,
| | ^^^^ not covered
... |
LL | | Some(#[stable(feature = "rust1", since = "1.0.0")] T),
LL | | }
| |_-
= note: the matched value is of type `Option<i32>` = note: the matched value is of type `Option<i32>`
error: aborting due to previous error error: aborting due to previous error

View File

@ -4,13 +4,20 @@ error[E0005]: refutable pattern in local binding: `Err(_)` not covered
LL | let Ok(_x) = foo(); LL | let Ok(_x) = foo();
| ^^^^^^ pattern `Err(_)` not covered | ^^^^^^ pattern `Err(_)` not covered
| |
::: $SRC_DIR/core/src/result.rs:LL:COL
|
LL | Err(#[stable(feature = "rust1", since = "1.0.0")] E),
| --- not covered
|
= note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant = note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant
= note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html = note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html
note: `Result<u32, !>` defined here
--> $SRC_DIR/core/src/result.rs:LL:COL
|
LL | / pub enum Result<T, E> {
LL | | /// Contains the success value
LL | | #[lang = "Ok"]
LL | | #[stable(feature = "rust1", since = "1.0.0")]
... |
LL | | Err(#[stable(feature = "rust1", since = "1.0.0")] E),
| | ^^^ not covered
LL | | }
| |_-
= note: the matched value is of type `Result<u32, !>` = note: the matched value is of type `Result<u32, !>`
help: you might want to use `if let` to ignore the variant that isn't matched help: you might want to use `if let` to ignore the variant that isn't matched
| |

View File

@ -1,15 +1,14 @@
error[E0004]: non-exhaustive patterns: `B` not covered error[E0004]: non-exhaustive patterns: `B` not covered
--> $DIR/match_non_exhaustive.rs:23:11 --> $DIR/match_non_exhaustive.rs:23:11
| |
LL | enum L { A, B }
| ---------------
| | |
| | not covered
| `L` defined here
...
LL | match l { L::A => () }; LL | match l { L::A => () };
| ^ pattern `B` not covered | ^ pattern `B` not covered
| |
note: `L` defined here
--> $DIR/match_non_exhaustive.rs:10:13
|
LL | enum L { A, B }
| - ^ not covered
= note: the matched value is of type `L` = note: the matched value is of type `L`
help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
| |
@ -22,6 +21,11 @@ error[E0004]: non-exhaustive patterns: type `E1` is non-empty
LL | match e1 {}; LL | match e1 {};
| ^^ | ^^
| |
note: `E1` defined here
--> $DIR/auxiliary/match_non_exhaustive_lib.rs:2:1
|
LL | pub enum E1 {}
| ^^^^^^^^^^^^^^
= note: the matched value is of type `E1`, which is marked as non-exhaustive = note: the matched value is of type `E1`, which is marked as non-exhaustive
help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
| |
@ -36,6 +40,11 @@ error[E0004]: non-exhaustive patterns: `_` not covered
LL | match e2 { E2::A => (), E2::B => () }; LL | match e2 { E2::A => (), E2::B => () };
| ^^ pattern `_` not covered | ^^ pattern `_` not covered
| |
note: `E2` defined here
--> $DIR/auxiliary/match_non_exhaustive_lib.rs:5:1
|
LL | pub enum E2 { A, B }
| ^^^^^^^^^^^^^^^^^^^^
= note: the matched value is of type `E2`, which is marked as non-exhaustive = note: the matched value is of type `E2`, which is marked as non-exhaustive
help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
| |

View File

@ -16,14 +16,14 @@ LL + }
error[E0004]: non-exhaustive patterns: type `Foo` is non-empty error[E0004]: non-exhaustive patterns: type `Foo` is non-empty
--> $DIR/always-inhabited-union-ref.rs:27:11 --> $DIR/always-inhabited-union-ref.rs:27:11
| |
LL | / pub union Foo { LL | match uninhab_union() {
LL | | foo: !, | ^^^^^^^^^^^^^^^
LL | | }
| |_- `Foo` defined here
...
LL | match uninhab_union() {
| ^^^^^^^^^^^^^^^
| |
note: `Foo` defined here
--> $DIR/always-inhabited-union-ref.rs:10:11
|
LL | pub union Foo {
| ^^^
= note: the matched value is of type `Foo` = note: the matched value is of type `Foo`
help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
| |

View File

@ -4,6 +4,16 @@ error[E0004]: non-exhaustive patterns: `_` not covered
LL | match Foo::A { LL | match Foo::A {
| ^^^^^^ pattern `_` not covered | ^^^^^^ pattern `_` not covered
| |
note: `Foo` defined here
--> $DIR/auxiliary/hidden.rs:1:1
|
LL | / pub enum Foo {
LL | | A,
LL | | B,
LL | | #[doc(hidden)]
LL | | C,
LL | | }
| |_^
= note: the matched value is of type `Foo` = note: the matched value is of type `Foo`
help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
| |
@ -17,11 +27,17 @@ error[E0004]: non-exhaustive patterns: `B` not covered
LL | match Foo::A { LL | match Foo::A {
| ^^^^^^ pattern `B` not covered | ^^^^^^ pattern `B` not covered
| |
::: $DIR/auxiliary/hidden.rs:3:5 note: `Foo` defined here
| --> $DIR/auxiliary/hidden.rs:3:5
LL | B,
| - not covered
| |
LL | / pub enum Foo {
LL | | A,
LL | | B,
| | ^ not covered
LL | | #[doc(hidden)]
LL | | C,
LL | | }
| |_-
= note: the matched value is of type `Foo` = note: the matched value is of type `Foo`
help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
| |
@ -35,11 +51,17 @@ error[E0004]: non-exhaustive patterns: `B` and `_` not covered
LL | match Foo::A { LL | match Foo::A {
| ^^^^^^ patterns `B` and `_` not covered | ^^^^^^ patterns `B` and `_` not covered
| |
::: $DIR/auxiliary/hidden.rs:3:5 note: `Foo` defined here
| --> $DIR/auxiliary/hidden.rs:3:5
LL | B,
| - not covered
| |
LL | / pub enum Foo {
LL | | A,
LL | | B,
| | ^ not covered
LL | | #[doc(hidden)]
LL | | C,
LL | | }
| |_-
= note: the matched value is of type `Foo` = note: the matched value is of type `Foo`
help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
| |
@ -53,11 +75,18 @@ error[E0004]: non-exhaustive patterns: `Some(B)` and `Some(_)` not covered
LL | match None { LL | match None {
| ^^^^ patterns `Some(B)` and `Some(_)` not covered | ^^^^ patterns `Some(B)` and `Some(_)` not covered
| |
::: $SRC_DIR/core/src/option.rs:LL:COL note: `Option<Foo>` defined here
| --> $SRC_DIR/core/src/option.rs:LL:COL
LL | Some(#[stable(feature = "rust1", since = "1.0.0")] T),
| ---- not covered
| |
LL | / pub enum Option<T> {
LL | | /// No value.
LL | | #[lang = "None"]
LL | | #[stable(feature = "rust1", since = "1.0.0")]
... |
LL | | Some(#[stable(feature = "rust1", since = "1.0.0")] T),
| | ^^^^ not covered
LL | | }
| |_-
= note: the matched value is of type `Option<Foo>` = note: the matched value is of type `Option<Foo>`
help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
| |

View File

@ -52,99 +52,104 @@ LL | match_no_arms!(0u8);
error[E0004]: non-exhaustive patterns: type `NonEmptyStruct1` is non-empty error[E0004]: non-exhaustive patterns: type `NonEmptyStruct1` is non-empty
--> $DIR/empty-match.rs:79:20 --> $DIR/empty-match.rs:79:20
| |
LL | struct NonEmptyStruct1;
| ----------------------- `NonEmptyStruct1` defined here
...
LL | match_no_arms!(NonEmptyStruct1); LL | match_no_arms!(NonEmptyStruct1);
| ^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^
| |
note: `NonEmptyStruct1` defined here
--> $DIR/empty-match.rs:14:8
|
LL | struct NonEmptyStruct1;
| ^^^^^^^^^^^^^^^
= note: the matched value is of type `NonEmptyStruct1` = note: the matched value is of type `NonEmptyStruct1`
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
error[E0004]: non-exhaustive patterns: type `NonEmptyStruct2` is non-empty error[E0004]: non-exhaustive patterns: type `NonEmptyStruct2` is non-empty
--> $DIR/empty-match.rs:80:20 --> $DIR/empty-match.rs:80:20
| |
LL | struct NonEmptyStruct2(bool);
| ----------------------------- `NonEmptyStruct2` defined here
...
LL | match_no_arms!(NonEmptyStruct2(true)); LL | match_no_arms!(NonEmptyStruct2(true));
| ^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^
| |
note: `NonEmptyStruct2` defined here
--> $DIR/empty-match.rs:15:8
|
LL | struct NonEmptyStruct2(bool);
| ^^^^^^^^^^^^^^^
= note: the matched value is of type `NonEmptyStruct2` = note: the matched value is of type `NonEmptyStruct2`
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
error[E0004]: non-exhaustive patterns: type `NonEmptyUnion1` is non-empty error[E0004]: non-exhaustive patterns: type `NonEmptyUnion1` is non-empty
--> $DIR/empty-match.rs:81:20 --> $DIR/empty-match.rs:81:20
| |
LL | / union NonEmptyUnion1 { LL | match_no_arms!((NonEmptyUnion1 { foo: () }));
LL | | foo: (), | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
LL | | }
| |_- `NonEmptyUnion1` defined here
...
LL | match_no_arms!((NonEmptyUnion1 { foo: () }));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| |
note: `NonEmptyUnion1` defined here
--> $DIR/empty-match.rs:16:7
|
LL | union NonEmptyUnion1 {
| ^^^^^^^^^^^^^^
= note: the matched value is of type `NonEmptyUnion1` = note: the matched value is of type `NonEmptyUnion1`
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
error[E0004]: non-exhaustive patterns: type `NonEmptyUnion2` is non-empty error[E0004]: non-exhaustive patterns: type `NonEmptyUnion2` is non-empty
--> $DIR/empty-match.rs:82:20 --> $DIR/empty-match.rs:82:20
| |
LL | / union NonEmptyUnion2 { LL | match_no_arms!((NonEmptyUnion2 { foo: () }));
LL | | foo: (), | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
LL | | bar: (),
LL | | }
| |_- `NonEmptyUnion2` defined here
...
LL | match_no_arms!((NonEmptyUnion2 { foo: () }));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| |
note: `NonEmptyUnion2` defined here
--> $DIR/empty-match.rs:19:7
|
LL | union NonEmptyUnion2 {
| ^^^^^^^^^^^^^^
= note: the matched value is of type `NonEmptyUnion2` = note: the matched value is of type `NonEmptyUnion2`
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
error[E0004]: non-exhaustive patterns: `Foo(_)` not covered error[E0004]: non-exhaustive patterns: `Foo(_)` not covered
--> $DIR/empty-match.rs:83:20 --> $DIR/empty-match.rs:83:20
| |
LL | / enum NonEmptyEnum1 { LL | match_no_arms!(NonEmptyEnum1::Foo(true));
LL | | Foo(bool), | ^^^^^^^^^^^^^^^^^^^^^^^^ pattern `Foo(_)` not covered
| | --- not covered
LL | | }
| |_- `NonEmptyEnum1` defined here
...
LL | match_no_arms!(NonEmptyEnum1::Foo(true));
| ^^^^^^^^^^^^^^^^^^^^^^^^ pattern `Foo(_)` not covered
| |
note: `NonEmptyEnum1` defined here
--> $DIR/empty-match.rs:24:5
|
LL | enum NonEmptyEnum1 {
| -------------
LL | Foo(bool),
| ^^^ not covered
= note: the matched value is of type `NonEmptyEnum1` = note: the matched value is of type `NonEmptyEnum1`
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
error[E0004]: non-exhaustive patterns: `Foo(_)` and `Bar` not covered error[E0004]: non-exhaustive patterns: `Foo(_)` and `Bar` not covered
--> $DIR/empty-match.rs:84:20 --> $DIR/empty-match.rs:84:20
| |
LL | / enum NonEmptyEnum2 { LL | match_no_arms!(NonEmptyEnum2::Foo(true));
LL | | Foo(bool), | ^^^^^^^^^^^^^^^^^^^^^^^^ patterns `Foo(_)` and `Bar` not covered
| | --- not covered
LL | | Bar,
| | --- not covered
LL | | }
| |_- `NonEmptyEnum2` defined here
...
LL | match_no_arms!(NonEmptyEnum2::Foo(true));
| ^^^^^^^^^^^^^^^^^^^^^^^^ patterns `Foo(_)` and `Bar` not covered
| |
note: `NonEmptyEnum2` defined here
--> $DIR/empty-match.rs:27:5
|
LL | enum NonEmptyEnum2 {
| -------------
LL | Foo(bool),
| ^^^ not covered
LL | Bar,
| ^^^ not covered
= note: the matched value is of type `NonEmptyEnum2` = note: the matched value is of type `NonEmptyEnum2`
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
error[E0004]: non-exhaustive patterns: `V1`, `V2`, `V3` and 2 more not covered error[E0004]: non-exhaustive patterns: `V1`, `V2`, `V3` and 2 more not covered
--> $DIR/empty-match.rs:85:20 --> $DIR/empty-match.rs:85:20
| |
LL | / enum NonEmptyEnum5 { LL | match_no_arms!(NonEmptyEnum5::V1);
LL | | V1, V2, V3, V4, V5, | ^^^^^^^^^^^^^^^^^ patterns `V1`, `V2`, `V3` and 2 more not covered
LL | | }
| |_- `NonEmptyEnum5` defined here
...
LL | match_no_arms!(NonEmptyEnum5::V1);
| ^^^^^^^^^^^^^^^^^ patterns `V1`, `V2`, `V3` and 2 more not covered
| |
note: `NonEmptyEnum5` defined here
--> $DIR/empty-match.rs:30:6
|
LL | enum NonEmptyEnum5 {
| ^^^^^^^^^^^^^
= note: the matched value is of type `NonEmptyEnum5` = note: the matched value is of type `NonEmptyEnum5`
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
@ -164,12 +169,14 @@ LL + _ => todo!()
error[E0004]: non-exhaustive patterns: `NonEmptyStruct1` not covered error[E0004]: non-exhaustive patterns: `NonEmptyStruct1` not covered
--> $DIR/empty-match.rs:88:24 --> $DIR/empty-match.rs:88:24
| |
LL | struct NonEmptyStruct1;
| ----------------------- `NonEmptyStruct1` defined here
...
LL | match_guarded_arm!(NonEmptyStruct1); LL | match_guarded_arm!(NonEmptyStruct1);
| ^^^^^^^^^^^^^^^ pattern `NonEmptyStruct1` not covered | ^^^^^^^^^^^^^^^ pattern `NonEmptyStruct1` not covered
| |
note: `NonEmptyStruct1` defined here
--> $DIR/empty-match.rs:14:8
|
LL | struct NonEmptyStruct1;
| ^^^^^^^^^^^^^^^
= note: the matched value is of type `NonEmptyStruct1` = note: the matched value is of type `NonEmptyStruct1`
help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
| |
@ -180,12 +187,14 @@ LL + NonEmptyStruct1 => todo!()
error[E0004]: non-exhaustive patterns: `NonEmptyStruct2(_)` not covered error[E0004]: non-exhaustive patterns: `NonEmptyStruct2(_)` not covered
--> $DIR/empty-match.rs:89:24 --> $DIR/empty-match.rs:89:24
| |
LL | struct NonEmptyStruct2(bool);
| ----------------------------- `NonEmptyStruct2` defined here
...
LL | match_guarded_arm!(NonEmptyStruct2(true)); LL | match_guarded_arm!(NonEmptyStruct2(true));
| ^^^^^^^^^^^^^^^^^^^^^ pattern `NonEmptyStruct2(_)` not covered | ^^^^^^^^^^^^^^^^^^^^^ pattern `NonEmptyStruct2(_)` not covered
| |
note: `NonEmptyStruct2` defined here
--> $DIR/empty-match.rs:15:8
|
LL | struct NonEmptyStruct2(bool);
| ^^^^^^^^^^^^^^^
= note: the matched value is of type `NonEmptyStruct2` = note: the matched value is of type `NonEmptyStruct2`
help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
| |
@ -196,14 +205,14 @@ LL + NonEmptyStruct2(_) => todo!()
error[E0004]: non-exhaustive patterns: `NonEmptyUnion1 { .. }` not covered error[E0004]: non-exhaustive patterns: `NonEmptyUnion1 { .. }` not covered
--> $DIR/empty-match.rs:90:24 --> $DIR/empty-match.rs:90:24
| |
LL | / union NonEmptyUnion1 { LL | match_guarded_arm!((NonEmptyUnion1 { foo: () }));
LL | | foo: (), | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ pattern `NonEmptyUnion1 { .. }` not covered
LL | | }
| |_- `NonEmptyUnion1` defined here
...
LL | match_guarded_arm!((NonEmptyUnion1 { foo: () }));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ pattern `NonEmptyUnion1 { .. }` not covered
| |
note: `NonEmptyUnion1` defined here
--> $DIR/empty-match.rs:16:7
|
LL | union NonEmptyUnion1 {
| ^^^^^^^^^^^^^^
= note: the matched value is of type `NonEmptyUnion1` = note: the matched value is of type `NonEmptyUnion1`
help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
| |
@ -214,15 +223,14 @@ LL + NonEmptyUnion1 { .. } => todo!()
error[E0004]: non-exhaustive patterns: `NonEmptyUnion2 { .. }` not covered error[E0004]: non-exhaustive patterns: `NonEmptyUnion2 { .. }` not covered
--> $DIR/empty-match.rs:91:24 --> $DIR/empty-match.rs:91:24
| |
LL | / union NonEmptyUnion2 { LL | match_guarded_arm!((NonEmptyUnion2 { foo: () }));
LL | | foo: (), | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ pattern `NonEmptyUnion2 { .. }` not covered
LL | | bar: (),
LL | | }
| |_- `NonEmptyUnion2` defined here
...
LL | match_guarded_arm!((NonEmptyUnion2 { foo: () }));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ pattern `NonEmptyUnion2 { .. }` not covered
| |
note: `NonEmptyUnion2` defined here
--> $DIR/empty-match.rs:19:7
|
LL | union NonEmptyUnion2 {
| ^^^^^^^^^^^^^^
= note: the matched value is of type `NonEmptyUnion2` = note: the matched value is of type `NonEmptyUnion2`
help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
| |
@ -233,15 +241,16 @@ LL + NonEmptyUnion2 { .. } => todo!()
error[E0004]: non-exhaustive patterns: `Foo(_)` not covered error[E0004]: non-exhaustive patterns: `Foo(_)` not covered
--> $DIR/empty-match.rs:92:24 --> $DIR/empty-match.rs:92:24
| |
LL | / enum NonEmptyEnum1 { LL | match_guarded_arm!(NonEmptyEnum1::Foo(true));
LL | | Foo(bool), | ^^^^^^^^^^^^^^^^^^^^^^^^ pattern `Foo(_)` not covered
| | --- not covered
LL | | }
| |_- `NonEmptyEnum1` defined here
...
LL | match_guarded_arm!(NonEmptyEnum1::Foo(true));
| ^^^^^^^^^^^^^^^^^^^^^^^^ pattern `Foo(_)` not covered
| |
note: `NonEmptyEnum1` defined here
--> $DIR/empty-match.rs:24:5
|
LL | enum NonEmptyEnum1 {
| -------------
LL | Foo(bool),
| ^^^ not covered
= note: the matched value is of type `NonEmptyEnum1` = note: the matched value is of type `NonEmptyEnum1`
help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
| |
@ -252,17 +261,18 @@ LL + Foo(_) => todo!()
error[E0004]: non-exhaustive patterns: `Foo(_)` and `Bar` not covered error[E0004]: non-exhaustive patterns: `Foo(_)` and `Bar` not covered
--> $DIR/empty-match.rs:93:24 --> $DIR/empty-match.rs:93:24
| |
LL | / enum NonEmptyEnum2 { LL | match_guarded_arm!(NonEmptyEnum2::Foo(true));
LL | | Foo(bool), | ^^^^^^^^^^^^^^^^^^^^^^^^ patterns `Foo(_)` and `Bar` not covered
| | --- not covered
LL | | Bar,
| | --- not covered
LL | | }
| |_- `NonEmptyEnum2` defined here
...
LL | match_guarded_arm!(NonEmptyEnum2::Foo(true));
| ^^^^^^^^^^^^^^^^^^^^^^^^ patterns `Foo(_)` and `Bar` not covered
| |
note: `NonEmptyEnum2` defined here
--> $DIR/empty-match.rs:27:5
|
LL | enum NonEmptyEnum2 {
| -------------
LL | Foo(bool),
| ^^^ not covered
LL | Bar,
| ^^^ not covered
= note: the matched value is of type `NonEmptyEnum2` = note: the matched value is of type `NonEmptyEnum2`
help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
| |
@ -273,14 +283,14 @@ LL + Foo(_) | Bar => todo!()
error[E0004]: non-exhaustive patterns: `V1`, `V2`, `V3` and 2 more not covered error[E0004]: non-exhaustive patterns: `V1`, `V2`, `V3` and 2 more not covered
--> $DIR/empty-match.rs:94:24 --> $DIR/empty-match.rs:94:24
| |
LL | / enum NonEmptyEnum5 { LL | match_guarded_arm!(NonEmptyEnum5::V1);
LL | | V1, V2, V3, V4, V5, | ^^^^^^^^^^^^^^^^^ patterns `V1`, `V2`, `V3` and 2 more not covered
LL | | }
| |_- `NonEmptyEnum5` defined here
...
LL | match_guarded_arm!(NonEmptyEnum5::V1);
| ^^^^^^^^^^^^^^^^^ patterns `V1`, `V2`, `V3` and 2 more not covered
| |
note: `NonEmptyEnum5` defined here
--> $DIR/empty-match.rs:30:6
|
LL | enum NonEmptyEnum5 {
| ^^^^^^^^^^^^^
= note: the matched value is of type `NonEmptyEnum5` = note: the matched value is of type `NonEmptyEnum5`
help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
| |

View File

@ -52,99 +52,104 @@ LL | match_no_arms!(0u8);
error[E0004]: non-exhaustive patterns: type `NonEmptyStruct1` is non-empty error[E0004]: non-exhaustive patterns: type `NonEmptyStruct1` is non-empty
--> $DIR/empty-match.rs:79:20 --> $DIR/empty-match.rs:79:20
| |
LL | struct NonEmptyStruct1;
| ----------------------- `NonEmptyStruct1` defined here
...
LL | match_no_arms!(NonEmptyStruct1); LL | match_no_arms!(NonEmptyStruct1);
| ^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^
| |
note: `NonEmptyStruct1` defined here
--> $DIR/empty-match.rs:14:8
|
LL | struct NonEmptyStruct1;
| ^^^^^^^^^^^^^^^
= note: the matched value is of type `NonEmptyStruct1` = note: the matched value is of type `NonEmptyStruct1`
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
error[E0004]: non-exhaustive patterns: type `NonEmptyStruct2` is non-empty error[E0004]: non-exhaustive patterns: type `NonEmptyStruct2` is non-empty
--> $DIR/empty-match.rs:80:20 --> $DIR/empty-match.rs:80:20
| |
LL | struct NonEmptyStruct2(bool);
| ----------------------------- `NonEmptyStruct2` defined here
...
LL | match_no_arms!(NonEmptyStruct2(true)); LL | match_no_arms!(NonEmptyStruct2(true));
| ^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^
| |
note: `NonEmptyStruct2` defined here
--> $DIR/empty-match.rs:15:8
|
LL | struct NonEmptyStruct2(bool);
| ^^^^^^^^^^^^^^^
= note: the matched value is of type `NonEmptyStruct2` = note: the matched value is of type `NonEmptyStruct2`
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
error[E0004]: non-exhaustive patterns: type `NonEmptyUnion1` is non-empty error[E0004]: non-exhaustive patterns: type `NonEmptyUnion1` is non-empty
--> $DIR/empty-match.rs:81:20 --> $DIR/empty-match.rs:81:20
| |
LL | / union NonEmptyUnion1 { LL | match_no_arms!((NonEmptyUnion1 { foo: () }));
LL | | foo: (), | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
LL | | }
| |_- `NonEmptyUnion1` defined here
...
LL | match_no_arms!((NonEmptyUnion1 { foo: () }));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| |
note: `NonEmptyUnion1` defined here
--> $DIR/empty-match.rs:16:7
|
LL | union NonEmptyUnion1 {
| ^^^^^^^^^^^^^^
= note: the matched value is of type `NonEmptyUnion1` = note: the matched value is of type `NonEmptyUnion1`
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
error[E0004]: non-exhaustive patterns: type `NonEmptyUnion2` is non-empty error[E0004]: non-exhaustive patterns: type `NonEmptyUnion2` is non-empty
--> $DIR/empty-match.rs:82:20 --> $DIR/empty-match.rs:82:20
| |
LL | / union NonEmptyUnion2 { LL | match_no_arms!((NonEmptyUnion2 { foo: () }));
LL | | foo: (), | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
LL | | bar: (),
LL | | }
| |_- `NonEmptyUnion2` defined here
...
LL | match_no_arms!((NonEmptyUnion2 { foo: () }));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| |
note: `NonEmptyUnion2` defined here
--> $DIR/empty-match.rs:19:7
|
LL | union NonEmptyUnion2 {
| ^^^^^^^^^^^^^^
= note: the matched value is of type `NonEmptyUnion2` = note: the matched value is of type `NonEmptyUnion2`
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
error[E0004]: non-exhaustive patterns: `Foo(_)` not covered error[E0004]: non-exhaustive patterns: `Foo(_)` not covered
--> $DIR/empty-match.rs:83:20 --> $DIR/empty-match.rs:83:20
| |
LL | / enum NonEmptyEnum1 { LL | match_no_arms!(NonEmptyEnum1::Foo(true));
LL | | Foo(bool), | ^^^^^^^^^^^^^^^^^^^^^^^^ pattern `Foo(_)` not covered
| | --- not covered
LL | | }
| |_- `NonEmptyEnum1` defined here
...
LL | match_no_arms!(NonEmptyEnum1::Foo(true));
| ^^^^^^^^^^^^^^^^^^^^^^^^ pattern `Foo(_)` not covered
| |
note: `NonEmptyEnum1` defined here
--> $DIR/empty-match.rs:24:5
|
LL | enum NonEmptyEnum1 {
| -------------
LL | Foo(bool),
| ^^^ not covered
= note: the matched value is of type `NonEmptyEnum1` = note: the matched value is of type `NonEmptyEnum1`
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
error[E0004]: non-exhaustive patterns: `Foo(_)` and `Bar` not covered error[E0004]: non-exhaustive patterns: `Foo(_)` and `Bar` not covered
--> $DIR/empty-match.rs:84:20 --> $DIR/empty-match.rs:84:20
| |
LL | / enum NonEmptyEnum2 { LL | match_no_arms!(NonEmptyEnum2::Foo(true));
LL | | Foo(bool), | ^^^^^^^^^^^^^^^^^^^^^^^^ patterns `Foo(_)` and `Bar` not covered
| | --- not covered
LL | | Bar,
| | --- not covered
LL | | }
| |_- `NonEmptyEnum2` defined here
...
LL | match_no_arms!(NonEmptyEnum2::Foo(true));
| ^^^^^^^^^^^^^^^^^^^^^^^^ patterns `Foo(_)` and `Bar` not covered
| |
note: `NonEmptyEnum2` defined here
--> $DIR/empty-match.rs:27:5
|
LL | enum NonEmptyEnum2 {
| -------------
LL | Foo(bool),
| ^^^ not covered
LL | Bar,
| ^^^ not covered
= note: the matched value is of type `NonEmptyEnum2` = note: the matched value is of type `NonEmptyEnum2`
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
error[E0004]: non-exhaustive patterns: `V1`, `V2`, `V3` and 2 more not covered error[E0004]: non-exhaustive patterns: `V1`, `V2`, `V3` and 2 more not covered
--> $DIR/empty-match.rs:85:20 --> $DIR/empty-match.rs:85:20
| |
LL | / enum NonEmptyEnum5 { LL | match_no_arms!(NonEmptyEnum5::V1);
LL | | V1, V2, V3, V4, V5, | ^^^^^^^^^^^^^^^^^ patterns `V1`, `V2`, `V3` and 2 more not covered
LL | | }
| |_- `NonEmptyEnum5` defined here
...
LL | match_no_arms!(NonEmptyEnum5::V1);
| ^^^^^^^^^^^^^^^^^ patterns `V1`, `V2`, `V3` and 2 more not covered
| |
note: `NonEmptyEnum5` defined here
--> $DIR/empty-match.rs:30:6
|
LL | enum NonEmptyEnum5 {
| ^^^^^^^^^^^^^
= note: the matched value is of type `NonEmptyEnum5` = note: the matched value is of type `NonEmptyEnum5`
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
@ -164,12 +169,14 @@ LL + _ => todo!()
error[E0004]: non-exhaustive patterns: `NonEmptyStruct1` not covered error[E0004]: non-exhaustive patterns: `NonEmptyStruct1` not covered
--> $DIR/empty-match.rs:88:24 --> $DIR/empty-match.rs:88:24
| |
LL | struct NonEmptyStruct1;
| ----------------------- `NonEmptyStruct1` defined here
...
LL | match_guarded_arm!(NonEmptyStruct1); LL | match_guarded_arm!(NonEmptyStruct1);
| ^^^^^^^^^^^^^^^ pattern `NonEmptyStruct1` not covered | ^^^^^^^^^^^^^^^ pattern `NonEmptyStruct1` not covered
| |
note: `NonEmptyStruct1` defined here
--> $DIR/empty-match.rs:14:8
|
LL | struct NonEmptyStruct1;
| ^^^^^^^^^^^^^^^
= note: the matched value is of type `NonEmptyStruct1` = note: the matched value is of type `NonEmptyStruct1`
help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
| |
@ -180,12 +187,14 @@ LL + NonEmptyStruct1 => todo!()
error[E0004]: non-exhaustive patterns: `NonEmptyStruct2(_)` not covered error[E0004]: non-exhaustive patterns: `NonEmptyStruct2(_)` not covered
--> $DIR/empty-match.rs:89:24 --> $DIR/empty-match.rs:89:24
| |
LL | struct NonEmptyStruct2(bool);
| ----------------------------- `NonEmptyStruct2` defined here
...
LL | match_guarded_arm!(NonEmptyStruct2(true)); LL | match_guarded_arm!(NonEmptyStruct2(true));
| ^^^^^^^^^^^^^^^^^^^^^ pattern `NonEmptyStruct2(_)` not covered | ^^^^^^^^^^^^^^^^^^^^^ pattern `NonEmptyStruct2(_)` not covered
| |
note: `NonEmptyStruct2` defined here
--> $DIR/empty-match.rs:15:8
|
LL | struct NonEmptyStruct2(bool);
| ^^^^^^^^^^^^^^^
= note: the matched value is of type `NonEmptyStruct2` = note: the matched value is of type `NonEmptyStruct2`
help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
| |
@ -196,14 +205,14 @@ LL + NonEmptyStruct2(_) => todo!()
error[E0004]: non-exhaustive patterns: `NonEmptyUnion1 { .. }` not covered error[E0004]: non-exhaustive patterns: `NonEmptyUnion1 { .. }` not covered
--> $DIR/empty-match.rs:90:24 --> $DIR/empty-match.rs:90:24
| |
LL | / union NonEmptyUnion1 { LL | match_guarded_arm!((NonEmptyUnion1 { foo: () }));
LL | | foo: (), | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ pattern `NonEmptyUnion1 { .. }` not covered
LL | | }
| |_- `NonEmptyUnion1` defined here
...
LL | match_guarded_arm!((NonEmptyUnion1 { foo: () }));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ pattern `NonEmptyUnion1 { .. }` not covered
| |
note: `NonEmptyUnion1` defined here
--> $DIR/empty-match.rs:16:7
|
LL | union NonEmptyUnion1 {
| ^^^^^^^^^^^^^^
= note: the matched value is of type `NonEmptyUnion1` = note: the matched value is of type `NonEmptyUnion1`
help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
| |
@ -214,15 +223,14 @@ LL + NonEmptyUnion1 { .. } => todo!()
error[E0004]: non-exhaustive patterns: `NonEmptyUnion2 { .. }` not covered error[E0004]: non-exhaustive patterns: `NonEmptyUnion2 { .. }` not covered
--> $DIR/empty-match.rs:91:24 --> $DIR/empty-match.rs:91:24
| |
LL | / union NonEmptyUnion2 { LL | match_guarded_arm!((NonEmptyUnion2 { foo: () }));
LL | | foo: (), | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ pattern `NonEmptyUnion2 { .. }` not covered
LL | | bar: (),
LL | | }
| |_- `NonEmptyUnion2` defined here
...
LL | match_guarded_arm!((NonEmptyUnion2 { foo: () }));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ pattern `NonEmptyUnion2 { .. }` not covered
| |
note: `NonEmptyUnion2` defined here
--> $DIR/empty-match.rs:19:7
|
LL | union NonEmptyUnion2 {
| ^^^^^^^^^^^^^^
= note: the matched value is of type `NonEmptyUnion2` = note: the matched value is of type `NonEmptyUnion2`
help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
| |
@ -233,15 +241,16 @@ LL + NonEmptyUnion2 { .. } => todo!()
error[E0004]: non-exhaustive patterns: `Foo(_)` not covered error[E0004]: non-exhaustive patterns: `Foo(_)` not covered
--> $DIR/empty-match.rs:92:24 --> $DIR/empty-match.rs:92:24
| |
LL | / enum NonEmptyEnum1 { LL | match_guarded_arm!(NonEmptyEnum1::Foo(true));
LL | | Foo(bool), | ^^^^^^^^^^^^^^^^^^^^^^^^ pattern `Foo(_)` not covered
| | --- not covered
LL | | }
| |_- `NonEmptyEnum1` defined here
...
LL | match_guarded_arm!(NonEmptyEnum1::Foo(true));
| ^^^^^^^^^^^^^^^^^^^^^^^^ pattern `Foo(_)` not covered
| |
note: `NonEmptyEnum1` defined here
--> $DIR/empty-match.rs:24:5
|
LL | enum NonEmptyEnum1 {
| -------------
LL | Foo(bool),
| ^^^ not covered
= note: the matched value is of type `NonEmptyEnum1` = note: the matched value is of type `NonEmptyEnum1`
help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
| |
@ -252,17 +261,18 @@ LL + Foo(_) => todo!()
error[E0004]: non-exhaustive patterns: `Foo(_)` and `Bar` not covered error[E0004]: non-exhaustive patterns: `Foo(_)` and `Bar` not covered
--> $DIR/empty-match.rs:93:24 --> $DIR/empty-match.rs:93:24
| |
LL | / enum NonEmptyEnum2 { LL | match_guarded_arm!(NonEmptyEnum2::Foo(true));
LL | | Foo(bool), | ^^^^^^^^^^^^^^^^^^^^^^^^ patterns `Foo(_)` and `Bar` not covered
| | --- not covered
LL | | Bar,
| | --- not covered
LL | | }
| |_- `NonEmptyEnum2` defined here
...
LL | match_guarded_arm!(NonEmptyEnum2::Foo(true));
| ^^^^^^^^^^^^^^^^^^^^^^^^ patterns `Foo(_)` and `Bar` not covered
| |
note: `NonEmptyEnum2` defined here
--> $DIR/empty-match.rs:27:5
|
LL | enum NonEmptyEnum2 {
| -------------
LL | Foo(bool),
| ^^^ not covered
LL | Bar,
| ^^^ not covered
= note: the matched value is of type `NonEmptyEnum2` = note: the matched value is of type `NonEmptyEnum2`
help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
| |
@ -273,14 +283,14 @@ LL + Foo(_) | Bar => todo!()
error[E0004]: non-exhaustive patterns: `V1`, `V2`, `V3` and 2 more not covered error[E0004]: non-exhaustive patterns: `V1`, `V2`, `V3` and 2 more not covered
--> $DIR/empty-match.rs:94:24 --> $DIR/empty-match.rs:94:24
| |
LL | / enum NonEmptyEnum5 { LL | match_guarded_arm!(NonEmptyEnum5::V1);
LL | | V1, V2, V3, V4, V5, | ^^^^^^^^^^^^^^^^^ patterns `V1`, `V2`, `V3` and 2 more not covered
LL | | }
| |_- `NonEmptyEnum5` defined here
...
LL | match_guarded_arm!(NonEmptyEnum5::V1);
| ^^^^^^^^^^^^^^^^^ patterns `V1`, `V2`, `V3` and 2 more not covered
| |
note: `NonEmptyEnum5` defined here
--> $DIR/empty-match.rs:30:6
|
LL | enum NonEmptyEnum5 {
| ^^^^^^^^^^^^^
= note: the matched value is of type `NonEmptyEnum5` = note: the matched value is of type `NonEmptyEnum5`
help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
| |

View File

@ -1,20 +1,21 @@
error[E0005]: refutable pattern in local binding: `Bar` and `Baz` not covered error[E0005]: refutable pattern in local binding: `Bar` and `Baz` not covered
--> $DIR/issue-31561.rs:8:9 --> $DIR/issue-31561.rs:8:9
| |
LL | / enum Thing { LL | let Thing::Foo(y) = Thing::Foo(1);
LL | | Foo(u8), | ^^^^^^^^^^^^^ patterns `Bar` and `Baz` not covered
LL | | Bar,
| | --- not covered
LL | | Baz
| | --- not covered
LL | | }
| |_- `Thing` defined here
...
LL | let Thing::Foo(y) = Thing::Foo(1);
| ^^^^^^^^^^^^^ patterns `Bar` and `Baz` not covered
| |
= note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant = note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant
= note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html = note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html
note: `Thing` defined here
--> $DIR/issue-31561.rs:3:5
|
LL | enum Thing {
| -----
LL | Foo(u8),
LL | Bar,
| ^^^ not covered
LL | Baz
| ^^^ not covered
= note: the matched value is of type `Thing` = note: the matched value is of type `Thing`
help: you might want to use `if let` to ignore the variant that isn't matched help: you might want to use `if let` to ignore the variant that isn't matched
| |

View File

@ -66,12 +66,14 @@ LL + _ => todo!()
error[E0004]: non-exhaustive patterns: `S(B, _)`, `S(C, _)`, `S(D, _)` and 2 more not covered error[E0004]: non-exhaustive patterns: `S(B, _)`, `S(C, _)`, `S(D, _)` and 2 more not covered
--> $DIR/issue-35609.rs:31:11 --> $DIR/issue-35609.rs:31:11
| |
LL | struct S(Enum, ());
| ------------------- `S` defined here
...
LL | match S(A, ()) { LL | match S(A, ()) {
| ^^^^^^^^ patterns `S(B, _)`, `S(C, _)`, `S(D, _)` and 2 more not covered | ^^^^^^^^ patterns `S(B, _)`, `S(C, _)`, `S(D, _)` and 2 more not covered
| |
note: `S` defined here
--> $DIR/issue-35609.rs:6:8
|
LL | struct S(Enum, ());
| ^
= note: the matched value is of type `S` = note: the matched value is of type `S`
help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
| |
@ -82,12 +84,14 @@ LL + _ => todo!()
error[E0004]: non-exhaustive patterns: `Sd { x: B, .. }`, `Sd { x: C, .. }`, `Sd { x: D, .. }` and 2 more not covered error[E0004]: non-exhaustive patterns: `Sd { x: B, .. }`, `Sd { x: C, .. }`, `Sd { x: D, .. }` and 2 more not covered
--> $DIR/issue-35609.rs:35:11 --> $DIR/issue-35609.rs:35:11
| |
LL | struct Sd { x: Enum, y: () }
| ---------------------------- `Sd` defined here
...
LL | match (Sd { x: A, y: () }) { LL | match (Sd { x: A, y: () }) {
| ^^^^^^^^^^^^^^^^^^^^ patterns `Sd { x: B, .. }`, `Sd { x: C, .. }`, `Sd { x: D, .. }` and 2 more not covered | ^^^^^^^^^^^^^^^^^^^^ patterns `Sd { x: B, .. }`, `Sd { x: C, .. }`, `Sd { x: D, .. }` and 2 more not covered
| |
note: `Sd` defined here
--> $DIR/issue-35609.rs:7:8
|
LL | struct Sd { x: Enum, y: () }
| ^^
= note: the matched value is of type `Sd` = note: the matched value is of type `Sd`
help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
| |
@ -101,6 +105,17 @@ error[E0004]: non-exhaustive patterns: `Some(B)`, `Some(C)`, `Some(D)` and 2 mor
LL | match Some(A) { LL | match Some(A) {
| ^^^^^^^ patterns `Some(B)`, `Some(C)`, `Some(D)` and 2 more not covered | ^^^^^^^ patterns `Some(B)`, `Some(C)`, `Some(D)` and 2 more not covered
| |
note: `Option<Enum>` defined here
--> $SRC_DIR/core/src/option.rs:LL:COL
|
LL | / pub enum Option<T> {
LL | | /// No value.
LL | | #[lang = "None"]
LL | | #[stable(feature = "rust1", since = "1.0.0")]
... |
LL | | Some(#[stable(feature = "rust1", since = "1.0.0")] T),
LL | | }
| |_^
= note: the matched value is of type `Option<Enum>` = note: the matched value is of type `Option<Enum>`
help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
| |

View File

@ -4,6 +4,14 @@ error[E0004]: non-exhaustive patterns: `box _` not covered
LL | box NodeKind::Element(ed) => match ed.kind { LL | box NodeKind::Element(ed) => match ed.kind {
| ^^^^^^^ pattern `box _` not covered | ^^^^^^^ pattern `box _` not covered
| |
note: `Box<ElementKind>` defined here
--> $SRC_DIR/alloc/src/boxed.rs:LL:COL
|
LL | / pub struct Box<
LL | | T: ?Sized,
LL | | #[unstable(feature = "allocator_api", issue = "32838")] A: Allocator = Global,
LL | | >(Unique<T>, A);
| |________________^
= note: the matched value is of type `Box<ElementKind>` = note: the matched value is of type `Box<ElementKind>`
help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
| |

View File

@ -1,14 +1,16 @@
error[E0004]: non-exhaustive patterns: `Bar { bar: C, .. }`, `Bar { bar: D, .. }`, `Bar { bar: E, .. }` and 1 more not covered error[E0004]: non-exhaustive patterns: `Bar { bar: C, .. }`, `Bar { bar: D, .. }`, `Bar { bar: E, .. }` and 1 more not covered
--> $DIR/issue-39362.rs:10:11 --> $DIR/issue-39362.rs:10:11
| |
LL | / enum Foo { LL | match f {
LL | | Bar { bar: Bar, id: usize } | ^ patterns `Bar { bar: C, .. }`, `Bar { bar: D, .. }`, `Bar { bar: E, .. }` and 1 more not covered
LL | | }
| |_- `Foo` defined here
...
LL | match f {
| ^ patterns `Bar { bar: C, .. }`, `Bar { bar: D, .. }`, `Bar { bar: E, .. }` and 1 more not covered
| |
note: `Foo` defined here
--> $DIR/issue-39362.rs:2:5
|
LL | enum Foo {
| ---
LL | Bar { bar: Bar, id: usize }
| ^^^ not covered
= note: the matched value is of type `Foo` = note: the matched value is of type `Foo`
help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
| |

View File

@ -1,15 +1,16 @@
error[E0004]: non-exhaustive patterns: `C(QA)` not covered error[E0004]: non-exhaustive patterns: `C(QA)` not covered
--> $DIR/issue-40221.rs:11:11 --> $DIR/issue-40221.rs:11:11
| |
LL | / enum P { LL | match proto {
LL | | C(PC), | ^^^^^ pattern `C(QA)` not covered
| | - not covered
LL | | }
| |_- `P` defined here
...
LL | match proto {
| ^^^^^ pattern `C(QA)` not covered
| |
note: `P` defined here
--> $DIR/issue-40221.rs:2:5
|
LL | enum P {
| -
LL | C(PC),
| ^ not covered
= note: the matched value is of type `P` = note: the matched value is of type `P`
help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
| |

View File

@ -1,12 +1,14 @@
error[E0004]: non-exhaustive patterns: `Tag(Exif, _)` not covered error[E0004]: non-exhaustive patterns: `Tag(Exif, _)` not covered
--> $DIR/issue-50900.rs:15:11 --> $DIR/issue-50900.rs:15:11
| |
LL | pub struct Tag(pub Context, pub u16);
| ------------------------------------- `Tag` defined here
...
LL | match Tag::ExifIFDPointer { LL | match Tag::ExifIFDPointer {
| ^^^^^^^^^^^^^^^^^^^ pattern `Tag(Exif, _)` not covered | ^^^^^^^^^^^^^^^^^^^ pattern `Tag(Exif, _)` not covered
| |
note: `Tag` defined here
--> $DIR/issue-50900.rs:2:12
|
LL | pub struct Tag(pub Context, pub u16);
| ^^^
= note: the matched value is of type `Tag` = note: the matched value is of type `Tag`
help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
| |

View File

@ -1,19 +1,20 @@
error[E0004]: non-exhaustive patterns: `A(false)`, `B(false)` and `C(false)` not covered error[E0004]: non-exhaustive patterns: `A(false)`, `B(false)` and `C(false)` not covered
--> $DIR/issue-56379.rs:8:11 --> $DIR/issue-56379.rs:8:11
| |
LL | / enum Foo { LL | match Foo::A(true) {
LL | | A(bool), | ^^^^^^^^^^^^ patterns `A(false)`, `B(false)` and `C(false)` not covered
| | - not covered
LL | | B(bool),
| | - not covered
LL | | C(bool),
| | - not covered
LL | | }
| |_- `Foo` defined here
...
LL | match Foo::A(true) {
| ^^^^^^^^^^^^ patterns `A(false)`, `B(false)` and `C(false)` not covered
| |
note: `Foo` defined here
--> $DIR/issue-56379.rs:2:5
|
LL | enum Foo {
| ---
LL | A(bool),
| ^ not covered
LL | B(bool),
| ^ not covered
LL | C(bool),
| ^ not covered
= note: the matched value is of type `Foo` = note: the matched value is of type `Foo`
help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
| |

View File

@ -1,5 +1,6 @@
enum A {} enum A {}
//~^ NOTE `A` defined here //~^ NOTE `A` defined here
//~| NOTE
fn f(a: &A) { fn f(a: &A) {
match a {} match a {}

View File

@ -1,12 +1,14 @@
error[E0004]: non-exhaustive patterns: type `&A` is non-empty error[E0004]: non-exhaustive patterns: type `&A` is non-empty
--> $DIR/issue-78123-non-exhaustive-reference.rs:5:11 --> $DIR/issue-78123-non-exhaustive-reference.rs:6:11
| |
LL | enum A {}
| --------- `A` defined here
...
LL | match a {} LL | match a {}
| ^ | ^
| |
note: `A` defined here
--> $DIR/issue-78123-non-exhaustive-reference.rs:1:6
|
LL | enum A {}
| ^
= note: the matched value is of type `&A` = note: the matched value is of type `&A`
= note: references are always considered inhabited = note: references are always considered inhabited
help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms

View File

@ -17,14 +17,21 @@ error[E0004]: non-exhaustive patterns: `Some(Some(West))` not covered
LL | match Some(Some(North)) { LL | match Some(Some(North)) {
| ^^^^^^^^^^^^^^^^^ pattern `Some(Some(West))` not covered | ^^^^^^^^^^^^^^^^^ pattern `Some(Some(West))` not covered
| |
::: $SRC_DIR/core/src/option.rs:LL:COL note: `Option<Option<Direction>>` defined here
| --> $SRC_DIR/core/src/option.rs:LL:COL
LL | Some(#[stable(feature = "rust1", since = "1.0.0")] T),
| ----
| |
| not covered
| not covered
| |
LL | / pub enum Option<T> {
LL | | /// No value.
LL | | #[lang = "None"]
LL | | #[stable(feature = "rust1", since = "1.0.0")]
... |
LL | | Some(#[stable(feature = "rust1", since = "1.0.0")] T),
| | ^^^^
| | |
| | not covered
| | not covered
LL | | }
| |_-
= note: the matched value is of type `Option<Option<Direction>>` = note: the matched value is of type `Option<Option<Direction>>`
help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
| |
@ -35,15 +42,14 @@ LL + Some(Some(West)) => todo!()
error[E0004]: non-exhaustive patterns: `Foo { bar: Some(North), baz: NewBool(true) }` not covered error[E0004]: non-exhaustive patterns: `Foo { bar: Some(North), baz: NewBool(true) }` not covered
--> $DIR/match-arm-statics-2.rs:48:11 --> $DIR/match-arm-statics-2.rs:48:11
| |
LL | / struct Foo { LL | match (Foo { bar: Some(North), baz: NewBool(true) }) {
LL | | bar: Option<Direction>, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ pattern `Foo { bar: Some(North), baz: NewBool(true) }` not covered
LL | | baz: NewBool
LL | | }
| |_- `Foo` defined here
...
LL | match (Foo { bar: Some(North), baz: NewBool(true) }) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ pattern `Foo { bar: Some(North), baz: NewBool(true) }` not covered
| |
note: `Foo` defined here
--> $DIR/match-arm-statics-2.rs:40:8
|
LL | struct Foo {
| ^^^
= note: the matched value is of type `Foo` = note: the matched value is of type `Foo`
help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
| |

View File

@ -4,11 +4,18 @@ error[E0004]: non-exhaustive patterns: `Some(Private { misc: true, .. })` not co
LL | match private::DATA { LL | match private::DATA {
| ^^^^^^^^^^^^^ pattern `Some(Private { misc: true, .. })` not covered | ^^^^^^^^^^^^^ pattern `Some(Private { misc: true, .. })` not covered
| |
::: $SRC_DIR/core/src/option.rs:LL:COL note: `Option<Private>` defined here
| --> $SRC_DIR/core/src/option.rs:LL:COL
LL | Some(#[stable(feature = "rust1", since = "1.0.0")] T),
| ---- not covered
| |
LL | / pub enum Option<T> {
LL | | /// No value.
LL | | #[lang = "None"]
LL | | #[stable(feature = "rust1", since = "1.0.0")]
... |
LL | | Some(#[stable(feature = "rust1", since = "1.0.0")] T),
| | ^^^^ not covered
LL | | }
| |_-
= note: the matched value is of type `Option<Private>` = note: the matched value is of type `Option<Private>`
help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
| |

View File

@ -4,20 +4,26 @@
#[derive(Clone)] #[derive(Clone)]
enum E { enum E {
//~^ `E` defined here //~^ NOTE
//~| `E` defined here //~| NOTE
//~| `E` defined here //~| NOTE
//~| `E` defined here //~| NOTE
//~| `E` defined here //~| NOTE
//~| `E` defined here //~| NOTE
A, A,
B, B,
//~^ not covered //~^ NOTE `E` defined here
//~| not covered //~| NOTE `E` defined here
//~| not covered //~| NOTE `E` defined here
//~| not covered //~| NOTE `E` defined here
//~| not covered //~| NOTE `E` defined here
//~| not covered //~| NOTE `E` defined here
//~| NOTE not covered
//~| NOTE not covered
//~| NOTE not covered
//~| NOTE not covered
//~| NOTE not covered
//~| NOTE not covered
C C
//~^ not covered //~^ not covered
//~| not covered //~| not covered
@ -30,43 +36,70 @@ enum E {
fn by_val(e: E) { fn by_val(e: E) {
let e1 = e.clone(); let e1 = e.clone();
match e1 { //~ ERROR non-exhaustive patterns: `B` and `C` not covered match e1 { //~ ERROR non-exhaustive patterns: `B` and `C` not covered
//~^ NOTE patterns `B` and `C` not covered
//~| NOTE the matched value is of type `E`
E::A => {} E::A => {}
} }
let E::A = e; //~ ERROR refutable pattern in local binding: `B` and `C` not covered let E::A = e; //~ ERROR refutable pattern in local binding: `B` and `C` not covered
//~^ NOTE patterns `B` and `C` not covered
//~| NOTE `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with
//~| NOTE for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html
//~| NOTE the matched value is of type `E`
} }
fn by_ref_once(e: &E) { fn by_ref_once(e: &E) {
match e { //~ ERROR non-exhaustive patterns: `&B` and `&C` not covered match e { //~ ERROR non-exhaustive patterns: `&B` and `&C` not covered
//~^ NOTE patterns `&B` and `&C` not covered
//~| NOTE the matched value is of type `&E`
E::A => {} E::A => {}
} }
let E::A = e; //~ ERROR refutable pattern in local binding: `&B` and `&C` not covered let E::A = e; //~ ERROR refutable pattern in local binding: `&B` and `&C` not covered
//~^ NOTE patterns `&B` and `&C` not covered
//~| NOTE `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with
//~| NOTE for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html
//~| NOTE the matched value is of type `&E`
} }
fn by_ref_thrice(e: & &mut &E) { fn by_ref_thrice(e: & &mut &E) {
match e { //~ ERROR non-exhaustive patterns: `&&mut &B` and `&&mut &C` not covered match e { //~ ERROR non-exhaustive patterns: `&&mut &B` and `&&mut &C` not covered
//~^ NOTE patterns `&&mut &B` and `&&mut &C` not covered
//~| NOTE the matched value is of type `&&mut &E`
E::A => {} E::A => {}
} }
let E::A = e; let E::A = e;
//~^ ERROR refutable pattern in local binding: `&&mut &B` and `&&mut &C` not covered //~^ ERROR refutable pattern in local binding: `&&mut &B` and `&&mut &C` not covered
//~| NOTE patterns `&&mut &B` and `&&mut &C` not covered
//~| NOTE `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with
//~| NOTE for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html
//~| NOTE the matched value is of type `&&mut &E`
} }
enum Opt { enum Opt {
//~^ `Opt` defined here //~^ NOTE
//~| `Opt` defined here //~| NOTE
Some(u8), Some(u8),
None, None,
//~^ not covered //~^ NOTE `Opt` defined here
//~| NOTE `Opt` defined here
//~| NOTE not covered
//~| NOTE not covered
} }
fn ref_pat(e: Opt) { fn ref_pat(e: Opt) {
match e {//~ ERROR non-exhaustive patterns: `None` not covered match e {//~ ERROR non-exhaustive patterns: `None` not covered
//~^ NOTE pattern `None` not covered
//~| NOTE the matched value is of type `Opt`
Opt::Some(ref _x) => {} Opt::Some(ref _x) => {}
} }
let Opt::Some(ref _x) = e; //~ ERROR refutable pattern in local binding: `None` not covered let Opt::Some(ref _x) = e; //~ ERROR refutable pattern in local binding: `None` not covered
//~^ NOTE the matched value is of type `Opt`
//~| NOTE pattern `None` not covered
//~| NOTE `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with
//~| NOTE for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html
} }
fn main() {} fn main() {}

View File

@ -1,24 +1,20 @@
error[E0004]: non-exhaustive patterns: `B` and `C` not covered error[E0004]: non-exhaustive patterns: `B` and `C` not covered
--> $DIR/non-exhaustive-defined-here.rs:32:11 --> $DIR/non-exhaustive-defined-here.rs:38:11
| |
LL | / enum E { LL | match e1 {
LL | | | ^^ patterns `B` and `C` not covered
LL | | |
LL | | note: `E` defined here
... | --> $DIR/non-exhaustive-defined-here.rs:14:5
LL | | B, |
| | - not covered LL | enum E {
... | | -
LL | | C
| | - not covered
... |
LL | |
LL | | }
| |_- `E` defined here
... ...
LL | match e1 { LL | B,
| ^^ patterns `B` and `C` not covered | ^ not covered
| ...
LL | C
| ^ not covered
= note: the matched value is of type `E` = note: the matched value is of type `E`
help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
| |
@ -27,28 +23,24 @@ LL + B | C => todo!()
| |
error[E0005]: refutable pattern in local binding: `B` and `C` not covered error[E0005]: refutable pattern in local binding: `B` and `C` not covered
--> $DIR/non-exhaustive-defined-here.rs:36:9 --> $DIR/non-exhaustive-defined-here.rs:44:9
| |
LL | / enum E { LL | let E::A = e;
LL | | | ^^^^ patterns `B` and `C` not covered
LL | |
LL | |
... |
LL | | B,
| | - not covered
... |
LL | | C
| | - not covered
... |
LL | |
LL | | }
| |_- `E` defined here
...
LL | let E::A = e;
| ^^^^ patterns `B` and `C` not covered
| |
= note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant = note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant
= note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html = note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html
note: `E` defined here
--> $DIR/non-exhaustive-defined-here.rs:14:5
|
LL | enum E {
| -
...
LL | B,
| ^ not covered
...
LL | C
| ^ not covered
= note: the matched value is of type `E` = note: the matched value is of type `E`
help: you might want to use `if let` to ignore the variant that isn't matched help: you might want to use `if let` to ignore the variant that isn't matched
| |
@ -56,26 +48,22 @@ LL | if let E::A = e { /* */ }
| ~~~~~~~~~~~~~~~~~~~~~~~~~ | ~~~~~~~~~~~~~~~~~~~~~~~~~
error[E0004]: non-exhaustive patterns: `&B` and `&C` not covered error[E0004]: non-exhaustive patterns: `&B` and `&C` not covered
--> $DIR/non-exhaustive-defined-here.rs:40:11 --> $DIR/non-exhaustive-defined-here.rs:52:11
| |
LL | / enum E { LL | match e {
LL | | | ^ patterns `&B` and `&C` not covered
LL | | |
LL | | note: `E` defined here
... | --> $DIR/non-exhaustive-defined-here.rs:14:5
LL | | B, |
| | - not covered LL | enum E {
... | | -
LL | | C
| | - not covered
... |
LL | |
LL | | }
| |_- `E` defined here
... ...
LL | match e { LL | B,
| ^ patterns `&B` and `&C` not covered | ^ not covered
| ...
LL | C
| ^ not covered
= note: the matched value is of type `&E` = note: the matched value is of type `&E`
help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
| |
@ -84,28 +72,24 @@ LL + &B | &C => todo!()
| |
error[E0005]: refutable pattern in local binding: `&B` and `&C` not covered error[E0005]: refutable pattern in local binding: `&B` and `&C` not covered
--> $DIR/non-exhaustive-defined-here.rs:44:9 --> $DIR/non-exhaustive-defined-here.rs:58:9
| |
LL | / enum E { LL | let E::A = e;
LL | | | ^^^^ patterns `&B` and `&C` not covered
LL | |
LL | |
... |
LL | | B,
| | - not covered
... |
LL | | C
| | - not covered
... |
LL | |
LL | | }
| |_- `E` defined here
...
LL | let E::A = e;
| ^^^^ patterns `&B` and `&C` not covered
| |
= note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant = note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant
= note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html = note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html
note: `E` defined here
--> $DIR/non-exhaustive-defined-here.rs:14:5
|
LL | enum E {
| -
...
LL | B,
| ^ not covered
...
LL | C
| ^ not covered
= note: the matched value is of type `&E` = note: the matched value is of type `&E`
help: you might want to use `if let` to ignore the variant that isn't matched help: you might want to use `if let` to ignore the variant that isn't matched
| |
@ -113,26 +97,22 @@ LL | if let E::A = e { /* */ }
| ~~~~~~~~~~~~~~~~~~~~~~~~~ | ~~~~~~~~~~~~~~~~~~~~~~~~~
error[E0004]: non-exhaustive patterns: `&&mut &B` and `&&mut &C` not covered error[E0004]: non-exhaustive patterns: `&&mut &B` and `&&mut &C` not covered
--> $DIR/non-exhaustive-defined-here.rs:48:11 --> $DIR/non-exhaustive-defined-here.rs:66:11
| |
LL | / enum E { LL | match e {
LL | | | ^ patterns `&&mut &B` and `&&mut &C` not covered
LL | | |
LL | | note: `E` defined here
... | --> $DIR/non-exhaustive-defined-here.rs:14:5
LL | | B, |
| | - not covered LL | enum E {
... | | -
LL | | C
| | - not covered
... |
LL | |
LL | | }
| |_- `E` defined here
... ...
LL | match e { LL | B,
| ^ patterns `&&mut &B` and `&&mut &C` not covered | ^ not covered
| ...
LL | C
| ^ not covered
= note: the matched value is of type `&&mut &E` = note: the matched value is of type `&&mut &E`
help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
| |
@ -141,28 +121,24 @@ LL + &&mut &B | &&mut &C => todo!()
| |
error[E0005]: refutable pattern in local binding: `&&mut &B` and `&&mut &C` not covered error[E0005]: refutable pattern in local binding: `&&mut &B` and `&&mut &C` not covered
--> $DIR/non-exhaustive-defined-here.rs:52:9 --> $DIR/non-exhaustive-defined-here.rs:72:9
| |
LL | / enum E { LL | let E::A = e;
LL | | | ^^^^ patterns `&&mut &B` and `&&mut &C` not covered
LL | |
LL | |
... |
LL | | B,
| | - not covered
... |
LL | | C
| | - not covered
... |
LL | |
LL | | }
| |_- `E` defined here
...
LL | let E::A = e;
| ^^^^ patterns `&&mut &B` and `&&mut &C` not covered
| |
= note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant = note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant
= note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html = note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html
note: `E` defined here
--> $DIR/non-exhaustive-defined-here.rs:14:5
|
LL | enum E {
| -
...
LL | B,
| ^ not covered
...
LL | C
| ^ not covered
= note: the matched value is of type `&&mut &E` = note: the matched value is of type `&&mut &E`
help: you might want to use `if let` to ignore the variant that isn't matched help: you might want to use `if let` to ignore the variant that isn't matched
| |
@ -170,21 +146,19 @@ LL | if let E::A = e { /* */ }
| |
error[E0004]: non-exhaustive patterns: `None` not covered error[E0004]: non-exhaustive patterns: `None` not covered
--> $DIR/non-exhaustive-defined-here.rs:65:11 --> $DIR/non-exhaustive-defined-here.rs:92:11
| |
LL | / enum Opt { LL | match e {
LL | | | ^ pattern `None` not covered
LL | | |
LL | | Some(u8), note: `Opt` defined here
LL | | None, --> $DIR/non-exhaustive-defined-here.rs:84:5
| | ---- not covered |
LL | | LL | enum Opt {
LL | | } | ---
| |_- `Opt` defined here
... ...
LL | match e { LL | None,
| ^ pattern `None` not covered | ^^^^ not covered
|
= note: the matched value is of type `Opt` = note: the matched value is of type `Opt`
help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
| |
@ -193,23 +167,21 @@ LL + None => todo!()
| |
error[E0005]: refutable pattern in local binding: `None` not covered error[E0005]: refutable pattern in local binding: `None` not covered
--> $DIR/non-exhaustive-defined-here.rs:69:9 --> $DIR/non-exhaustive-defined-here.rs:98:9
| |
LL | / enum Opt { LL | let Opt::Some(ref _x) = e;
LL | | | ^^^^^^^^^^^^^^^^^ pattern `None` not covered
LL | |
LL | | Some(u8),
LL | | None,
| | ---- not covered
LL | |
LL | | }
| |_- `Opt` defined here
...
LL | let Opt::Some(ref _x) = e;
| ^^^^^^^^^^^^^^^^^ pattern `None` not covered
| |
= note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant = note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant
= note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html = note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html
note: `Opt` defined here
--> $DIR/non-exhaustive-defined-here.rs:84:5
|
LL | enum Opt {
| ---
...
LL | None,
| ^^^^ not covered
= note: the matched value is of type `Opt` = note: the matched value is of type `Opt`
help: you might want to use `if let` to ignore the variant that isn't matched help: you might want to use `if let` to ignore the variant that isn't matched
| |

View File

@ -14,15 +14,14 @@ LL + (Some(&[]), Err(_)) => todo!()
error[E0004]: non-exhaustive patterns: `A(C)` not covered error[E0004]: non-exhaustive patterns: `A(C)` not covered
--> $DIR/non-exhaustive-match-nested.rs:15:11 --> $DIR/non-exhaustive-match-nested.rs:15:11
| |
LL | enum T { A(U), B }
| ------------------
| | |
| | not covered
| `T` defined here
...
LL | match x { LL | match x {
| ^ pattern `A(C)` not covered | ^ pattern `A(C)` not covered
| |
note: `T` defined here
--> $DIR/non-exhaustive-match-nested.rs:1:10
|
LL | enum T { A(U), B }
| - ^ not covered
= note: the matched value is of type `T` = note: the matched value is of type `T`
help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
| |

View File

@ -1,15 +1,14 @@
error[E0004]: non-exhaustive patterns: `A` not covered error[E0004]: non-exhaustive patterns: `A` not covered
--> $DIR/non-exhaustive-match.rs:7:11 --> $DIR/non-exhaustive-match.rs:7:11
| |
LL | enum T { A, B }
| ---------------
| | |
| | not covered
| `T` defined here
...
LL | match x { T::B => { } } LL | match x { T::B => { } }
| ^ pattern `A` not covered | ^ pattern `A` not covered
| |
note: `T` defined here
--> $DIR/non-exhaustive-match.rs:3:10
|
LL | enum T { A, B }
| - ^ not covered
= note: the matched value is of type `T` = note: the matched value is of type `T`
help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
| |
@ -35,11 +34,18 @@ error[E0004]: non-exhaustive patterns: `Some(_)` not covered
LL | match Some(10) { LL | match Some(10) {
| ^^^^^^^^ pattern `Some(_)` not covered | ^^^^^^^^ pattern `Some(_)` not covered
| |
::: $SRC_DIR/core/src/option.rs:LL:COL note: `Option<i32>` defined here
| --> $SRC_DIR/core/src/option.rs:LL:COL
LL | Some(#[stable(feature = "rust1", since = "1.0.0")] T),
| ---- not covered
| |
LL | / pub enum Option<T> {
LL | | /// No value.
LL | | #[lang = "None"]
LL | | #[stable(feature = "rust1", since = "1.0.0")]
... |
LL | | Some(#[stable(feature = "rust1", since = "1.0.0")] T),
| | ^^^^ not covered
LL | | }
| |_-
= note: the matched value is of type `Option<i32>` = note: the matched value is of type `Option<i32>`
help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
| |
@ -76,15 +82,14 @@ LL + (A, A) | (B, B) => todo!()
error[E0004]: non-exhaustive patterns: `B` not covered error[E0004]: non-exhaustive patterns: `B` not covered
--> $DIR/non-exhaustive-match.rs:22:11 --> $DIR/non-exhaustive-match.rs:22:11
| |
LL | enum T { A, B }
| ---------------
| | |
| | not covered
| `T` defined here
...
LL | match T::A { LL | match T::A {
| ^^^^ pattern `B` not covered | ^^^^ pattern `B` not covered
| |
note: `T` defined here
--> $DIR/non-exhaustive-match.rs:3:13
|
LL | enum T { A, B }
| - ^ not covered
= note: the matched value is of type `T` = note: the matched value is of type `T`
help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
| |

View File

@ -1,15 +1,14 @@
error[E0004]: non-exhaustive patterns: `Foo { first: false, second: Some([_, _, _, _]) }` not covered error[E0004]: non-exhaustive patterns: `Foo { first: false, second: Some([_, _, _, _]) }` not covered
--> $DIR/non-exhaustive-pattern-witness.rs:7:11 --> $DIR/non-exhaustive-pattern-witness.rs:7:11
| |
LL | / struct Foo { LL | match (Foo { first: true, second: None }) {
LL | | first: bool, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ pattern `Foo { first: false, second: Some([_, _, _, _]) }` not covered
LL | | second: Option<[usize; 4]>
LL | | }
| |_- `Foo` defined here
...
LL | match (Foo { first: true, second: None }) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ pattern `Foo { first: false, second: Some([_, _, _, _]) }` not covered
| |
note: `Foo` defined here
--> $DIR/non-exhaustive-pattern-witness.rs:1:8
|
LL | struct Foo {
| ^^^
= note: the matched value is of type `Foo` = note: the matched value is of type `Foo`
help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
| |
@ -20,17 +19,16 @@ LL + Foo { first: false, second: Some([_, _, _, _]) } => todo!()
error[E0004]: non-exhaustive patterns: `Red` not covered error[E0004]: non-exhaustive patterns: `Red` not covered
--> $DIR/non-exhaustive-pattern-witness.rs:23:11 --> $DIR/non-exhaustive-pattern-witness.rs:23:11
| |
LL | / enum Color { LL | match Color::Red {
LL | | Red, | ^^^^^^^^^^ pattern `Red` not covered
| | --- not covered
LL | | Green,
LL | | CustomRGBA { a: bool, r: u8, g: u8, b: u8 }
LL | | }
| |_- `Color` defined here
...
LL | match Color::Red {
| ^^^^^^^^^^ pattern `Red` not covered
| |
note: `Color` defined here
--> $DIR/non-exhaustive-pattern-witness.rs:17:5
|
LL | enum Color {
| -----
LL | Red,
| ^^^ not covered
= note: the matched value is of type `Color` = note: the matched value is of type `Color`
help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
| |
@ -41,18 +39,19 @@ LL + Red => todo!()
error[E0004]: non-exhaustive patterns: `East`, `South` and `West` not covered error[E0004]: non-exhaustive patterns: `East`, `South` and `West` not covered
--> $DIR/non-exhaustive-pattern-witness.rs:35:11 --> $DIR/non-exhaustive-pattern-witness.rs:35:11
| |
LL | / enum Direction { LL | match Direction::North {
LL | | North, East, South, West | ^^^^^^^^^^^^^^^^ patterns `East`, `South` and `West` not covered
| | ---- ----- ---- not covered
| | | |
| | | not covered
| | not covered
LL | | }
| |_- `Direction` defined here
...
LL | match Direction::North {
| ^^^^^^^^^^^^^^^^ patterns `East`, `South` and `West` not covered
| |
note: `Direction` defined here
--> $DIR/non-exhaustive-pattern-witness.rs:31:12
|
LL | enum Direction {
| ---------
LL | North, East, South, West
| ^^^^ ^^^^^ ^^^^ not covered
| | |
| | not covered
| not covered
= note: the matched value is of type `Direction` = note: the matched value is of type `Direction`
help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
| |
@ -63,14 +62,14 @@ LL + East | South | West => todo!()
error[E0004]: non-exhaustive patterns: `Second`, `Third`, `Fourth` and 8 more not covered error[E0004]: non-exhaustive patterns: `Second`, `Third`, `Fourth` and 8 more not covered
--> $DIR/non-exhaustive-pattern-witness.rs:46:11 --> $DIR/non-exhaustive-pattern-witness.rs:46:11
| |
LL | / enum ExcessiveEnum { LL | match ExcessiveEnum::First {
LL | | First, Second, Third, Fourth, Fifth, Sixth, Seventh, Eighth, Ninth, Tenth, Eleventh, Twelfth | ^^^^^^^^^^^^^^^^^^^^ patterns `Second`, `Third`, `Fourth` and 8 more not covered
LL | | }
| |_- `ExcessiveEnum` defined here
...
LL | match ExcessiveEnum::First {
| ^^^^^^^^^^^^^^^^^^^^ patterns `Second`, `Third`, `Fourth` and 8 more not covered
| |
note: `ExcessiveEnum` defined here
--> $DIR/non-exhaustive-pattern-witness.rs:41:6
|
LL | enum ExcessiveEnum {
| ^^^^^^^^^^^^^
= note: the matched value is of type `ExcessiveEnum` = note: the matched value is of type `ExcessiveEnum`
help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
| |
@ -81,17 +80,17 @@ LL + _ => todo!()
error[E0004]: non-exhaustive patterns: `CustomRGBA { a: true, .. }` not covered error[E0004]: non-exhaustive patterns: `CustomRGBA { a: true, .. }` not covered
--> $DIR/non-exhaustive-pattern-witness.rs:54:11 --> $DIR/non-exhaustive-pattern-witness.rs:54:11
| |
LL | / enum Color { LL | match Color::Red {
LL | | Red, | ^^^^^^^^^^ pattern `CustomRGBA { a: true, .. }` not covered
LL | | Green,
LL | | CustomRGBA { a: bool, r: u8, g: u8, b: u8 }
| | ---------- not covered
LL | | }
| |_- `Color` defined here
...
LL | match Color::Red {
| ^^^^^^^^^^ pattern `CustomRGBA { a: true, .. }` not covered
| |
note: `Color` defined here
--> $DIR/non-exhaustive-pattern-witness.rs:19:5
|
LL | enum Color {
| -----
...
LL | CustomRGBA { a: bool, r: u8, g: u8, b: u8 }
| ^^^^^^^^^^ not covered
= note: the matched value is of type `Color` = note: the matched value is of type `Color`
help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
| |

View File

@ -4,11 +4,19 @@ error[E0004]: non-exhaustive patterns: `Stable2` and `_` not covered
LL | match Foo::Stable { LL | match Foo::Stable {
| ^^^^^^^^^^^ patterns `Stable2` and `_` not covered | ^^^^^^^^^^^ patterns `Stable2` and `_` not covered
| |
::: $DIR/auxiliary/unstable.rs:9:5 note: `Foo` defined here
| --> $DIR/auxiliary/unstable.rs:9:5
LL | Stable2,
| ------- not covered
| |
LL | / pub enum Foo {
LL | | #[stable(feature = "stable_test_feature", since = "1.0.0")]
LL | | Stable,
LL | | #[stable(feature = "stable_test_feature", since = "1.0.0")]
LL | | Stable2,
| | ^^^^^^^ not covered
LL | | #[unstable(feature = "unstable_test_feature", issue = "none")]
LL | | Unstable,
LL | | }
| |_-
= note: the matched value is of type `Foo` = note: the matched value is of type `Foo`
help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
| |
@ -22,6 +30,17 @@ error[E0004]: non-exhaustive patterns: `_` not covered
LL | match Foo::Stable { LL | match Foo::Stable {
| ^^^^^^^^^^^ pattern `_` not covered | ^^^^^^^^^^^ pattern `_` not covered
| |
note: `Foo` defined here
--> $DIR/auxiliary/unstable.rs:5:1
|
LL | / pub enum Foo {
LL | | #[stable(feature = "stable_test_feature", since = "1.0.0")]
LL | | Stable,
LL | | #[stable(feature = "stable_test_feature", since = "1.0.0")]
... |
LL | | Unstable,
LL | | }
| |_^
= note: the matched value is of type `Foo` = note: the matched value is of type `Foo`
help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
| |

View File

@ -1,16 +1,16 @@
error[E0004]: non-exhaustive patterns: `B { x: Some(_) }` not covered error[E0004]: non-exhaustive patterns: `B { x: Some(_) }` not covered
--> $DIR/struct-like-enum-nonexhaustive.rs:8:11 --> $DIR/struct-like-enum-nonexhaustive.rs:8:11
| |
LL | / enum A { LL | match x {
LL | | B { x: Option<isize> }, | ^ pattern `B { x: Some(_) }` not covered
| | - not covered
LL | | C
LL | | }
| |_- `A` defined here
...
LL | match x {
| ^ pattern `B { x: Some(_) }` not covered
| |
note: `A` defined here
--> $DIR/struct-like-enum-nonexhaustive.rs:2:5
|
LL | enum A {
| -
LL | B { x: Option<isize> },
| ^ not covered
= note: the matched value is of type `A` = note: the matched value is of type `A`
help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
| |

View File

@ -1,12 +1,14 @@
error[E0004]: non-exhaustive patterns: `Foo(_, _)` not covered error[E0004]: non-exhaustive patterns: `Foo(_, _)` not covered
--> $DIR/tuple-struct-nonexhaustive.rs:5:11 --> $DIR/tuple-struct-nonexhaustive.rs:5:11
| |
LL | struct Foo(isize, isize);
| ------------------------- `Foo` defined here
...
LL | match x { LL | match x {
| ^ pattern `Foo(_, _)` not covered | ^ pattern `Foo(_, _)` not covered
| |
note: `Foo` defined here
--> $DIR/tuple-struct-nonexhaustive.rs:1:8
|
LL | struct Foo(isize, isize);
| ^^^
= note: the matched value is of type `Foo` = note: the matched value is of type `Foo`
help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
| |

View File

@ -4,11 +4,18 @@ error[E0004]: non-exhaustive patterns: `Unstable` not covered
LL | match Foo::Stable { LL | match Foo::Stable {
| ^^^^^^^^^^^ pattern `Unstable` not covered | ^^^^^^^^^^^ pattern `Unstable` not covered
| |
::: $DIR/auxiliary/unstable.rs:11:5 note: `Foo` defined here
| --> $DIR/auxiliary/unstable.rs:11:5
LL | Unstable,
| -------- not covered
| |
LL | / pub enum Foo {
LL | | #[stable(feature = "stable_test_feature", since = "1.0.0")]
LL | | Stable,
LL | | #[stable(feature = "stable_test_feature", since = "1.0.0")]
... |
LL | | Unstable,
| | ^^^^^^^^ not covered
LL | | }
| |_-
= note: the matched value is of type `Foo` = note: the matched value is of type `Foo`
help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
| |

View File

@ -4,13 +4,20 @@ error[E0005]: refutable pattern in local binding: `Err(_)` not covered
LL | let Ok(x) = res; LL | let Ok(x) = res;
| ^^^^^ pattern `Err(_)` not covered | ^^^^^ pattern `Err(_)` not covered
| |
::: $SRC_DIR/core/src/result.rs:LL:COL
|
LL | Err(#[stable(feature = "rust1", since = "1.0.0")] E),
| --- not covered
|
= note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant = note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant
= note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html = note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html
note: `Result<u32, &R>` defined here
--> $SRC_DIR/core/src/result.rs:LL:COL
|
LL | / pub enum Result<T, E> {
LL | | /// Contains the success value
LL | | #[lang = "Ok"]
LL | | #[stable(feature = "rust1", since = "1.0.0")]
... |
LL | | Err(#[stable(feature = "rust1", since = "1.0.0")] E),
| | ^^^ not covered
LL | | }
| |_-
= note: the matched value is of type `Result<u32, &R>` = note: the matched value is of type `Result<u32, &R>`
help: you might want to use `if let` to ignore the variant that isn't matched help: you might want to use `if let` to ignore the variant that isn't matched
| |

View File

@ -4,6 +4,11 @@ error[E0004]: non-exhaustive patterns: type `EmptyNonExhaustiveEnum` is non-empt
LL | match x {} LL | match x {}
| ^ | ^
| |
note: `EmptyNonExhaustiveEnum` defined here
--> $DIR/auxiliary/enums.rs:18:1
|
LL | pub enum EmptyNonExhaustiveEnum {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= note: the matched value is of type `EmptyNonExhaustiveEnum`, which is marked as non-exhaustive = note: the matched value is of type `EmptyNonExhaustiveEnum`, which is marked as non-exhaustive
help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
| |
@ -18,6 +23,15 @@ error[E0004]: non-exhaustive patterns: `_` not covered
LL | match enum_unit { LL | match enum_unit {
| ^^^^^^^^^ pattern `_` not covered | ^^^^^^^^^ pattern `_` not covered
| |
note: `NonExhaustiveEnum` defined here
--> $DIR/auxiliary/enums.rs:4:1
|
LL | / pub enum NonExhaustiveEnum {
LL | | Unit,
LL | | Tuple(u32),
LL | | Struct { field: u32 },
LL | | }
| |_^
= note: the matched value is of type `NonExhaustiveEnum`, which is marked as non-exhaustive = note: the matched value is of type `NonExhaustiveEnum`, which is marked as non-exhaustive
help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
| |
@ -31,6 +45,15 @@ error[E0004]: non-exhaustive patterns: `_` not covered
LL | match enum_unit {}; LL | match enum_unit {};
| ^^^^^^^^^ pattern `_` not covered | ^^^^^^^^^ pattern `_` not covered
| |
note: `NonExhaustiveEnum` defined here
--> $DIR/auxiliary/enums.rs:4:1
|
LL | / pub enum NonExhaustiveEnum {
LL | | Unit,
LL | | Tuple(u32),
LL | | Struct { field: u32 },
LL | | }
| |_^
= note: the matched value is of type `NonExhaustiveEnum`, which is marked as non-exhaustive = note: the matched value is of type `NonExhaustiveEnum`, which is marked as non-exhaustive
help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
| |

View File

@ -13,22 +13,22 @@ LL | #![deny(unreachable_patterns)]
error[E0004]: non-exhaustive patterns: `Unit`, `Tuple(_)` and `Struct { .. }` not covered error[E0004]: non-exhaustive patterns: `Unit`, `Tuple(_)` and `Struct { .. }` not covered
--> $DIR/enum_same_crate_empty_match.rs:33:11 --> $DIR/enum_same_crate_empty_match.rs:33:11
| |
LL | / pub enum NonExhaustiveEnum { LL | match NonExhaustiveEnum::Unit {}
LL | | Unit, | ^^^^^^^^^^^^^^^^^^^^^^^ patterns `Unit`, `Tuple(_)` and `Struct { .. }` not covered
| | ---- not covered
LL | |
LL | | Tuple(u32),
| | ----- not covered
LL | |
LL | | Struct { field: u32 }
| | ------ not covered
LL | |
LL | | }
| |_- `NonExhaustiveEnum` defined here
...
LL | match NonExhaustiveEnum::Unit {}
| ^^^^^^^^^^^^^^^^^^^^^^^ patterns `Unit`, `Tuple(_)` and `Struct { .. }` not covered
| |
note: `NonExhaustiveEnum` defined here
--> $DIR/enum_same_crate_empty_match.rs:5:5
|
LL | pub enum NonExhaustiveEnum {
| -----------------
LL | Unit,
| ^^^^ not covered
LL |
LL | Tuple(u32),
| ^^^^^ not covered
LL |
LL | Struct { field: u32 }
| ^^^^^^ not covered
= note: the matched value is of type `NonExhaustiveEnum` = note: the matched value is of type `NonExhaustiveEnum`
help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
| |
@ -40,22 +40,22 @@ LL + }
error[E0004]: non-exhaustive patterns: `Unit`, `Tuple(_)` and `Struct { .. }` not covered error[E0004]: non-exhaustive patterns: `Unit`, `Tuple(_)` and `Struct { .. }` not covered
--> $DIR/enum_same_crate_empty_match.rs:35:11 --> $DIR/enum_same_crate_empty_match.rs:35:11
| |
LL | / pub enum NormalEnum { LL | match NormalEnum::Unit {}
LL | | Unit, | ^^^^^^^^^^^^^^^^ patterns `Unit`, `Tuple(_)` and `Struct { .. }` not covered
| | ---- not covered
LL | |
LL | | Tuple(u32),
| | ----- not covered
LL | |
LL | | Struct { field: u32 }
| | ------ not covered
LL | |
LL | | }
| |_- `NormalEnum` defined here
...
LL | match NormalEnum::Unit {}
| ^^^^^^^^^^^^^^^^ patterns `Unit`, `Tuple(_)` and `Struct { .. }` not covered
| |
note: `NormalEnum` defined here
--> $DIR/enum_same_crate_empty_match.rs:14:5
|
LL | pub enum NormalEnum {
| ----------
LL | Unit,
| ^^^^ not covered
LL |
LL | Tuple(u32),
| ^^^^^ not covered
LL |
LL | Struct { field: u32 }
| ^^^^^^ not covered
= note: the matched value is of type `NormalEnum` = note: the matched value is of type `NormalEnum`
help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
| |

View File

@ -4,6 +4,11 @@ error[E0004]: non-exhaustive patterns: type `IndirectUninhabitedEnum` is non-emp
LL | match x {} LL | match x {}
| ^ | ^
| |
note: `IndirectUninhabitedEnum` defined here
--> $DIR/auxiliary/uninhabited.rs:26:1
|
LL | pub struct IndirectUninhabitedEnum(UninhabitedEnum);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= note: the matched value is of type `IndirectUninhabitedEnum` = note: the matched value is of type `IndirectUninhabitedEnum`
help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
| |
@ -18,6 +23,11 @@ error[E0004]: non-exhaustive patterns: type `IndirectUninhabitedStruct` is non-e
LL | match x {} LL | match x {}
| ^ | ^
| |
note: `IndirectUninhabitedStruct` defined here
--> $DIR/auxiliary/uninhabited.rs:28:1
|
LL | pub struct IndirectUninhabitedStruct(UninhabitedStruct);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= note: the matched value is of type `IndirectUninhabitedStruct` = note: the matched value is of type `IndirectUninhabitedStruct`
help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
| |
@ -32,6 +42,11 @@ error[E0004]: non-exhaustive patterns: type `IndirectUninhabitedTupleStruct` is
LL | match x {} LL | match x {}
| ^ | ^
| |
note: `IndirectUninhabitedTupleStruct` defined here
--> $DIR/auxiliary/uninhabited.rs:30:1
|
LL | pub struct IndirectUninhabitedTupleStruct(UninhabitedTupleStruct);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= note: the matched value is of type `IndirectUninhabitedTupleStruct` = note: the matched value is of type `IndirectUninhabitedTupleStruct`
help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
| |
@ -46,6 +61,11 @@ error[E0004]: non-exhaustive patterns: type `IndirectUninhabitedVariants` is non
LL | match x {} LL | match x {}
| ^ | ^
| |
note: `IndirectUninhabitedVariants` defined here
--> $DIR/auxiliary/uninhabited.rs:32:1
|
LL | pub struct IndirectUninhabitedVariants(UninhabitedVariants);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= note: the matched value is of type `IndirectUninhabitedVariants` = note: the matched value is of type `IndirectUninhabitedVariants`
help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
| |

View File

@ -1,12 +1,14 @@
error[E0004]: non-exhaustive patterns: type `IndirectUninhabitedEnum` is non-empty error[E0004]: non-exhaustive patterns: type `IndirectUninhabitedEnum` is non-empty
--> $DIR/indirect_match_same_crate.rs:34:11 --> $DIR/indirect_match_same_crate.rs:34:11
| |
LL | pub struct IndirectUninhabitedEnum(UninhabitedEnum);
| ---------------------------------------------------- `IndirectUninhabitedEnum` defined here
...
LL | match x {} LL | match x {}
| ^ | ^
| |
note: `IndirectUninhabitedEnum` defined here
--> $DIR/indirect_match_same_crate.rs:20:12
|
LL | pub struct IndirectUninhabitedEnum(UninhabitedEnum);
| ^^^^^^^^^^^^^^^^^^^^^^^
= note: the matched value is of type `IndirectUninhabitedEnum` = note: the matched value is of type `IndirectUninhabitedEnum`
help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
| |
@ -18,12 +20,14 @@ LL ~ }
error[E0004]: non-exhaustive patterns: type `IndirectUninhabitedStruct` is non-empty error[E0004]: non-exhaustive patterns: type `IndirectUninhabitedStruct` is non-empty
--> $DIR/indirect_match_same_crate.rs:38:11 --> $DIR/indirect_match_same_crate.rs:38:11
| |
LL | pub struct IndirectUninhabitedStruct(UninhabitedStruct);
| -------------------------------------------------------- `IndirectUninhabitedStruct` defined here
...
LL | match x {} LL | match x {}
| ^ | ^
| |
note: `IndirectUninhabitedStruct` defined here
--> $DIR/indirect_match_same_crate.rs:22:12
|
LL | pub struct IndirectUninhabitedStruct(UninhabitedStruct);
| ^^^^^^^^^^^^^^^^^^^^^^^^^
= note: the matched value is of type `IndirectUninhabitedStruct` = note: the matched value is of type `IndirectUninhabitedStruct`
help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
| |
@ -35,12 +39,14 @@ LL ~ }
error[E0004]: non-exhaustive patterns: type `IndirectUninhabitedTupleStruct` is non-empty error[E0004]: non-exhaustive patterns: type `IndirectUninhabitedTupleStruct` is non-empty
--> $DIR/indirect_match_same_crate.rs:42:11 --> $DIR/indirect_match_same_crate.rs:42:11
| |
LL | pub struct IndirectUninhabitedTupleStruct(UninhabitedTupleStruct);
| ------------------------------------------------------------------ `IndirectUninhabitedTupleStruct` defined here
...
LL | match x {} LL | match x {}
| ^ | ^
| |
note: `IndirectUninhabitedTupleStruct` defined here
--> $DIR/indirect_match_same_crate.rs:24:12
|
LL | pub struct IndirectUninhabitedTupleStruct(UninhabitedTupleStruct);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= note: the matched value is of type `IndirectUninhabitedTupleStruct` = note: the matched value is of type `IndirectUninhabitedTupleStruct`
help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
| |
@ -52,12 +58,14 @@ LL ~ }
error[E0004]: non-exhaustive patterns: type `IndirectUninhabitedVariants` is non-empty error[E0004]: non-exhaustive patterns: type `IndirectUninhabitedVariants` is non-empty
--> $DIR/indirect_match_same_crate.rs:48:11 --> $DIR/indirect_match_same_crate.rs:48:11
| |
LL | pub struct IndirectUninhabitedVariants(UninhabitedVariants);
| ------------------------------------------------------------ `IndirectUninhabitedVariants` defined here
...
LL | match x {} LL | match x {}
| ^ | ^
| |
note: `IndirectUninhabitedVariants` defined here
--> $DIR/indirect_match_same_crate.rs:26:12
|
LL | pub struct IndirectUninhabitedVariants(UninhabitedVariants);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
= note: the matched value is of type `IndirectUninhabitedVariants` = note: the matched value is of type `IndirectUninhabitedVariants`
help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
| |

View File

@ -4,6 +4,11 @@ error[E0004]: non-exhaustive patterns: type `IndirectUninhabitedEnum` is non-emp
LL | match x {} LL | match x {}
| ^ | ^
| |
note: `IndirectUninhabitedEnum` defined here
--> $DIR/auxiliary/uninhabited.rs:26:1
|
LL | pub struct IndirectUninhabitedEnum(UninhabitedEnum);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= note: the matched value is of type `IndirectUninhabitedEnum` = note: the matched value is of type `IndirectUninhabitedEnum`
help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
| |
@ -18,6 +23,11 @@ error[E0004]: non-exhaustive patterns: type `IndirectUninhabitedStruct` is non-e
LL | match x {} LL | match x {}
| ^ | ^
| |
note: `IndirectUninhabitedStruct` defined here
--> $DIR/auxiliary/uninhabited.rs:28:1
|
LL | pub struct IndirectUninhabitedStruct(UninhabitedStruct);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= note: the matched value is of type `IndirectUninhabitedStruct` = note: the matched value is of type `IndirectUninhabitedStruct`
help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
| |
@ -32,6 +42,11 @@ error[E0004]: non-exhaustive patterns: type `IndirectUninhabitedTupleStruct` is
LL | match x {} LL | match x {}
| ^ | ^
| |
note: `IndirectUninhabitedTupleStruct` defined here
--> $DIR/auxiliary/uninhabited.rs:30:1
|
LL | pub struct IndirectUninhabitedTupleStruct(UninhabitedTupleStruct);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= note: the matched value is of type `IndirectUninhabitedTupleStruct` = note: the matched value is of type `IndirectUninhabitedTupleStruct`
help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
| |
@ -46,6 +61,11 @@ error[E0004]: non-exhaustive patterns: type `IndirectUninhabitedVariants` is non
LL | match x {} LL | match x {}
| ^ | ^
| |
note: `IndirectUninhabitedVariants` defined here
--> $DIR/auxiliary/uninhabited.rs:32:1
|
LL | pub struct IndirectUninhabitedVariants(UninhabitedVariants);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= note: the matched value is of type `IndirectUninhabitedVariants` = note: the matched value is of type `IndirectUninhabitedVariants`
help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
| |

View File

@ -4,6 +4,12 @@ error[E0004]: non-exhaustive patterns: type `UninhabitedEnum` is non-empty
LL | match x {} LL | match x {}
| ^ | ^
| |
note: `UninhabitedEnum` defined here
--> $DIR/auxiliary/uninhabited.rs:5:1
|
LL | / pub enum UninhabitedEnum {
LL | | }
| |_^
= note: the matched value is of type `UninhabitedEnum`, which is marked as non-exhaustive = note: the matched value is of type `UninhabitedEnum`, which is marked as non-exhaustive
help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
| |
@ -18,6 +24,13 @@ error[E0004]: non-exhaustive patterns: type `UninhabitedStruct` is non-empty
LL | match x {} LL | match x {}
| ^ | ^
| |
note: `UninhabitedStruct` defined here
--> $DIR/auxiliary/uninhabited.rs:9:1
|
LL | / pub struct UninhabitedStruct {
LL | | _priv: !,
LL | | }
| |_^
= note: the matched value is of type `UninhabitedStruct` = note: the matched value is of type `UninhabitedStruct`
help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
| |
@ -32,6 +45,11 @@ error[E0004]: non-exhaustive patterns: type `UninhabitedTupleStruct` is non-empt
LL | match x {} LL | match x {}
| ^ | ^
| |
note: `UninhabitedTupleStruct` defined here
--> $DIR/auxiliary/uninhabited.rs:14:1
|
LL | pub struct UninhabitedTupleStruct(!);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= note: the matched value is of type `UninhabitedTupleStruct` = note: the matched value is of type `UninhabitedTupleStruct`
help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
| |
@ -46,13 +64,16 @@ error[E0004]: non-exhaustive patterns: `Tuple(_)` and `Struct { .. }` not covere
LL | match x {} LL | match x {}
| ^ patterns `Tuple(_)` and `Struct { .. }` not covered | ^ patterns `Tuple(_)` and `Struct { .. }` not covered
| |
::: $DIR/auxiliary/uninhabited.rs:17:23 note: `UninhabitedVariants` defined here
| --> $DIR/auxiliary/uninhabited.rs:17:23
LL | #[non_exhaustive] Tuple(!),
| ----- not covered
LL | #[non_exhaustive] Struct { x: ! }
| ------ not covered
| |
LL | / pub enum UninhabitedVariants {
LL | | #[non_exhaustive] Tuple(!),
| | ^^^^^ not covered
LL | | #[non_exhaustive] Struct { x: ! }
| | ^^^^^^ not covered
LL | | }
| |_-
= note: the matched value is of type `UninhabitedVariants` = note: the matched value is of type `UninhabitedVariants`
help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
| |

View File

@ -1,14 +1,14 @@
error[E0004]: non-exhaustive patterns: type `UninhabitedStruct` is non-empty error[E0004]: non-exhaustive patterns: type `UninhabitedStruct` is non-empty
--> $DIR/match_same_crate.rs:30:11 --> $DIR/match_same_crate.rs:30:11
| |
LL | / pub struct UninhabitedStruct { LL | match x {}
LL | | _priv: !, | ^
LL | | }
| |_- `UninhabitedStruct` defined here
...
LL | match x {}
| ^
| |
note: `UninhabitedStruct` defined here
--> $DIR/match_same_crate.rs:8:12
|
LL | pub struct UninhabitedStruct {
| ^^^^^^^^^^^^^^^^^
= note: the matched value is of type `UninhabitedStruct` = note: the matched value is of type `UninhabitedStruct`
help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
| |
@ -20,12 +20,14 @@ LL ~ }
error[E0004]: non-exhaustive patterns: type `UninhabitedTupleStruct` is non-empty error[E0004]: non-exhaustive patterns: type `UninhabitedTupleStruct` is non-empty
--> $DIR/match_same_crate.rs:34:11 --> $DIR/match_same_crate.rs:34:11
| |
LL | pub struct UninhabitedTupleStruct(!);
| ------------------------------------- `UninhabitedTupleStruct` defined here
...
LL | match x {} LL | match x {}
| ^ | ^
| |
note: `UninhabitedTupleStruct` defined here
--> $DIR/match_same_crate.rs:13:12
|
LL | pub struct UninhabitedTupleStruct(!);
| ^^^^^^^^^^^^^^^^^^^^^^
= note: the matched value is of type `UninhabitedTupleStruct` = note: the matched value is of type `UninhabitedTupleStruct`
help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
| |
@ -37,17 +39,18 @@ LL ~ }
error[E0004]: non-exhaustive patterns: `Tuple(_)` and `Struct { .. }` not covered error[E0004]: non-exhaustive patterns: `Tuple(_)` and `Struct { .. }` not covered
--> $DIR/match_same_crate.rs:38:11 --> $DIR/match_same_crate.rs:38:11
| |
LL | / pub enum UninhabitedVariants { LL | match x {}
LL | | #[non_exhaustive] Tuple(!), | ^ patterns `Tuple(_)` and `Struct { .. }` not covered
| | ----- not covered
LL | | #[non_exhaustive] Struct { x: ! }
| | ------ not covered
LL | | }
| |_- `UninhabitedVariants` defined here
...
LL | match x {}
| ^ patterns `Tuple(_)` and `Struct { .. }` not covered
| |
note: `UninhabitedVariants` defined here
--> $DIR/match_same_crate.rs:16:23
|
LL | pub enum UninhabitedVariants {
| -------------------
LL | #[non_exhaustive] Tuple(!),
| ^^^^^ not covered
LL | #[non_exhaustive] Struct { x: ! }
| ^^^^^^ not covered
= note: the matched value is of type `UninhabitedVariants` = note: the matched value is of type `UninhabitedVariants`
help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
| |

View File

@ -4,6 +4,12 @@ error[E0004]: non-exhaustive patterns: type `UninhabitedEnum` is non-empty
LL | match x {} LL | match x {}
| ^ | ^
| |
note: `UninhabitedEnum` defined here
--> $DIR/auxiliary/uninhabited.rs:5:1
|
LL | / pub enum UninhabitedEnum {
LL | | }
| |_^
= note: the matched value is of type `UninhabitedEnum`, which is marked as non-exhaustive = note: the matched value is of type `UninhabitedEnum`, which is marked as non-exhaustive
help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
| |
@ -18,6 +24,13 @@ error[E0004]: non-exhaustive patterns: type `UninhabitedStruct` is non-empty
LL | match x {} LL | match x {}
| ^ | ^
| |
note: `UninhabitedStruct` defined here
--> $DIR/auxiliary/uninhabited.rs:9:1
|
LL | / pub struct UninhabitedStruct {
LL | | _priv: !,
LL | | }
| |_^
= note: the matched value is of type `UninhabitedStruct` = note: the matched value is of type `UninhabitedStruct`
help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
| |
@ -32,6 +45,11 @@ error[E0004]: non-exhaustive patterns: type `UninhabitedTupleStruct` is non-empt
LL | match x {} LL | match x {}
| ^ | ^
| |
note: `UninhabitedTupleStruct` defined here
--> $DIR/auxiliary/uninhabited.rs:14:1
|
LL | pub struct UninhabitedTupleStruct(!);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= note: the matched value is of type `UninhabitedTupleStruct` = note: the matched value is of type `UninhabitedTupleStruct`
help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
| |
@ -46,13 +64,16 @@ error[E0004]: non-exhaustive patterns: `Tuple(_)` and `Struct { .. }` not covere
LL | match x {} LL | match x {}
| ^ patterns `Tuple(_)` and `Struct { .. }` not covered | ^ patterns `Tuple(_)` and `Struct { .. }` not covered
| |
::: $DIR/auxiliary/uninhabited.rs:17:23 note: `UninhabitedVariants` defined here
| --> $DIR/auxiliary/uninhabited.rs:17:23
LL | #[non_exhaustive] Tuple(!),
| ----- not covered
LL | #[non_exhaustive] Struct { x: ! }
| ------ not covered
| |
LL | / pub enum UninhabitedVariants {
LL | | #[non_exhaustive] Tuple(!),
| | ^^^^^ not covered
LL | | #[non_exhaustive] Struct { x: ! }
| | ^^^^^^ not covered
LL | | }
| |_-
= note: the matched value is of type `UninhabitedVariants` = note: the matched value is of type `UninhabitedVariants`
help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
| |

View File

@ -1,20 +1,18 @@
error[E0005]: refutable pattern in local binding: `A(_)` not covered error[E0005]: refutable pattern in local binding: `A(_)` not covered
--> $DIR/uninhabited-irrefutable.rs:27:9 --> $DIR/uninhabited-irrefutable.rs:27:9
| |
LL | / enum Foo { LL | let Foo::D(_y) = x;
LL | | A(foo::SecretlyEmpty), | ^^^^^^^^^^ pattern `A(_)` not covered
| | - not covered
LL | | B(foo::NotSoSecretlyEmpty),
LL | | C(NotSoSecretlyEmpty),
LL | | D(u32),
LL | | }
| |_- `Foo` defined here
...
LL | let Foo::D(_y) = x;
| ^^^^^^^^^^ pattern `A(_)` not covered
| |
= note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant = note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant
= note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html = note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html
note: `Foo` defined here
--> $DIR/uninhabited-irrefutable.rs:19:5
|
LL | enum Foo {
| ---
LL | A(foo::SecretlyEmpty),
| ^ not covered
= note: the matched value is of type `Foo` = note: the matched value is of type `Foo`
help: you might want to use `if let` to ignore the variant that isn't matched help: you might want to use `if let` to ignore the variant that isn't matched
| |

View File

@ -4,11 +4,18 @@ error[E0004]: non-exhaustive patterns: `Err(_)` not covered
LL | let _ = match x { LL | let _ = match x {
| ^ pattern `Err(_)` not covered | ^ pattern `Err(_)` not covered
| |
::: $SRC_DIR/core/src/result.rs:LL:COL note: `Result<u32, &Void>` defined here
| --> $SRC_DIR/core/src/result.rs:LL:COL
LL | Err(#[stable(feature = "rust1", since = "1.0.0")] E),
| --- not covered
| |
LL | / pub enum Result<T, E> {
LL | | /// Contains the success value
LL | | #[lang = "Ok"]
LL | | #[stable(feature = "rust1", since = "1.0.0")]
... |
LL | | Err(#[stable(feature = "rust1", since = "1.0.0")] E),
| | ^^^ not covered
LL | | }
| |_-
= note: the matched value is of type `Result<u32, &Void>` = note: the matched value is of type `Result<u32, &Void>`
help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
| |
@ -19,12 +26,14 @@ LL ~ Err(_) => todo!(),
error[E0004]: non-exhaustive patterns: type `&Void` is non-empty error[E0004]: non-exhaustive patterns: type `&Void` is non-empty
--> $DIR/uninhabited-matches-feature-gated.rs:15:19 --> $DIR/uninhabited-matches-feature-gated.rs:15:19
| |
LL | enum Void {}
| ------------ `Void` defined here
...
LL | let _ = match x {}; LL | let _ = match x {};
| ^ | ^
| |
note: `Void` defined here
--> $DIR/uninhabited-matches-feature-gated.rs:2:6
|
LL | enum Void {}
| ^^^^
= note: the matched value is of type `&Void` = note: the matched value is of type `&Void`
= note: references are always considered inhabited = note: references are always considered inhabited
help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
@ -81,11 +90,18 @@ error[E0004]: non-exhaustive patterns: `Err(_)` not covered
LL | let _ = match x { LL | let _ = match x {
| ^ pattern `Err(_)` not covered | ^ pattern `Err(_)` not covered
| |
::: $SRC_DIR/core/src/result.rs:LL:COL note: `Result<u32, Void>` defined here
| --> $SRC_DIR/core/src/result.rs:LL:COL
LL | Err(#[stable(feature = "rust1", since = "1.0.0")] E),
| --- not covered
| |
LL | / pub enum Result<T, E> {
LL | | /// Contains the success value
LL | | #[lang = "Ok"]
LL | | #[stable(feature = "rust1", since = "1.0.0")]
... |
LL | | Err(#[stable(feature = "rust1", since = "1.0.0")] E),
| | ^^^ not covered
LL | | }
| |_-
= note: the matched value is of type `Result<u32, Void>` = note: the matched value is of type `Result<u32, Void>`
help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
| |
@ -99,13 +115,20 @@ error[E0005]: refutable pattern in local binding: `Err(_)` not covered
LL | let Ok(x) = x; LL | let Ok(x) = x;
| ^^^^^ pattern `Err(_)` not covered | ^^^^^ pattern `Err(_)` not covered
| |
::: $SRC_DIR/core/src/result.rs:LL:COL
|
LL | Err(#[stable(feature = "rust1", since = "1.0.0")] E),
| --- not covered
|
= note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant = note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant
= note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html = note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html
note: `Result<u32, Void>` defined here
--> $SRC_DIR/core/src/result.rs:LL:COL
|
LL | / pub enum Result<T, E> {
LL | | /// Contains the success value
LL | | #[lang = "Ok"]
LL | | #[stable(feature = "rust1", since = "1.0.0")]
... |
LL | | Err(#[stable(feature = "rust1", since = "1.0.0")] E),
| | ^^^ not covered
LL | | }
| |_-
= note: the matched value is of type `Result<u32, Void>` = note: the matched value is of type `Result<u32, Void>`
help: you might want to use `if let` to ignore the variant that isn't matched help: you might want to use `if let` to ignore the variant that isn't matched
| |