From ab4feea50dd3e0109a30488300c213ca074d01a6 Mon Sep 17 00:00:00 2001 From: Esteban Kuber Date: Thu, 16 Dec 2021 05:06:44 +0000 Subject: [PATCH] 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 --- .../src/thir/pattern/check_match.rs | 26 +- .../match/issue-88331.stderr | 16 +- .../match/non-exhaustive-match.stderr | 21 +- src/test/ui/empty/empty-never-array.stderr | 19 +- src/test/ui/error-codes/E0004-2.stderr | 20 +- src/test/ui/error-codes/E0004.stderr | 18 +- src/test/ui/error-codes/E0005.stderr | 18 +- src/test/ui/error-codes/E0297.stderr | 16 +- .../feature-gate-exhaustive-patterns.stderr | 17 +- src/test/ui/match/match_non_exhaustive.stderr | 21 +- .../always-inhabited-union-ref.stderr | 14 +- .../doc-hidden-non-exhaustive.stderr | 53 +++- .../empty-match.exhaustive_patterns.stderr | 194 +++++++------- .../usefulness/empty-match.normal.stderr | 194 +++++++------- .../ui/pattern/usefulness/issue-31561.stderr | 23 +- .../ui/pattern/usefulness/issue-35609.stderr | 27 +- .../ui/pattern/usefulness/issue-3601.stderr | 8 + .../ui/pattern/usefulness/issue-39362.stderr | 16 +- .../ui/pattern/usefulness/issue-40221.stderr | 17 +- .../ui/pattern/usefulness/issue-50900.stderr | 8 +- .../ui/pattern/usefulness/issue-56379.stderr | 25 +- .../issue-78123-non-exhaustive-reference.rs | 1 + ...ssue-78123-non-exhaustive-reference.stderr | 10 +- .../usefulness/match-arm-statics-2.stderr | 36 +-- .../usefulness/match-privately-empty.stderr | 15 +- .../usefulness/non-exhaustive-defined-here.rs | 63 +++-- .../non-exhaustive-defined-here.stderr | 240 ++++++++---------- .../non-exhaustive-match-nested.stderr | 11 +- .../usefulness/non-exhaustive-match.stderr | 37 +-- .../non-exhaustive-pattern-witness.stderr | 91 ++++--- .../usefulness/stable-gated-patterns.stderr | 27 +- .../struct-like-enum-nonexhaustive.stderr | 18 +- .../tuple-struct-nonexhaustive.stderr | 8 +- .../usefulness/unstable-gated-patterns.stderr | 15 +- ...recursive-types-are-not-uninhabited.stderr | 17 +- .../ui/rfc-2008-non-exhaustive/enum.stderr | 23 ++ .../enum_same_crate_empty_match.stderr | 60 ++--- .../uninhabited/indirect_match.stderr | 20 ++ .../indirect_match_same_crate.stderr | 32 ++- ...rect_match_with_exhaustive_patterns.stderr | 20 ++ .../uninhabited/match.stderr | 33 ++- .../uninhabited/match_same_crate.stderr | 43 ++-- .../match_with_exhaustive_patterns.stderr | 33 ++- .../uninhabited-irrefutable.stderr | 20 +- .../uninhabited-matches-feature-gated.stderr | 55 ++-- 45 files changed, 1018 insertions(+), 681 deletions(-) diff --git a/compiler/rustc_mir_build/src/thir/pattern/check_match.rs b/compiler/rustc_mir_build/src/thir/pattern/check_match.rs index a0325101c41..204009934e7 100644 --- a/compiler/rustc_mir_build/src/thir/pattern/check_match.rs +++ b/compiler/rustc_mir_build/src/thir/pattern/check_match.rs @@ -20,7 +20,7 @@ use rustc_session::lint::builtin::{ }; use rustc_session::Session; 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) { let body_id = match def_id.as_local() { @@ -669,15 +669,27 @@ fn adt_defined_here<'p, 'tcx>( ) { let ty = ty.peel_refs(); if let ty::Adt(def, _) = ty.kind() { - if let Some(sp) = cx.tcx.hir().span_if_local(def.did) { - err.span_label(sp, format!("`{}` defined here", ty)); - } - - if witnesses.len() < 4 { + let mut spans = vec![]; + if witnesses.len() < 5 { 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)); } } diff --git a/src/test/ui/closures/2229_closure_analysis/match/issue-88331.stderr b/src/test/ui/closures/2229_closure_analysis/match/issue-88331.stderr index 5e66d1318fb..205a0e7c6fd 100644 --- a/src/test/ui/closures/2229_closure_analysis/match/issue-88331.stderr +++ b/src/test/ui/closures/2229_closure_analysis/match/issue-88331.stderr @@ -1,12 +1,14 @@ error[E0004]: non-exhaustive patterns: `Opcode(0_u8)` and `Opcode(2_u8..=u8::MAX)` not covered --> $DIR/issue-88331.rs:11:20 | -LL | pub struct Opcode(pub u8); - | -------------------------- `Opcode` defined here -... LL | move |i| match msg_type { | ^^^^^^^^ 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` 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 --> $DIR/issue-88331.rs:27:20 | -LL | pub struct Opcode2(Opcode); - | --------------------------- `Opcode2` defined here -... LL | move |i| match msg_type { | ^^^^^^^^ 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` help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms | diff --git a/src/test/ui/closures/2229_closure_analysis/match/non-exhaustive-match.stderr b/src/test/ui/closures/2229_closure_analysis/match/non-exhaustive-match.stderr index 0ce1f6cf9ad..02bd60893eb 100644 --- a/src/test/ui/closures/2229_closure_analysis/match/non-exhaustive-match.stderr +++ b/src/test/ui/closures/2229_closure_analysis/match/non-exhaustive-match.stderr @@ -1,15 +1,14 @@ error[E0004]: non-exhaustive patterns: `B` not covered --> $DIR/non-exhaustive-match.rs:26:25 | -LL | enum L1 { A, B } - | ---------------- - | | | - | | not covered - | `L1` defined here -... LL | let _b = || { match l1 { L1::A => () } }; | ^^ 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` 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 {} }; | ^^ | +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 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 => () } }; | ^^ 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 help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms | diff --git a/src/test/ui/empty/empty-never-array.stderr b/src/test/ui/empty/empty-never-array.stderr index 64d640c0e9d..8dd0f377533 100644 --- a/src/test/ui/empty/empty-never-array.stderr +++ b/src/test/ui/empty/empty-never-array.stderr @@ -1,19 +1,18 @@ error[E0005]: refutable pattern in local binding: `T(_, _)` not covered --> $DIR/empty-never-array.rs:10:9 | -LL | / enum Helper { -LL | | T(T, [!; 0]), - | | - not covered -LL | | #[allow(dead_code)] -LL | | U(U), -LL | | } - | |_- `Helper` defined here -... -LL | let Helper::U(u) = Helper::T(t, []); - | ^^^^^^^^^^^^ pattern `T(_, _)` not covered +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: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html +note: `Helper` defined here + --> $DIR/empty-never-array.rs:4:5 + | +LL | enum Helper { + | ------ +LL | T(T, [!; 0]), + | ^ not covered = note: the matched value is of type `Helper` help: you might want to use `if let` to ignore the variant that isn't matched | diff --git a/src/test/ui/error-codes/E0004-2.stderr b/src/test/ui/error-codes/E0004-2.stderr index 755f4d96e99..3dfa1fed48f 100644 --- a/src/test/ui/error-codes/E0004-2.stderr +++ b/src/test/ui/error-codes/E0004-2.stderr @@ -4,14 +4,20 @@ error[E0004]: non-exhaustive patterns: `None` and `Some(_)` not covered LL | match x { } | ^ patterns `None` and `Some(_)` not covered | - ::: $SRC_DIR/core/src/option.rs:LL:COL - | -LL | None, - | ---- not covered -... -LL | Some(#[stable(feature = "rust1", since = "1.0.0")] T), - | ---- not covered +note: `Option` defined here + --> $SRC_DIR/core/src/option.rs:LL:COL | +LL | / pub enum Option { +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` help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms | diff --git a/src/test/ui/error-codes/E0004.stderr b/src/test/ui/error-codes/E0004.stderr index 67f6abdbc54..98cc08adf7f 100644 --- a/src/test/ui/error-codes/E0004.stderr +++ b/src/test/ui/error-codes/E0004.stderr @@ -1,16 +1,16 @@ error[E0004]: non-exhaustive patterns: `HastaLaVistaBaby` not covered --> $DIR/E0004.rs:9:11 | -LL | / enum Terminator { -LL | | HastaLaVistaBaby, - | | ---------------- not covered -LL | | TalkToMyHand, -LL | | } - | |_- `Terminator` defined here -... -LL | match x { - | ^ pattern `HastaLaVistaBaby` not covered +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` help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms | diff --git a/src/test/ui/error-codes/E0005.stderr b/src/test/ui/error-codes/E0005.stderr index b95dcbd8935..208c625a53e 100644 --- a/src/test/ui/error-codes/E0005.stderr +++ b/src/test/ui/error-codes/E0005.stderr @@ -4,13 +4,21 @@ error[E0005]: refutable pattern in local binding: `None` not covered LL | let Some(y) = x; | ^^^^^^^ 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: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html +note: `Option` defined here + --> $SRC_DIR/core/src/option.rs:LL:COL + | +LL | / pub enum Option { +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` help: you might want to use `if let` to ignore the variant that isn't matched | diff --git a/src/test/ui/error-codes/E0297.stderr b/src/test/ui/error-codes/E0297.stderr index 957e79a9f39..95d95003c61 100644 --- a/src/test/ui/error-codes/E0297.stderr +++ b/src/test/ui/error-codes/E0297.stderr @@ -4,11 +4,19 @@ error[E0005]: refutable pattern in `for` loop binding: `None` not covered LL | for Some(x) in xs {} | ^^^^^^^ pattern `None` not covered | - ::: $SRC_DIR/core/src/option.rs:LL:COL - | -LL | None, - | ---- not covered +note: `Option` defined here + --> $SRC_DIR/core/src/option.rs:LL:COL | +LL | / pub enum Option { +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` error: aborting due to previous error diff --git a/src/test/ui/feature-gates/feature-gate-exhaustive-patterns.stderr b/src/test/ui/feature-gates/feature-gate-exhaustive-patterns.stderr index c5ffa55ebec..c2ffda6bb72 100644 --- a/src/test/ui/feature-gates/feature-gate-exhaustive-patterns.stderr +++ b/src/test/ui/feature-gates/feature-gate-exhaustive-patterns.stderr @@ -4,13 +4,20 @@ error[E0005]: refutable pattern in local binding: `Err(_)` not covered LL | let Ok(_x) = foo(); | ^^^^^^ 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: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html +note: `Result` defined here + --> $SRC_DIR/core/src/result.rs:LL:COL + | +LL | / pub enum Result { +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` help: you might want to use `if let` to ignore the variant that isn't matched | diff --git a/src/test/ui/match/match_non_exhaustive.stderr b/src/test/ui/match/match_non_exhaustive.stderr index 6103975df1e..52edb5b67a8 100644 --- a/src/test/ui/match/match_non_exhaustive.stderr +++ b/src/test/ui/match/match_non_exhaustive.stderr @@ -1,15 +1,14 @@ error[E0004]: non-exhaustive patterns: `B` not covered --> $DIR/match_non_exhaustive.rs:23:11 | -LL | enum L { A, B } - | --------------- - | | | - | | not covered - | `L` defined here -... LL | match l { L::A => () }; | ^ 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` 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 {}; | ^^ | +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 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 => () }; | ^^ 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 help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms | diff --git a/src/test/ui/pattern/usefulness/always-inhabited-union-ref.stderr b/src/test/ui/pattern/usefulness/always-inhabited-union-ref.stderr index c7d018f9d3b..4b24e11881a 100644 --- a/src/test/ui/pattern/usefulness/always-inhabited-union-ref.stderr +++ b/src/test/ui/pattern/usefulness/always-inhabited-union-ref.stderr @@ -16,14 +16,14 @@ LL + } error[E0004]: non-exhaustive patterns: type `Foo` is non-empty --> $DIR/always-inhabited-union-ref.rs:27:11 | -LL | / pub union Foo { -LL | | foo: !, -LL | | } - | |_- `Foo` defined here -... -LL | match uninhab_union() { - | ^^^^^^^^^^^^^^^ +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` help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms | diff --git a/src/test/ui/pattern/usefulness/doc-hidden-non-exhaustive.stderr b/src/test/ui/pattern/usefulness/doc-hidden-non-exhaustive.stderr index 6c56873ab2d..5a2c3c1447f 100644 --- a/src/test/ui/pattern/usefulness/doc-hidden-non-exhaustive.stderr +++ b/src/test/ui/pattern/usefulness/doc-hidden-non-exhaustive.stderr @@ -4,6 +4,16 @@ error[E0004]: non-exhaustive patterns: `_` not covered LL | match Foo::A { | ^^^^^^ 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` 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 { | ^^^^^^ pattern `B` not covered | - ::: $DIR/auxiliary/hidden.rs:3:5 - | -LL | B, - | - not covered +note: `Foo` defined here + --> $DIR/auxiliary/hidden.rs:3:5 | +LL | / pub enum Foo { +LL | | A, +LL | | B, + | | ^ not covered +LL | | #[doc(hidden)] +LL | | C, +LL | | } + | |_- = 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 | @@ -35,11 +51,17 @@ error[E0004]: non-exhaustive patterns: `B` and `_` not covered LL | match Foo::A { | ^^^^^^ patterns `B` and `_` not covered | - ::: $DIR/auxiliary/hidden.rs:3:5 - | -LL | B, - | - not covered +note: `Foo` defined here + --> $DIR/auxiliary/hidden.rs:3:5 | +LL | / pub enum Foo { +LL | | A, +LL | | B, + | | ^ not covered +LL | | #[doc(hidden)] +LL | | C, +LL | | } + | |_- = 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 | @@ -53,11 +75,18 @@ error[E0004]: non-exhaustive patterns: `Some(B)` and `Some(_)` not covered LL | match None { | ^^^^ patterns `Some(B)` and `Some(_)` not covered | - ::: $SRC_DIR/core/src/option.rs:LL:COL - | -LL | Some(#[stable(feature = "rust1", since = "1.0.0")] T), - | ---- not covered +note: `Option` defined here + --> $SRC_DIR/core/src/option.rs:LL:COL | +LL | / pub enum Option { +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` help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms | diff --git a/src/test/ui/pattern/usefulness/empty-match.exhaustive_patterns.stderr b/src/test/ui/pattern/usefulness/empty-match.exhaustive_patterns.stderr index 7235ef3fd90..f8976960adc 100644 --- a/src/test/ui/pattern/usefulness/empty-match.exhaustive_patterns.stderr +++ b/src/test/ui/pattern/usefulness/empty-match.exhaustive_patterns.stderr @@ -52,99 +52,104 @@ LL | match_no_arms!(0u8); error[E0004]: non-exhaustive patterns: type `NonEmptyStruct1` is non-empty --> $DIR/empty-match.rs:79:20 | -LL | struct NonEmptyStruct1; - | ----------------------- `NonEmptyStruct1` defined here -... 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` = 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 --> $DIR/empty-match.rs:80:20 | -LL | struct NonEmptyStruct2(bool); - | ----------------------------- `NonEmptyStruct2` defined here -... 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` = 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 --> $DIR/empty-match.rs:81:20 | -LL | / union NonEmptyUnion1 { -LL | | foo: (), -LL | | } - | |_- `NonEmptyUnion1` defined here -... -LL | match_no_arms!((NonEmptyUnion1 { foo: () })); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +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` = 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 --> $DIR/empty-match.rs:82:20 | -LL | / union NonEmptyUnion2 { -LL | | foo: (), -LL | | bar: (), -LL | | } - | |_- `NonEmptyUnion2` defined here -... -LL | match_no_arms!((NonEmptyUnion2 { foo: () })); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +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` = 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 --> $DIR/empty-match.rs:83:20 | -LL | / enum NonEmptyEnum1 { -LL | | Foo(bool), - | | --- not covered -LL | | } - | |_- `NonEmptyEnum1` defined here -... -LL | match_no_arms!(NonEmptyEnum1::Foo(true)); - | ^^^^^^^^^^^^^^^^^^^^^^^^ pattern `Foo(_)` not covered +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` = 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 --> $DIR/empty-match.rs:84:20 | -LL | / enum NonEmptyEnum2 { -LL | | Foo(bool), - | | --- not covered -LL | | Bar, - | | --- not covered -LL | | } - | |_- `NonEmptyEnum2` defined here -... -LL | match_no_arms!(NonEmptyEnum2::Foo(true)); - | ^^^^^^^^^^^^^^^^^^^^^^^^ patterns `Foo(_)` and `Bar` not covered +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` = 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 --> $DIR/empty-match.rs:85:20 | -LL | / enum NonEmptyEnum5 { -LL | | V1, V2, V3, V4, V5, -LL | | } - | |_- `NonEmptyEnum5` defined here -... -LL | match_no_arms!(NonEmptyEnum5::V1); - | ^^^^^^^^^^^^^^^^^ patterns `V1`, `V2`, `V3` and 2 more not covered +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` = 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 --> $DIR/empty-match.rs:88:24 | -LL | struct NonEmptyStruct1; - | ----------------------- `NonEmptyStruct1` defined here -... LL | match_guarded_arm!(NonEmptyStruct1); | ^^^^^^^^^^^^^^^ 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` 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 --> $DIR/empty-match.rs:89:24 | -LL | struct NonEmptyStruct2(bool); - | ----------------------------- `NonEmptyStruct2` defined here -... LL | match_guarded_arm!(NonEmptyStruct2(true)); | ^^^^^^^^^^^^^^^^^^^^^ 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` 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 --> $DIR/empty-match.rs:90:24 | -LL | / union NonEmptyUnion1 { -LL | | foo: (), -LL | | } - | |_- `NonEmptyUnion1` defined here -... -LL | match_guarded_arm!((NonEmptyUnion1 { foo: () })); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ pattern `NonEmptyUnion1 { .. }` not covered +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` 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 --> $DIR/empty-match.rs:91:24 | -LL | / union NonEmptyUnion2 { -LL | | foo: (), -LL | | bar: (), -LL | | } - | |_- `NonEmptyUnion2` defined here -... -LL | match_guarded_arm!((NonEmptyUnion2 { foo: () })); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ pattern `NonEmptyUnion2 { .. }` not covered +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` 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 --> $DIR/empty-match.rs:92:24 | -LL | / enum NonEmptyEnum1 { -LL | | Foo(bool), - | | --- not covered -LL | | } - | |_- `NonEmptyEnum1` defined here -... -LL | match_guarded_arm!(NonEmptyEnum1::Foo(true)); - | ^^^^^^^^^^^^^^^^^^^^^^^^ pattern `Foo(_)` not covered +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` 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 --> $DIR/empty-match.rs:93:24 | -LL | / enum NonEmptyEnum2 { -LL | | Foo(bool), - | | --- not covered -LL | | Bar, - | | --- not covered -LL | | } - | |_- `NonEmptyEnum2` defined here -... -LL | match_guarded_arm!(NonEmptyEnum2::Foo(true)); - | ^^^^^^^^^^^^^^^^^^^^^^^^ patterns `Foo(_)` and `Bar` not covered +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` 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 --> $DIR/empty-match.rs:94:24 | -LL | / enum NonEmptyEnum5 { -LL | | V1, V2, V3, V4, V5, -LL | | } - | |_- `NonEmptyEnum5` defined here -... -LL | match_guarded_arm!(NonEmptyEnum5::V1); - | ^^^^^^^^^^^^^^^^^ patterns `V1`, `V2`, `V3` and 2 more not covered +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` help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms | diff --git a/src/test/ui/pattern/usefulness/empty-match.normal.stderr b/src/test/ui/pattern/usefulness/empty-match.normal.stderr index 7235ef3fd90..f8976960adc 100644 --- a/src/test/ui/pattern/usefulness/empty-match.normal.stderr +++ b/src/test/ui/pattern/usefulness/empty-match.normal.stderr @@ -52,99 +52,104 @@ LL | match_no_arms!(0u8); error[E0004]: non-exhaustive patterns: type `NonEmptyStruct1` is non-empty --> $DIR/empty-match.rs:79:20 | -LL | struct NonEmptyStruct1; - | ----------------------- `NonEmptyStruct1` defined here -... 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` = 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 --> $DIR/empty-match.rs:80:20 | -LL | struct NonEmptyStruct2(bool); - | ----------------------------- `NonEmptyStruct2` defined here -... 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` = 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 --> $DIR/empty-match.rs:81:20 | -LL | / union NonEmptyUnion1 { -LL | | foo: (), -LL | | } - | |_- `NonEmptyUnion1` defined here -... -LL | match_no_arms!((NonEmptyUnion1 { foo: () })); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +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` = 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 --> $DIR/empty-match.rs:82:20 | -LL | / union NonEmptyUnion2 { -LL | | foo: (), -LL | | bar: (), -LL | | } - | |_- `NonEmptyUnion2` defined here -... -LL | match_no_arms!((NonEmptyUnion2 { foo: () })); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +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` = 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 --> $DIR/empty-match.rs:83:20 | -LL | / enum NonEmptyEnum1 { -LL | | Foo(bool), - | | --- not covered -LL | | } - | |_- `NonEmptyEnum1` defined here -... -LL | match_no_arms!(NonEmptyEnum1::Foo(true)); - | ^^^^^^^^^^^^^^^^^^^^^^^^ pattern `Foo(_)` not covered +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` = 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 --> $DIR/empty-match.rs:84:20 | -LL | / enum NonEmptyEnum2 { -LL | | Foo(bool), - | | --- not covered -LL | | Bar, - | | --- not covered -LL | | } - | |_- `NonEmptyEnum2` defined here -... -LL | match_no_arms!(NonEmptyEnum2::Foo(true)); - | ^^^^^^^^^^^^^^^^^^^^^^^^ patterns `Foo(_)` and `Bar` not covered +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` = 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 --> $DIR/empty-match.rs:85:20 | -LL | / enum NonEmptyEnum5 { -LL | | V1, V2, V3, V4, V5, -LL | | } - | |_- `NonEmptyEnum5` defined here -... -LL | match_no_arms!(NonEmptyEnum5::V1); - | ^^^^^^^^^^^^^^^^^ patterns `V1`, `V2`, `V3` and 2 more not covered +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` = 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 --> $DIR/empty-match.rs:88:24 | -LL | struct NonEmptyStruct1; - | ----------------------- `NonEmptyStruct1` defined here -... LL | match_guarded_arm!(NonEmptyStruct1); | ^^^^^^^^^^^^^^^ 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` 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 --> $DIR/empty-match.rs:89:24 | -LL | struct NonEmptyStruct2(bool); - | ----------------------------- `NonEmptyStruct2` defined here -... LL | match_guarded_arm!(NonEmptyStruct2(true)); | ^^^^^^^^^^^^^^^^^^^^^ 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` 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 --> $DIR/empty-match.rs:90:24 | -LL | / union NonEmptyUnion1 { -LL | | foo: (), -LL | | } - | |_- `NonEmptyUnion1` defined here -... -LL | match_guarded_arm!((NonEmptyUnion1 { foo: () })); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ pattern `NonEmptyUnion1 { .. }` not covered +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` 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 --> $DIR/empty-match.rs:91:24 | -LL | / union NonEmptyUnion2 { -LL | | foo: (), -LL | | bar: (), -LL | | } - | |_- `NonEmptyUnion2` defined here -... -LL | match_guarded_arm!((NonEmptyUnion2 { foo: () })); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ pattern `NonEmptyUnion2 { .. }` not covered +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` 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 --> $DIR/empty-match.rs:92:24 | -LL | / enum NonEmptyEnum1 { -LL | | Foo(bool), - | | --- not covered -LL | | } - | |_- `NonEmptyEnum1` defined here -... -LL | match_guarded_arm!(NonEmptyEnum1::Foo(true)); - | ^^^^^^^^^^^^^^^^^^^^^^^^ pattern `Foo(_)` not covered +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` 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 --> $DIR/empty-match.rs:93:24 | -LL | / enum NonEmptyEnum2 { -LL | | Foo(bool), - | | --- not covered -LL | | Bar, - | | --- not covered -LL | | } - | |_- `NonEmptyEnum2` defined here -... -LL | match_guarded_arm!(NonEmptyEnum2::Foo(true)); - | ^^^^^^^^^^^^^^^^^^^^^^^^ patterns `Foo(_)` and `Bar` not covered +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` 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 --> $DIR/empty-match.rs:94:24 | -LL | / enum NonEmptyEnum5 { -LL | | V1, V2, V3, V4, V5, -LL | | } - | |_- `NonEmptyEnum5` defined here -... -LL | match_guarded_arm!(NonEmptyEnum5::V1); - | ^^^^^^^^^^^^^^^^^ patterns `V1`, `V2`, `V3` and 2 more not covered +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` help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms | diff --git a/src/test/ui/pattern/usefulness/issue-31561.stderr b/src/test/ui/pattern/usefulness/issue-31561.stderr index 2f562b23692..dffcfc01607 100644 --- a/src/test/ui/pattern/usefulness/issue-31561.stderr +++ b/src/test/ui/pattern/usefulness/issue-31561.stderr @@ -1,20 +1,21 @@ error[E0005]: refutable pattern in local binding: `Bar` and `Baz` not covered --> $DIR/issue-31561.rs:8:9 | -LL | / enum Thing { -LL | | Foo(u8), -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 +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: 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` help: you might want to use `if let` to ignore the variant that isn't matched | diff --git a/src/test/ui/pattern/usefulness/issue-35609.stderr b/src/test/ui/pattern/usefulness/issue-35609.stderr index 3c2d351fe8b..e5248ab985d 100644 --- a/src/test/ui/pattern/usefulness/issue-35609.stderr +++ b/src/test/ui/pattern/usefulness/issue-35609.stderr @@ -66,12 +66,14 @@ LL + _ => todo!() error[E0004]: non-exhaustive patterns: `S(B, _)`, `S(C, _)`, `S(D, _)` and 2 more not covered --> $DIR/issue-35609.rs:31:11 | -LL | struct S(Enum, ()); - | ------------------- `S` defined here -... LL | match S(A, ()) { | ^^^^^^^^ 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` 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 --> $DIR/issue-35609.rs:35:11 | -LL | struct Sd { x: Enum, y: () } - | ---------------------------- `Sd` defined here -... LL | match (Sd { x: A, y: () }) { | ^^^^^^^^^^^^^^^^^^^^ 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` 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) { | ^^^^^^^ patterns `Some(B)`, `Some(C)`, `Some(D)` and 2 more not covered | +note: `Option` defined here + --> $SRC_DIR/core/src/option.rs:LL:COL + | +LL | / pub enum Option { +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` help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms | diff --git a/src/test/ui/pattern/usefulness/issue-3601.stderr b/src/test/ui/pattern/usefulness/issue-3601.stderr index e69f1dcc253..84916504220 100644 --- a/src/test/ui/pattern/usefulness/issue-3601.stderr +++ b/src/test/ui/pattern/usefulness/issue-3601.stderr @@ -4,6 +4,14 @@ error[E0004]: non-exhaustive patterns: `box _` not covered LL | box NodeKind::Element(ed) => match ed.kind { | ^^^^^^^ pattern `box _` not covered | +note: `Box` 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, A); + | |________________^ = note: the matched value is of type `Box` help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms | diff --git a/src/test/ui/pattern/usefulness/issue-39362.stderr b/src/test/ui/pattern/usefulness/issue-39362.stderr index 55794faf243..f0f93af216a 100644 --- a/src/test/ui/pattern/usefulness/issue-39362.stderr +++ b/src/test/ui/pattern/usefulness/issue-39362.stderr @@ -1,14 +1,16 @@ 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 | -LL | / enum Foo { -LL | | Bar { bar: Bar, id: usize } -LL | | } - | |_- `Foo` defined here -... -LL | match f { - | ^ patterns `Bar { bar: C, .. }`, `Bar { bar: D, .. }`, `Bar { bar: E, .. }` and 1 more not covered +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` help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms | diff --git a/src/test/ui/pattern/usefulness/issue-40221.stderr b/src/test/ui/pattern/usefulness/issue-40221.stderr index 6e450a72d75..ca2ac71b1e4 100644 --- a/src/test/ui/pattern/usefulness/issue-40221.stderr +++ b/src/test/ui/pattern/usefulness/issue-40221.stderr @@ -1,15 +1,16 @@ error[E0004]: non-exhaustive patterns: `C(QA)` not covered --> $DIR/issue-40221.rs:11:11 | -LL | / enum P { -LL | | C(PC), - | | - not covered -LL | | } - | |_- `P` defined here -... -LL | match proto { - | ^^^^^ pattern `C(QA)` not covered +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` help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms | diff --git a/src/test/ui/pattern/usefulness/issue-50900.stderr b/src/test/ui/pattern/usefulness/issue-50900.stderr index 8612607fa8b..6d437de8cea 100644 --- a/src/test/ui/pattern/usefulness/issue-50900.stderr +++ b/src/test/ui/pattern/usefulness/issue-50900.stderr @@ -1,12 +1,14 @@ error[E0004]: non-exhaustive patterns: `Tag(Exif, _)` not covered --> $DIR/issue-50900.rs:15:11 | -LL | pub struct Tag(pub Context, pub u16); - | ------------------------------------- `Tag` defined here -... LL | match Tag::ExifIFDPointer { | ^^^^^^^^^^^^^^^^^^^ 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` help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms | diff --git a/src/test/ui/pattern/usefulness/issue-56379.stderr b/src/test/ui/pattern/usefulness/issue-56379.stderr index 02a5ff2a37a..9d0ba0564a1 100644 --- a/src/test/ui/pattern/usefulness/issue-56379.stderr +++ b/src/test/ui/pattern/usefulness/issue-56379.stderr @@ -1,19 +1,20 @@ error[E0004]: non-exhaustive patterns: `A(false)`, `B(false)` and `C(false)` not covered --> $DIR/issue-56379.rs:8:11 | -LL | / enum Foo { -LL | | A(bool), - | | - 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 +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` help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms | diff --git a/src/test/ui/pattern/usefulness/issue-78123-non-exhaustive-reference.rs b/src/test/ui/pattern/usefulness/issue-78123-non-exhaustive-reference.rs index 6c5a331b4b5..cbfcf0eafd4 100644 --- a/src/test/ui/pattern/usefulness/issue-78123-non-exhaustive-reference.rs +++ b/src/test/ui/pattern/usefulness/issue-78123-non-exhaustive-reference.rs @@ -1,5 +1,6 @@ enum A {} //~^ NOTE `A` defined here + //~| NOTE fn f(a: &A) { match a {} diff --git a/src/test/ui/pattern/usefulness/issue-78123-non-exhaustive-reference.stderr b/src/test/ui/pattern/usefulness/issue-78123-non-exhaustive-reference.stderr index 01e3d4df331..5b080b14849 100644 --- a/src/test/ui/pattern/usefulness/issue-78123-non-exhaustive-reference.stderr +++ b/src/test/ui/pattern/usefulness/issue-78123-non-exhaustive-reference.stderr @@ -1,12 +1,14 @@ 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 {} | ^ | +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: references are always considered inhabited help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms diff --git a/src/test/ui/pattern/usefulness/match-arm-statics-2.stderr b/src/test/ui/pattern/usefulness/match-arm-statics-2.stderr index 65fdb1b54f4..892030c72ea 100644 --- a/src/test/ui/pattern/usefulness/match-arm-statics-2.stderr +++ b/src/test/ui/pattern/usefulness/match-arm-statics-2.stderr @@ -17,14 +17,21 @@ error[E0004]: non-exhaustive patterns: `Some(Some(West))` not covered LL | match Some(Some(North)) { | ^^^^^^^^^^^^^^^^^ pattern `Some(Some(West))` not covered | - ::: $SRC_DIR/core/src/option.rs:LL:COL - | -LL | Some(#[stable(feature = "rust1", since = "1.0.0")] T), - | ---- - | | - | not covered - | not covered +note: `Option>` defined here + --> $SRC_DIR/core/src/option.rs:LL:COL | +LL | / pub enum Option { +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>` 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 --> $DIR/match-arm-statics-2.rs:48:11 | -LL | / struct Foo { -LL | | bar: Option, -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 +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` help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms | diff --git a/src/test/ui/pattern/usefulness/match-privately-empty.stderr b/src/test/ui/pattern/usefulness/match-privately-empty.stderr index 3b1a7e184ba..8f8e87adb7a 100644 --- a/src/test/ui/pattern/usefulness/match-privately-empty.stderr +++ b/src/test/ui/pattern/usefulness/match-privately-empty.stderr @@ -4,11 +4,18 @@ error[E0004]: non-exhaustive patterns: `Some(Private { misc: true, .. })` not co LL | match private::DATA { | ^^^^^^^^^^^^^ pattern `Some(Private { misc: true, .. })` not covered | - ::: $SRC_DIR/core/src/option.rs:LL:COL - | -LL | Some(#[stable(feature = "rust1", since = "1.0.0")] T), - | ---- not covered +note: `Option` defined here + --> $SRC_DIR/core/src/option.rs:LL:COL | +LL | / pub enum Option { +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` help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms | diff --git a/src/test/ui/pattern/usefulness/non-exhaustive-defined-here.rs b/src/test/ui/pattern/usefulness/non-exhaustive-defined-here.rs index 6f009acbdfe..2e15bc2d2a5 100644 --- a/src/test/ui/pattern/usefulness/non-exhaustive-defined-here.rs +++ b/src/test/ui/pattern/usefulness/non-exhaustive-defined-here.rs @@ -4,20 +4,26 @@ #[derive(Clone)] enum E { -//~^ `E` defined here -//~| `E` defined here -//~| `E` defined here -//~| `E` defined here -//~| `E` defined here -//~| `E` defined here + //~^ NOTE + //~| NOTE + //~| NOTE + //~| NOTE + //~| NOTE + //~| NOTE A, B, - //~^ not covered - //~| not covered - //~| not covered - //~| not covered - //~| not covered - //~| not covered + //~^ NOTE `E` defined here + //~| NOTE `E` defined here + //~| NOTE `E` defined here + //~| NOTE `E` defined here + //~| NOTE `E` defined here + //~| NOTE `E` defined here + //~| NOTE not covered + //~| NOTE not covered + //~| NOTE not covered + //~| NOTE not covered + //~| NOTE not covered + //~| NOTE not covered C //~^ not covered //~| not covered @@ -30,43 +36,70 @@ enum E { fn by_val(e: E) { let e1 = e.clone(); 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 => {} } 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) { 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 => {} } 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) { 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 => {} } let E::A = e; //~^ 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 { -//~^ `Opt` defined here -//~| `Opt` defined here + //~^ NOTE + //~| NOTE Some(u8), None, - //~^ not covered + //~^ NOTE `Opt` defined here + //~| NOTE `Opt` defined here + //~| NOTE not covered + //~| NOTE not covered } fn ref_pat(e: Opt) { 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) => {} } 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() {} diff --git a/src/test/ui/pattern/usefulness/non-exhaustive-defined-here.stderr b/src/test/ui/pattern/usefulness/non-exhaustive-defined-here.stderr index 275b0d3ec24..9a2029cc257 100644 --- a/src/test/ui/pattern/usefulness/non-exhaustive-defined-here.stderr +++ b/src/test/ui/pattern/usefulness/non-exhaustive-defined-here.stderr @@ -1,24 +1,20 @@ 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 | | -LL | | -LL | | -... | -LL | | B, - | | - not covered -... | -LL | | C - | | - not covered -... | -LL | | -LL | | } - | |_- `E` defined here +LL | match e1 { + | ^^ patterns `B` and `C` not covered + | +note: `E` defined here + --> $DIR/non-exhaustive-defined-here.rs:14:5 + | +LL | enum E { + | - ... -LL | match e1 { - | ^^ patterns `B` and `C` not covered - | +LL | B, + | ^ not covered +... +LL | C + | ^ not covered = 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 | @@ -27,28 +23,24 @@ LL + B | C => todo!() | 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 | | -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 +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: 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` 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 - --> $DIR/non-exhaustive-defined-here.rs:40:11 + --> $DIR/non-exhaustive-defined-here.rs:52:11 | -LL | / enum E { -LL | | -LL | | -LL | | -... | -LL | | B, - | | - not covered -... | -LL | | C - | | - not covered -... | -LL | | -LL | | } - | |_- `E` defined here +LL | match e { + | ^ patterns `&B` and `&C` not covered + | +note: `E` defined here + --> $DIR/non-exhaustive-defined-here.rs:14:5 + | +LL | enum E { + | - ... -LL | match e { - | ^ patterns `&B` and `&C` not covered - | +LL | B, + | ^ not covered +... +LL | C + | ^ not covered = 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 | @@ -84,28 +72,24 @@ LL + &B | &C => todo!() | 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 | | -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 +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: 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` 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 - --> $DIR/non-exhaustive-defined-here.rs:48:11 + --> $DIR/non-exhaustive-defined-here.rs:66:11 | -LL | / enum E { -LL | | -LL | | -LL | | -... | -LL | | B, - | | - not covered -... | -LL | | C - | | - not covered -... | -LL | | -LL | | } - | |_- `E` defined here +LL | match e { + | ^ patterns `&&mut &B` and `&&mut &C` not covered + | +note: `E` defined here + --> $DIR/non-exhaustive-defined-here.rs:14:5 + | +LL | enum E { + | - ... -LL | match e { - | ^ patterns `&&mut &B` and `&&mut &C` not covered - | +LL | B, + | ^ not covered +... +LL | C + | ^ not covered = 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 | @@ -141,28 +121,24 @@ LL + &&mut &B | &&mut &C => todo!() | 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 | | -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 +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: 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` 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 - --> $DIR/non-exhaustive-defined-here.rs:65:11 + --> $DIR/non-exhaustive-defined-here.rs:92:11 | -LL | / enum Opt { -LL | | -LL | | -LL | | Some(u8), -LL | | None, - | | ---- not covered -LL | | -LL | | } - | |_- `Opt` defined here +LL | match e { + | ^ pattern `None` not covered + | +note: `Opt` defined here + --> $DIR/non-exhaustive-defined-here.rs:84:5 + | +LL | enum Opt { + | --- ... -LL | match e { - | ^ pattern `None` not covered - | +LL | None, + | ^^^^ not covered = 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 | @@ -193,23 +167,21 @@ LL + None => todo!() | 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 | | -LL | | -LL | | Some(u8), -LL | | None, - | | ---- not covered -LL | | -LL | | } - | |_- `Opt` defined here -... -LL | let Opt::Some(ref _x) = e; - | ^^^^^^^^^^^^^^^^^ pattern `None` not covered +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: 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` help: you might want to use `if let` to ignore the variant that isn't matched | diff --git a/src/test/ui/pattern/usefulness/non-exhaustive-match-nested.stderr b/src/test/ui/pattern/usefulness/non-exhaustive-match-nested.stderr index e38e12220e3..312b9ad89cc 100644 --- a/src/test/ui/pattern/usefulness/non-exhaustive-match-nested.stderr +++ b/src/test/ui/pattern/usefulness/non-exhaustive-match-nested.stderr @@ -14,15 +14,14 @@ LL + (Some(&[]), Err(_)) => todo!() error[E0004]: non-exhaustive patterns: `A(C)` not covered --> $DIR/non-exhaustive-match-nested.rs:15:11 | -LL | enum T { A(U), B } - | ------------------ - | | | - | | not covered - | `T` defined here -... LL | match x { | ^ 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` help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms | diff --git a/src/test/ui/pattern/usefulness/non-exhaustive-match.stderr b/src/test/ui/pattern/usefulness/non-exhaustive-match.stderr index 136c653e35d..15e967ae4da 100644 --- a/src/test/ui/pattern/usefulness/non-exhaustive-match.stderr +++ b/src/test/ui/pattern/usefulness/non-exhaustive-match.stderr @@ -1,15 +1,14 @@ error[E0004]: non-exhaustive patterns: `A` not covered --> $DIR/non-exhaustive-match.rs:7:11 | -LL | enum T { A, B } - | --------------- - | | | - | | not covered - | `T` defined here -... LL | match x { T::B => { } } | ^ 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` 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) { | ^^^^^^^^ pattern `Some(_)` not covered | - ::: $SRC_DIR/core/src/option.rs:LL:COL - | -LL | Some(#[stable(feature = "rust1", since = "1.0.0")] T), - | ---- not covered +note: `Option` defined here + --> $SRC_DIR/core/src/option.rs:LL:COL | +LL | / pub enum Option { +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` 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 --> $DIR/non-exhaustive-match.rs:22:11 | -LL | enum T { A, B } - | --------------- - | | | - | | not covered - | `T` defined here -... LL | match T::A { | ^^^^ 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` help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms | diff --git a/src/test/ui/pattern/usefulness/non-exhaustive-pattern-witness.stderr b/src/test/ui/pattern/usefulness/non-exhaustive-pattern-witness.stderr index cb41ee06b15..8883829aadf 100644 --- a/src/test/ui/pattern/usefulness/non-exhaustive-pattern-witness.stderr +++ b/src/test/ui/pattern/usefulness/non-exhaustive-pattern-witness.stderr @@ -1,15 +1,14 @@ error[E0004]: non-exhaustive patterns: `Foo { first: false, second: Some([_, _, _, _]) }` not covered --> $DIR/non-exhaustive-pattern-witness.rs:7:11 | -LL | / struct Foo { -LL | | first: bool, -LL | | second: Option<[usize; 4]> -LL | | } - | |_- `Foo` defined here -... -LL | match (Foo { first: true, second: None }) { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ pattern `Foo { first: false, second: Some([_, _, _, _]) }` not covered +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` 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 --> $DIR/non-exhaustive-pattern-witness.rs:23:11 | -LL | / enum Color { -LL | | Red, - | | --- 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 +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` 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 --> $DIR/non-exhaustive-pattern-witness.rs:35:11 | -LL | / enum Direction { -LL | | North, East, South, West - | | ---- ----- ---- not covered - | | | | - | | | not covered - | | not covered -LL | | } - | |_- `Direction` defined here -... -LL | match Direction::North { - | ^^^^^^^^^^^^^^^^ patterns `East`, `South` and `West` not covered +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` 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 --> $DIR/non-exhaustive-pattern-witness.rs:46:11 | -LL | / enum ExcessiveEnum { -LL | | First, Second, Third, Fourth, Fifth, Sixth, Seventh, Eighth, Ninth, Tenth, Eleventh, Twelfth -LL | | } - | |_- `ExcessiveEnum` defined here -... -LL | match ExcessiveEnum::First { - | ^^^^^^^^^^^^^^^^^^^^ patterns `Second`, `Third`, `Fourth` and 8 more not covered +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` 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 --> $DIR/non-exhaustive-pattern-witness.rs:54:11 | -LL | / enum Color { -LL | | Red, -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 +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` help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms | diff --git a/src/test/ui/pattern/usefulness/stable-gated-patterns.stderr b/src/test/ui/pattern/usefulness/stable-gated-patterns.stderr index a556094c370..5956c6b6615 100644 --- a/src/test/ui/pattern/usefulness/stable-gated-patterns.stderr +++ b/src/test/ui/pattern/usefulness/stable-gated-patterns.stderr @@ -4,11 +4,19 @@ error[E0004]: non-exhaustive patterns: `Stable2` and `_` not covered LL | match Foo::Stable { | ^^^^^^^^^^^ patterns `Stable2` and `_` not covered | - ::: $DIR/auxiliary/unstable.rs:9:5 - | -LL | Stable2, - | ------- not covered +note: `Foo` defined here + --> $DIR/auxiliary/unstable.rs:9:5 | +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` 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 { | ^^^^^^^^^^^ 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` help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms | diff --git a/src/test/ui/pattern/usefulness/struct-like-enum-nonexhaustive.stderr b/src/test/ui/pattern/usefulness/struct-like-enum-nonexhaustive.stderr index 02009ea3eed..596fb13e92b 100644 --- a/src/test/ui/pattern/usefulness/struct-like-enum-nonexhaustive.stderr +++ b/src/test/ui/pattern/usefulness/struct-like-enum-nonexhaustive.stderr @@ -1,16 +1,16 @@ error[E0004]: non-exhaustive patterns: `B { x: Some(_) }` not covered --> $DIR/struct-like-enum-nonexhaustive.rs:8:11 | -LL | / enum A { -LL | | B { x: Option }, - | | - not covered -LL | | C -LL | | } - | |_- `A` defined here -... -LL | match x { - | ^ pattern `B { x: Some(_) }` not covered +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 }, + | ^ not covered = 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 | diff --git a/src/test/ui/pattern/usefulness/tuple-struct-nonexhaustive.stderr b/src/test/ui/pattern/usefulness/tuple-struct-nonexhaustive.stderr index 455760d2249..a1b233d3f98 100644 --- a/src/test/ui/pattern/usefulness/tuple-struct-nonexhaustive.stderr +++ b/src/test/ui/pattern/usefulness/tuple-struct-nonexhaustive.stderr @@ -1,12 +1,14 @@ error[E0004]: non-exhaustive patterns: `Foo(_, _)` not covered --> $DIR/tuple-struct-nonexhaustive.rs:5:11 | -LL | struct Foo(isize, isize); - | ------------------------- `Foo` defined here -... LL | match x { | ^ 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` help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms | diff --git a/src/test/ui/pattern/usefulness/unstable-gated-patterns.stderr b/src/test/ui/pattern/usefulness/unstable-gated-patterns.stderr index a0717c5e0bf..3f987fc2ef5 100644 --- a/src/test/ui/pattern/usefulness/unstable-gated-patterns.stderr +++ b/src/test/ui/pattern/usefulness/unstable-gated-patterns.stderr @@ -4,11 +4,18 @@ error[E0004]: non-exhaustive patterns: `Unstable` not covered LL | match Foo::Stable { | ^^^^^^^^^^^ pattern `Unstable` not covered | - ::: $DIR/auxiliary/unstable.rs:11:5 - | -LL | Unstable, - | -------- not covered +note: `Foo` defined here + --> $DIR/auxiliary/unstable.rs:11:5 | +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` help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms | diff --git a/src/test/ui/recursion/recursive-types-are-not-uninhabited.stderr b/src/test/ui/recursion/recursive-types-are-not-uninhabited.stderr index f904a0ecd11..ded3cf3ad1d 100644 --- a/src/test/ui/recursion/recursive-types-are-not-uninhabited.stderr +++ b/src/test/ui/recursion/recursive-types-are-not-uninhabited.stderr @@ -4,13 +4,20 @@ error[E0005]: refutable pattern in local binding: `Err(_)` not covered LL | let Ok(x) = res; | ^^^^^ 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: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html +note: `Result` defined here + --> $SRC_DIR/core/src/result.rs:LL:COL + | +LL | / pub enum Result { +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` help: you might want to use `if let` to ignore the variant that isn't matched | diff --git a/src/test/ui/rfc-2008-non-exhaustive/enum.stderr b/src/test/ui/rfc-2008-non-exhaustive/enum.stderr index c8e27d5e358..8809f13079c 100644 --- a/src/test/ui/rfc-2008-non-exhaustive/enum.stderr +++ b/src/test/ui/rfc-2008-non-exhaustive/enum.stderr @@ -4,6 +4,11 @@ error[E0004]: non-exhaustive patterns: type `EmptyNonExhaustiveEnum` is non-empt 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 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 { | ^^^^^^^^^ 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 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 {}; | ^^^^^^^^^ 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 help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms | diff --git a/src/test/ui/rfc-2008-non-exhaustive/enum_same_crate_empty_match.stderr b/src/test/ui/rfc-2008-non-exhaustive/enum_same_crate_empty_match.stderr index 8f17e3e3f42..6da7950a7a0 100644 --- a/src/test/ui/rfc-2008-non-exhaustive/enum_same_crate_empty_match.stderr +++ b/src/test/ui/rfc-2008-non-exhaustive/enum_same_crate_empty_match.stderr @@ -13,22 +13,22 @@ LL | #![deny(unreachable_patterns)] error[E0004]: non-exhaustive patterns: `Unit`, `Tuple(_)` and `Struct { .. }` not covered --> $DIR/enum_same_crate_empty_match.rs:33:11 | -LL | / pub enum NonExhaustiveEnum { -LL | | Unit, - | | ---- 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 +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` 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 --> $DIR/enum_same_crate_empty_match.rs:35:11 | -LL | / pub enum NormalEnum { -LL | | Unit, - | | ---- 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 +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` help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms | diff --git a/src/test/ui/rfc-2008-non-exhaustive/uninhabited/indirect_match.stderr b/src/test/ui/rfc-2008-non-exhaustive/uninhabited/indirect_match.stderr index 9bd1c487c43..ed9f3cf1982 100644 --- a/src/test/ui/rfc-2008-non-exhaustive/uninhabited/indirect_match.stderr +++ b/src/test/ui/rfc-2008-non-exhaustive/uninhabited/indirect_match.stderr @@ -4,6 +4,11 @@ error[E0004]: non-exhaustive patterns: type `IndirectUninhabitedEnum` is non-emp 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` 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 {} | ^ | +note: `IndirectUninhabitedStruct` defined here + --> $DIR/auxiliary/uninhabited.rs:28:1 + | +LL | pub struct IndirectUninhabitedStruct(UninhabitedStruct); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = 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 | @@ -32,6 +42,11 @@ error[E0004]: non-exhaustive patterns: type `IndirectUninhabitedTupleStruct` is 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` 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 {} | ^ | +note: `IndirectUninhabitedVariants` defined here + --> $DIR/auxiliary/uninhabited.rs:32:1 + | +LL | pub struct IndirectUninhabitedVariants(UninhabitedVariants); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = 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 | diff --git a/src/test/ui/rfc-2008-non-exhaustive/uninhabited/indirect_match_same_crate.stderr b/src/test/ui/rfc-2008-non-exhaustive/uninhabited/indirect_match_same_crate.stderr index 15ed37b22cb..f8751c89e14 100644 --- a/src/test/ui/rfc-2008-non-exhaustive/uninhabited/indirect_match_same_crate.stderr +++ b/src/test/ui/rfc-2008-non-exhaustive/uninhabited/indirect_match_same_crate.stderr @@ -1,12 +1,14 @@ error[E0004]: non-exhaustive patterns: type `IndirectUninhabitedEnum` is non-empty --> $DIR/indirect_match_same_crate.rs:34:11 | -LL | pub struct IndirectUninhabitedEnum(UninhabitedEnum); - | ---------------------------------------------------- `IndirectUninhabitedEnum` defined here -... 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` 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 --> $DIR/indirect_match_same_crate.rs:38:11 | -LL | pub struct IndirectUninhabitedStruct(UninhabitedStruct); - | -------------------------------------------------------- `IndirectUninhabitedStruct` defined here -... 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` 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 --> $DIR/indirect_match_same_crate.rs:42:11 | -LL | pub struct IndirectUninhabitedTupleStruct(UninhabitedTupleStruct); - | ------------------------------------------------------------------ `IndirectUninhabitedTupleStruct` defined here -... 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` 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 --> $DIR/indirect_match_same_crate.rs:48:11 | -LL | pub struct IndirectUninhabitedVariants(UninhabitedVariants); - | ------------------------------------------------------------ `IndirectUninhabitedVariants` defined here -... 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` help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms | diff --git a/src/test/ui/rfc-2008-non-exhaustive/uninhabited/indirect_match_with_exhaustive_patterns.stderr b/src/test/ui/rfc-2008-non-exhaustive/uninhabited/indirect_match_with_exhaustive_patterns.stderr index c653666e46a..828f57cad0f 100644 --- a/src/test/ui/rfc-2008-non-exhaustive/uninhabited/indirect_match_with_exhaustive_patterns.stderr +++ b/src/test/ui/rfc-2008-non-exhaustive/uninhabited/indirect_match_with_exhaustive_patterns.stderr @@ -4,6 +4,11 @@ error[E0004]: non-exhaustive patterns: type `IndirectUninhabitedEnum` is non-emp 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` 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 {} | ^ | +note: `IndirectUninhabitedStruct` defined here + --> $DIR/auxiliary/uninhabited.rs:28:1 + | +LL | pub struct IndirectUninhabitedStruct(UninhabitedStruct); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = 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 | @@ -32,6 +42,11 @@ error[E0004]: non-exhaustive patterns: type `IndirectUninhabitedTupleStruct` is 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` 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 {} | ^ | +note: `IndirectUninhabitedVariants` defined here + --> $DIR/auxiliary/uninhabited.rs:32:1 + | +LL | pub struct IndirectUninhabitedVariants(UninhabitedVariants); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = 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 | diff --git a/src/test/ui/rfc-2008-non-exhaustive/uninhabited/match.stderr b/src/test/ui/rfc-2008-non-exhaustive/uninhabited/match.stderr index 320e75c5ebb..82760df19d6 100644 --- a/src/test/ui/rfc-2008-non-exhaustive/uninhabited/match.stderr +++ b/src/test/ui/rfc-2008-non-exhaustive/uninhabited/match.stderr @@ -4,6 +4,12 @@ error[E0004]: non-exhaustive patterns: type `UninhabitedEnum` is non-empty 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 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 {} | ^ | +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` 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 {} | ^ | +note: `UninhabitedTupleStruct` defined here + --> $DIR/auxiliary/uninhabited.rs:14:1 + | +LL | pub struct 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 | @@ -46,13 +64,16 @@ error[E0004]: non-exhaustive patterns: `Tuple(_)` and `Struct { .. }` not covere LL | match x {} | ^ patterns `Tuple(_)` and `Struct { .. }` not covered | - ::: $DIR/auxiliary/uninhabited.rs:17:23 - | -LL | #[non_exhaustive] Tuple(!), - | ----- not covered -LL | #[non_exhaustive] Struct { x: ! } - | ------ not covered +note: `UninhabitedVariants` defined here + --> $DIR/auxiliary/uninhabited.rs:17:23 | +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` help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms | diff --git a/src/test/ui/rfc-2008-non-exhaustive/uninhabited/match_same_crate.stderr b/src/test/ui/rfc-2008-non-exhaustive/uninhabited/match_same_crate.stderr index a08579cbc3c..4aea7da6b38 100644 --- a/src/test/ui/rfc-2008-non-exhaustive/uninhabited/match_same_crate.stderr +++ b/src/test/ui/rfc-2008-non-exhaustive/uninhabited/match_same_crate.stderr @@ -1,14 +1,14 @@ error[E0004]: non-exhaustive patterns: type `UninhabitedStruct` is non-empty --> $DIR/match_same_crate.rs:30:11 | -LL | / pub struct UninhabitedStruct { -LL | | _priv: !, -LL | | } - | |_- `UninhabitedStruct` defined here -... -LL | match x {} - | ^ +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` 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 --> $DIR/match_same_crate.rs:34:11 | -LL | pub struct UninhabitedTupleStruct(!); - | ------------------------------------- `UninhabitedTupleStruct` defined here -... 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` 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 --> $DIR/match_same_crate.rs:38:11 | -LL | / pub enum UninhabitedVariants { -LL | | #[non_exhaustive] Tuple(!), - | | ----- not covered -LL | | #[non_exhaustive] Struct { x: ! } - | | ------ not covered -LL | | } - | |_- `UninhabitedVariants` defined here -... -LL | match x {} - | ^ patterns `Tuple(_)` and `Struct { .. }` not covered +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` help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms | diff --git a/src/test/ui/rfc-2008-non-exhaustive/uninhabited/match_with_exhaustive_patterns.stderr b/src/test/ui/rfc-2008-non-exhaustive/uninhabited/match_with_exhaustive_patterns.stderr index 01f7fb97048..7414cd8a058 100644 --- a/src/test/ui/rfc-2008-non-exhaustive/uninhabited/match_with_exhaustive_patterns.stderr +++ b/src/test/ui/rfc-2008-non-exhaustive/uninhabited/match_with_exhaustive_patterns.stderr @@ -4,6 +4,12 @@ error[E0004]: non-exhaustive patterns: type `UninhabitedEnum` is non-empty 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 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 {} | ^ | +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` 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 {} | ^ | +note: `UninhabitedTupleStruct` defined here + --> $DIR/auxiliary/uninhabited.rs:14:1 + | +LL | pub struct 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 | @@ -46,13 +64,16 @@ error[E0004]: non-exhaustive patterns: `Tuple(_)` and `Struct { .. }` not covere LL | match x {} | ^ patterns `Tuple(_)` and `Struct { .. }` not covered | - ::: $DIR/auxiliary/uninhabited.rs:17:23 - | -LL | #[non_exhaustive] Tuple(!), - | ----- not covered -LL | #[non_exhaustive] Struct { x: ! } - | ------ not covered +note: `UninhabitedVariants` defined here + --> $DIR/auxiliary/uninhabited.rs:17:23 | +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` help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms | diff --git a/src/test/ui/uninhabited/uninhabited-irrefutable.stderr b/src/test/ui/uninhabited/uninhabited-irrefutable.stderr index 3cb99556748..ad19c34a40a 100644 --- a/src/test/ui/uninhabited/uninhabited-irrefutable.stderr +++ b/src/test/ui/uninhabited/uninhabited-irrefutable.stderr @@ -1,20 +1,18 @@ error[E0005]: refutable pattern in local binding: `A(_)` not covered --> $DIR/uninhabited-irrefutable.rs:27:9 | -LL | / enum Foo { -LL | | A(foo::SecretlyEmpty), - | | - 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 +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: 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` help: you might want to use `if let` to ignore the variant that isn't matched | diff --git a/src/test/ui/uninhabited/uninhabited-matches-feature-gated.stderr b/src/test/ui/uninhabited/uninhabited-matches-feature-gated.stderr index 0811753cb0d..26d02006bf6 100644 --- a/src/test/ui/uninhabited/uninhabited-matches-feature-gated.stderr +++ b/src/test/ui/uninhabited/uninhabited-matches-feature-gated.stderr @@ -4,11 +4,18 @@ error[E0004]: non-exhaustive patterns: `Err(_)` not covered LL | let _ = match x { | ^ 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: `Result` defined here + --> $SRC_DIR/core/src/result.rs:LL:COL | +LL | / pub enum Result { +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` 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 --> $DIR/uninhabited-matches-feature-gated.rs:15:19 | -LL | enum Void {} - | ------------ `Void` defined here -... 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: references are always considered inhabited 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 { | ^ 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: `Result` defined here + --> $SRC_DIR/core/src/result.rs:LL:COL | +LL | / pub enum Result { +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` 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; | ^^^^^ 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: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html +note: `Result` defined here + --> $SRC_DIR/core/src/result.rs:LL:COL + | +LL | / pub enum Result { +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` help: you might want to use `if let` to ignore the variant that isn't matched |