From 3ddfeeb1ebbefd4171afe47cb1ee2c5d83a33361 Mon Sep 17 00:00:00 2001 From: mejrs <59372212+mejrs@users.noreply.github.com> Date: Sun, 19 Feb 2023 10:14:02 +0100 Subject: [PATCH 01/11] Shorten e0004 description --- compiler/rustc_mir_build/messages.ftl | 9 +- compiler/rustc_mir_build/src/errors.rs | 18 ++- .../src/thir/pattern/check_match.rs | 96 +++---------- .../src/thir/pattern/usefulness.rs | 2 +- .../match/issue-88331.rs | 4 +- .../match/issue-88331.stderr | 4 +- .../match/non-exhaustive-match.rs | 4 +- .../match/non-exhaustive-match.stderr | 4 +- .../const_in_pattern/incomplete-slice.rs | 2 +- .../const_in_pattern/incomplete-slice.stderr | 2 +- tests/ui/error-codes/E0004-2.stderr | 2 +- tests/ui/error-codes/E0004.stderr | 2 +- ...te-non_exhaustive_omitted_patterns_lint.rs | 2 +- ...on_exhaustive_omitted_patterns_lint.stderr | 2 +- ...ture-gate-precise_pointer_size_matching.rs | 4 +- ...-gate-precise_pointer_size_matching.stderr | 4 +- .../half-open-range-pats-exhaustive-fail.rs | 136 +++++++++--------- ...alf-open-range-pats-exhaustive-fail.stderr | 136 +++++++++--------- tests/ui/issue-94866.rs | 2 +- tests/ui/issue-94866.stderr | 2 +- tests/ui/match/match_non_exhaustive.rs | 4 +- tests/ui/match/match_non_exhaustive.stderr | 4 +- .../exhaustiveness-non-exhaustive.rs | 6 +- .../exhaustiveness-non-exhaustive.stderr | 6 +- ...ve-been-expanded-earlier-non-exhaustive.rs | 2 +- ...een-expanded-earlier-non-exhaustive.stderr | 2 +- ...e-missing-pattern-excluding-comments.fixed | 2 +- ...iate-missing-pattern-excluding-comments.rs | 2 +- ...-missing-pattern-excluding-comments.stderr | 2 +- .../usefulness/doc-hidden-non-exhaustive.rs | 10 +- .../doc-hidden-non-exhaustive.stderr | 10 +- .../empty-match.exhaustive_patterns.stderr | 22 +-- .../usefulness/empty-match.normal.stderr | 22 +-- tests/ui/pattern/usefulness/empty-match.rs | 22 +-- tests/ui/pattern/usefulness/floats.rs | 2 +- tests/ui/pattern/usefulness/floats.stderr | 2 +- tests/ui/pattern/usefulness/guards.rs | 2 +- tests/ui/pattern/usefulness/guards.stderr | 2 +- .../integer-ranges/exhaustiveness.rs | 24 ++-- .../integer-ranges/exhaustiveness.stderr | 24 ++-- .../pointer-sized-int.deny.stderr | 22 +-- .../integer-ranges/pointer-sized-int.rs | 22 +-- .../precise_pointer_matching-message.rs | 4 +- .../precise_pointer_matching-message.stderr | 4 +- tests/ui/pattern/usefulness/issue-15129.rs | 2 +- .../ui/pattern/usefulness/issue-15129.stderr | 2 +- tests/ui/pattern/usefulness/issue-2111.rs | 2 +- tests/ui/pattern/usefulness/issue-2111.stderr | 2 +- tests/ui/pattern/usefulness/issue-30240.rs | 4 +- .../ui/pattern/usefulness/issue-30240.stderr | 4 +- .../ui/pattern/usefulness/issue-35609.stderr | 16 +-- tests/ui/pattern/usefulness/issue-3601.rs | 2 +- tests/ui/pattern/usefulness/issue-3601.stderr | 2 +- tests/ui/pattern/usefulness/issue-39362.rs | 2 +- .../ui/pattern/usefulness/issue-39362.stderr | 2 +- tests/ui/pattern/usefulness/issue-40221.rs | 2 +- .../ui/pattern/usefulness/issue-40221.stderr | 2 +- tests/ui/pattern/usefulness/issue-4321.rs | 2 +- tests/ui/pattern/usefulness/issue-4321.stderr | 2 +- tests/ui/pattern/usefulness/issue-50900.rs | 2 +- .../ui/pattern/usefulness/issue-50900.stderr | 2 +- tests/ui/pattern/usefulness/issue-56379.rs | 2 +- .../ui/pattern/usefulness/issue-56379.stderr | 2 +- tests/ui/pattern/usefulness/issue-72377.rs | 2 +- .../ui/pattern/usefulness/issue-72377.stderr | 2 +- .../pattern/usefulness/match-arm-statics-2.rs | 6 +- .../usefulness/match-arm-statics-2.stderr | 6 +- .../match-byte-array-patterns-2.stderr | 4 +- .../usefulness/match-non-exhaustive.rs | 4 +- .../usefulness/match-non-exhaustive.stderr | 4 +- .../usefulness/match-privately-empty.rs | 2 +- .../usefulness/match-privately-empty.stderr | 2 +- .../usefulness/match-slice-patterns.rs | 2 +- .../usefulness/match-slice-patterns.stderr | 2 +- .../usefulness/non-exhaustive-defined-here.rs | 8 +- .../non-exhaustive-defined-here.stderr | 8 +- .../usefulness/non-exhaustive-match-nested.rs | 4 +- .../non-exhaustive-match-nested.stderr | 4 +- .../usefulness/non-exhaustive-match.rs | 16 +-- .../usefulness/non-exhaustive-match.stderr | 16 +-- .../non-exhaustive-pattern-witness.rs | 15 +- .../non-exhaustive-pattern-witness.stderr | 20 +-- .../slice-patterns-exhaustiveness.rs | 40 +++--- .../slice-patterns-exhaustiveness.stderr | 40 +++--- .../usefulness/stable-gated-patterns.rs | 4 +- .../usefulness/stable-gated-patterns.stderr | 4 +- .../struct-like-enum-nonexhaustive.rs | 2 +- .../struct-like-enum-nonexhaustive.stderr | 2 +- .../tuple-struct-nonexhaustive.stderr | 2 +- .../type_polymorphic_byte_str_literals.rs | 4 +- .../type_polymorphic_byte_str_literals.stderr | 4 +- .../usefulness/unstable-gated-patterns.rs | 2 +- .../usefulness/unstable-gated-patterns.stderr | 2 +- .../ui/rfc-2005-default-binding-mode/slice.rs | 2 +- .../slice.stderr | 2 +- tests/ui/rfc-2008-non-exhaustive/enum.rs | 4 +- tests/ui/rfc-2008-non-exhaustive/enum.stderr | 4 +- .../enum_same_crate_empty_match.rs | 4 +- .../enum_same_crate_empty_match.stderr | 4 +- .../uninhabited/match.rs | 2 +- .../uninhabited/match.stderr | 2 +- .../uninhabited/match_same_crate.rs | 2 +- .../uninhabited/match_same_crate.stderr | 2 +- .../match_with_exhaustive_patterns.rs | 2 +- .../match_with_exhaustive_patterns.stderr | 2 +- .../uninhabited-matches-feature-gated.stderr | 6 +- 106 files changed, 472 insertions(+), 516 deletions(-) diff --git a/compiler/rustc_mir_build/messages.ftl b/compiler/rustc_mir_build/messages.ftl index 93e7fb330e093..e202e432bd56e 100644 --- a/compiler/rustc_mir_build/messages.ftl +++ b/compiler/rustc_mir_build/messages.ftl @@ -176,10 +176,10 @@ mir_build_unused_unsafe = unnecessary `unsafe` block mir_build_unused_unsafe_enclosing_block_label = because it's nested under this `unsafe` block mir_build_unused_unsafe_enclosing_fn_label = because it's nested under this `unsafe` fn -mir_build_non_exhaustive_patterns_type_not_empty = non-exhaustive patterns: type `{$ty}` is non-empty +mir_build_non_exhaustive_patterns_type_not_empty = non-exhaustive patterns: type `{$scrut_ty}` is non-empty .def_note = `{$peeled_ty}` defined here - .type_note = the matched value is of type `{$ty}` - .non_exhaustive_type_note = the matched value is of type `{$ty}`, which is marked as non-exhaustive + .type_note = the matched value is of type `{$scrut_ty}` + .non_exhaustive_type_note = the matched value is of type `{$scrut_ty}`, which is marked as non-exhaustive .reference_note = references are always considered inhabited .suggestion = ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown .help = ensure that all possible cases are being handled by adding a match arm with a wildcard pattern @@ -375,8 +375,9 @@ mir_build_suggest_let_else = you might want to use `let else` to handle the {$co mir_build_suggest_attempted_int_lit = alternatively, you could prepend the pattern with an underscore to define a new named variable; identifiers cannot begin with digits - mir_build_rustc_box_attribute_error = `#[rustc_box]` attribute used incorrectly .attributes = no other attributes may be applied .not_box = `#[rustc_box]` may only be applied to a `Box::new()` call .missing_box = `#[rustc_box]` requires the `owned_box` lang item + +mir_build_non_exhaustive_pattern = match is non-exhaustive diff --git a/compiler/rustc_mir_build/src/errors.rs b/compiler/rustc_mir_build/src/errors.rs index dc4d2276e4aab..2bbeed562a572 100644 --- a/compiler/rustc_mir_build/src/errors.rs +++ b/compiler/rustc_mir_build/src/errors.rs @@ -352,7 +352,7 @@ pub(crate) struct NonExhaustivePatternsTypeNotEmpty<'p, 'tcx, 'm> { pub cx: &'m MatchCheckCtxt<'p, 'tcx>, pub expr_span: Span, pub span: Span, - pub ty: Ty<'tcx>, + pub scrut_ty: Ty<'tcx>, } impl<'a> IntoDiagnostic<'a> for NonExhaustivePatternsTypeNotEmpty<'_, '_, '_> { @@ -363,8 +363,8 @@ impl<'a> IntoDiagnostic<'a> for NonExhaustivePatternsTypeNotEmpty<'_, '_, '_> { error_code!(E0004), ); - let peeled_ty = self.ty.peel_refs(); - diag.set_arg("ty", self.ty); + let peeled_ty = self.scrut_ty.peel_refs(); + diag.set_arg("scrut_ty", self.scrut_ty); diag.set_arg("peeled_ty", peeled_ty); if let ty::Adt(def, _) = peeled_ty.kind() { @@ -384,7 +384,7 @@ impl<'a> IntoDiagnostic<'a> for NonExhaustivePatternsTypeNotEmpty<'_, '_, '_> { diag.span_note(span, fluent::mir_build_def_note); } - let is_variant_list_non_exhaustive = match self.ty.kind() { + let is_variant_list_non_exhaustive = match self.scrut_ty.kind() { ty::Adt(def, _) if def.is_variant_list_non_exhaustive() && !def.did().is_local() => { true } @@ -397,7 +397,7 @@ impl<'a> IntoDiagnostic<'a> for NonExhaustivePatternsTypeNotEmpty<'_, '_, '_> { diag.note(fluent::mir_build_type_note); } - if let ty::Ref(_, sub_ty, _) = self.ty.kind() { + if let ty::Ref(_, sub_ty, _) = self.scrut_ty.kind() { if !sub_ty.is_inhabited_from(self.cx.tcx, self.cx.module, self.cx.param_env) { diag.note(fluent::mir_build_reference_note); } @@ -760,7 +760,7 @@ impl<'tcx> Uncovered<'tcx> { pub fn new<'p>( span: Span, cx: &MatchCheckCtxt<'p, 'tcx>, - witnesses: Vec>, + witnesses: &[DeconstructedPat<'p, 'tcx>], ) -> Self { let witness_1 = witnesses.get(0).unwrap().to_pat(cx); Self { @@ -906,4 +906,10 @@ pub enum RustcBoxAttrReason { NotBoxNew, #[note(mir_build_missing_box)] MissingBox, +#[diag(mir_build_non_exhaustive_pattern, code = "E0004")] +pub(crate) struct NonExhaustivePatterns<'tcx> { + #[primary_span] + pub span: Span, + #[subdiagnostic] + pub uncovered: Uncovered<'tcx>, } 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 2640ca56b00e9..47615c53ed750 100644 --- a/compiler/rustc_mir_build/src/thir/pattern/check_match.rs +++ b/compiler/rustc_mir_build/src/thir/pattern/check_match.rs @@ -4,14 +4,12 @@ use super::usefulness::{ }; use super::{PatCtxt, PatternError}; -use crate::errors::*; +use crate::errors::{self, *}; use hir::{ExprKind, PatKind}; use rustc_arena::TypedArena; use rustc_ast::{LitKind, Mutability}; -use rustc_errors::{ - struct_span_err, Applicability, Diagnostic, DiagnosticBuilder, ErrorGuaranteed, MultiSpan, -}; +use rustc_errors::{Applicability, Diagnostic, MultiSpan}; use rustc_hir as hir; use rustc_hir::def::*; use rustc_hir::def_id::DefId; @@ -23,7 +21,6 @@ use rustc_middle::ty::{self, AdtDef, Ty, TyCtxt}; use rustc_session::lint::builtin::{ BINDINGS_WITH_VARIANT_NAME, IRREFUTABLE_LET_PATTERNS, UNREACHABLE_PATTERNS, }; -use rustc_session::Session; use rustc_span::source_map::Spanned; use rustc_span::{BytePos, Span}; @@ -43,14 +40,6 @@ pub(crate) fn check_match(tcx: TyCtxt<'_>, def_id: DefId) { visitor.visit_body(tcx.hir().body(body_id)); } -fn create_e0004( - sess: &Session, - sp: Span, - error_message: String, -) -> DiagnosticBuilder<'_, ErrorGuaranteed> { - struct_span_err!(sess, sp, E0004, "{}", &error_message) -} - #[derive(PartialEq)] enum RefutableFlag { Irrefutable, @@ -458,7 +447,7 @@ impl<'p, 'tcx> MatchVisitor<'_, 'p, 'tcx> { self.tcx.sess.emit_err(PatternNotCovered { span: pat.span, origin, - uncovered: Uncovered::new(pat.span, &cx, witnesses), + uncovered: Uncovered::new(pat.span, &cx, &witnesses), inform, interpreted_as_const, _p: (), @@ -605,7 +594,7 @@ fn report_arm_reachability<'p, 'tcx>( fn non_exhaustive_match<'p, 'tcx>( cx: &MatchCheckCtxt<'p, 'tcx>, scrut_ty: Ty<'tcx>, - sp: Span, + span: Span, witnesses: Vec>, arms: &[hir::Arm<'tcx>], expr_span: Span, @@ -617,38 +606,27 @@ fn non_exhaustive_match<'p, 'tcx>( }; // In the case of an empty match, replace the '`_` not covered' diagnostic with something more // informative. - let mut err; - let pattern; - let patterns_len; if is_empty_match && !non_empty_enum { - cx.tcx.sess.emit_err(NonExhaustivePatternsTypeNotEmpty { - cx, - expr_span, - span: sp, - ty: scrut_ty, - }); + cx.tcx.sess.emit_err(NonExhaustivePatternsTypeNotEmpty { cx, expr_span, span, scrut_ty }); return; + } + + let patterns_len = witnesses.len(); + let pattern = if witnesses.len() < 4 { + witnesses + .iter() + .map(|witness| witness.to_pat(cx).to_string()) + .collect::>() + .join(" | ") } else { - // FIXME: migration of this diagnostic will require list support - let joined_patterns = joined_uncovered_patterns(cx, &witnesses); - err = create_e0004( - cx.tcx.sess, - sp, - format!("non-exhaustive patterns: {} not covered", joined_patterns), - ); - err.span_label(sp, pattern_not_covered_label(&witnesses, &joined_patterns)); - patterns_len = witnesses.len(); - pattern = if witnesses.len() < 4 { - witnesses - .iter() - .map(|witness| witness.to_pat(cx).to_string()) - .collect::>() - .join(" | ") - } else { - "_".to_string() - }; + "_".to_string() }; + let mut err = cx.tcx.sess.create_err(errors::NonExhaustivePatterns { + span, + uncovered: Uncovered::new(span, &cx, &witnesses), + }); + let is_variant_list_non_exhaustive = match scrut_ty.kind() { ty::Adt(def, _) if def.is_variant_list_non_exhaustive() && !def.did().is_local() => true, _ => false, @@ -687,15 +665,15 @@ fn non_exhaustive_match<'p, 'tcx>( let mut suggestion = None; let sm = cx.tcx.sess.source_map(); match arms { - [] if sp.eq_ctxt(expr_span) => { + [] if span.eq_ctxt(expr_span) => { // Get the span for the empty match body `{}`. - let (indentation, more) = if let Some(snippet) = sm.indentation_before(sp) { + let (indentation, more) = if let Some(snippet) = sm.indentation_before(span) { (format!("\n{}", snippet), " ") } else { (" ".to_string(), "") }; suggestion = Some(( - sp.shrink_to_hi().with_hi(expr_span.hi()), + span.shrink_to_hi().with_hi(expr_span.hi()), format!( " {{{indentation}{more}{pattern} => todo!(),{indentation}}}", indentation = indentation, @@ -776,34 +754,6 @@ fn non_exhaustive_match<'p, 'tcx>( err.emit(); } -pub(crate) fn joined_uncovered_patterns<'p, 'tcx>( - cx: &MatchCheckCtxt<'p, 'tcx>, - witnesses: &[DeconstructedPat<'p, 'tcx>], -) -> String { - const LIMIT: usize = 3; - let pat_to_str = |pat: &DeconstructedPat<'p, 'tcx>| pat.to_pat(cx).to_string(); - match witnesses { - [] => bug!(), - [witness] => format!("`{}`", witness.to_pat(cx)), - [head @ .., tail] if head.len() < LIMIT => { - let head: Vec<_> = head.iter().map(pat_to_str).collect(); - format!("`{}` and `{}`", head.join("`, `"), tail.to_pat(cx)) - } - _ => { - let (head, tail) = witnesses.split_at(LIMIT); - let head: Vec<_> = head.iter().map(pat_to_str).collect(); - format!("`{}` and {} more", head.join("`, `"), tail.len()) - } - } -} - -pub(crate) fn pattern_not_covered_label( - witnesses: &[DeconstructedPat<'_, '_>], - joined_patterns: &str, -) -> String { - format!("pattern{} {} not covered", rustc_errors::pluralize!(witnesses.len()), joined_patterns) -} - /// Point at the definition of non-covered `enum` variants. fn adt_defined_here<'p, 'tcx>( cx: &MatchCheckCtxt<'p, 'tcx>, diff --git a/compiler/rustc_mir_build/src/thir/pattern/usefulness.rs b/compiler/rustc_mir_build/src/thir/pattern/usefulness.rs index be66d0d476513..8c677b7c759c2 100644 --- a/compiler/rustc_mir_build/src/thir/pattern/usefulness.rs +++ b/compiler/rustc_mir_build/src/thir/pattern/usefulness.rs @@ -897,7 +897,7 @@ fn is_useful<'p, 'tcx>( pcx.span, NonExhaustiveOmittedPattern { scrut_ty: pcx.ty, - uncovered: Uncovered::new(pcx.span, pcx.cx, patterns), + uncovered: Uncovered::new(pcx.span, pcx.cx, &patterns), }, ); } diff --git a/tests/ui/closures/2229_closure_analysis/match/issue-88331.rs b/tests/ui/closures/2229_closure_analysis/match/issue-88331.rs index 0a6d71c68ae84..4fba72a69b7a4 100644 --- a/tests/ui/closures/2229_closure_analysis/match/issue-88331.rs +++ b/tests/ui/closures/2229_closure_analysis/match/issue-88331.rs @@ -9,7 +9,7 @@ impl Opcode { pub fn example1(msg_type: Opcode) -> impl FnMut(&[u8]) { move |i| match msg_type { - //~^ ERROR: non-exhaustive patterns: `Opcode(0_u8)` and `Opcode(2_u8..=u8::MAX)` not covered + //~^ ERROR: match is non-exhaustive Opcode::OP1 => unimplemented!(), } } @@ -25,7 +25,7 @@ impl Opcode2 { pub fn example2(msg_type: Opcode2) -> impl FnMut(&[u8]) { move |i| match msg_type { - //~^ ERROR: non-exhaustive patterns: `Opcode2(Opcode(0_u8))` and `Opcode2(Opcode(2_u8..=u8::MAX))` not covered + //~^ ERROR: match is non-exhaustive Opcode2::OP2=> unimplemented!(), } } diff --git a/tests/ui/closures/2229_closure_analysis/match/issue-88331.stderr b/tests/ui/closures/2229_closure_analysis/match/issue-88331.stderr index 7e22defa98dd4..475045f8621b2 100644 --- a/tests/ui/closures/2229_closure_analysis/match/issue-88331.stderr +++ b/tests/ui/closures/2229_closure_analysis/match/issue-88331.stderr @@ -1,4 +1,4 @@ -error[E0004]: non-exhaustive patterns: `Opcode(0_u8)` and `Opcode(2_u8..=u8::MAX)` not covered +error[E0004]: match is non-exhaustive --> $DIR/issue-88331.rs:11:20 | LL | move |i| match msg_type { @@ -16,7 +16,7 @@ LL ~ Opcode::OP1 => unimplemented!(), LL ~ Opcode(0_u8) | Opcode(2_u8..=u8::MAX) => todo!(), | -error[E0004]: non-exhaustive patterns: `Opcode2(Opcode(0_u8))` and `Opcode2(Opcode(2_u8..=u8::MAX))` not covered +error[E0004]: match is non-exhaustive --> $DIR/issue-88331.rs:27:20 | LL | move |i| match msg_type { diff --git a/tests/ui/closures/2229_closure_analysis/match/non-exhaustive-match.rs b/tests/ui/closures/2229_closure_analysis/match/non-exhaustive-match.rs index 972c24c23b019..5614d770ba6be 100644 --- a/tests/ui/closures/2229_closure_analysis/match/non-exhaustive-match.rs +++ b/tests/ui/closures/2229_closure_analysis/match/non-exhaustive-match.rs @@ -24,7 +24,7 @@ fn main() { let _a = || { match l1 { L1::A => (), L1::B => () } }; // (except if the match is already non-exhaustive) let _b = || { match l1 { L1::A => () } }; - //~^ ERROR: non-exhaustive patterns: `L1::B` not covered [E0004] + //~^ ERROR match is non-exhaustive [E0004] // l2 should not be captured as it is a non-exhaustive SingleVariant // defined in this crate @@ -37,7 +37,7 @@ fn main() { let _d = || { match e1 {} }; //~^ ERROR: non-exhaustive patterns: type `E1` is non-empty [E0004] let _e = || { match e2 { E2::A => (), E2::B => () } }; - //~^ ERROR: non-exhaustive patterns: `_` not covered [E0004] + //~^ ERROR match is non-exhaustive [E0004] let _f = || { match e2 { E2::A => (), E2::B => (), _ => () } }; // e3 should be captured as it is a non-exhaustive SingleVariant diff --git a/tests/ui/closures/2229_closure_analysis/match/non-exhaustive-match.stderr b/tests/ui/closures/2229_closure_analysis/match/non-exhaustive-match.stderr index 3a5fad15421c6..09307d74dd629 100644 --- a/tests/ui/closures/2229_closure_analysis/match/non-exhaustive-match.stderr +++ b/tests/ui/closures/2229_closure_analysis/match/non-exhaustive-match.stderr @@ -1,4 +1,4 @@ -error[E0004]: non-exhaustive patterns: `L1::B` not covered +error[E0004]: match is non-exhaustive --> $DIR/non-exhaustive-match.rs:26:25 | LL | let _b = || { match l1 { L1::A => () } }; @@ -34,7 +34,7 @@ LL + _ => todo!(), LL ~ } }; | -error[E0004]: non-exhaustive patterns: `_` not covered +error[E0004]: match is non-exhaustive --> $DIR/non-exhaustive-match.rs:39:25 | LL | let _e = || { match e2 { E2::A => (), E2::B => () } }; diff --git a/tests/ui/consts/const_in_pattern/incomplete-slice.rs b/tests/ui/consts/const_in_pattern/incomplete-slice.rs index e1ccda71d40ea..599e25affefb1 100644 --- a/tests/ui/consts/const_in_pattern/incomplete-slice.rs +++ b/tests/ui/consts/const_in_pattern/incomplete-slice.rs @@ -7,7 +7,7 @@ const E_SL: &[E] = &[E::A]; fn main() { match &[][..] { - //~^ ERROR non-exhaustive patterns: `&_` not covered [E0004] + //~^ ERROR match is non-exhaustive [E0004] E_SL => {} //~^ WARN to use a constant of type `E` in a pattern, `E` must be annotated with `#[derive(PartialEq, Eq)]` //~| WARN this was previously accepted by the compiler but is being phased out diff --git a/tests/ui/consts/const_in_pattern/incomplete-slice.stderr b/tests/ui/consts/const_in_pattern/incomplete-slice.stderr index ddc576ced8f36..d8c3b95392a17 100644 --- a/tests/ui/consts/const_in_pattern/incomplete-slice.stderr +++ b/tests/ui/consts/const_in_pattern/incomplete-slice.stderr @@ -8,7 +8,7 @@ LL | E_SL => {} = note: for more information, see issue #62411 = note: `#[warn(indirect_structural_match)]` on by default -error[E0004]: non-exhaustive patterns: `&_` not covered +error[E0004]: match is non-exhaustive --> $DIR/incomplete-slice.rs:9:11 | LL | match &[][..] { diff --git a/tests/ui/error-codes/E0004-2.stderr b/tests/ui/error-codes/E0004-2.stderr index e829bac196f79..f0a2666962bc2 100644 --- a/tests/ui/error-codes/E0004-2.stderr +++ b/tests/ui/error-codes/E0004-2.stderr @@ -1,4 +1,4 @@ -error[E0004]: non-exhaustive patterns: `None` and `Some(_)` not covered +error[E0004]: match is non-exhaustive --> $DIR/E0004-2.rs:4:11 | LL | match x { } diff --git a/tests/ui/error-codes/E0004.stderr b/tests/ui/error-codes/E0004.stderr index 4ac8c904f0530..21d23744106cd 100644 --- a/tests/ui/error-codes/E0004.stderr +++ b/tests/ui/error-codes/E0004.stderr @@ -1,4 +1,4 @@ -error[E0004]: non-exhaustive patterns: `Terminator::HastaLaVistaBaby` not covered +error[E0004]: match is non-exhaustive --> $DIR/E0004.rs:9:11 | LL | match x { diff --git a/tests/ui/feature-gates/feature-gate-non_exhaustive_omitted_patterns_lint.rs b/tests/ui/feature-gates/feature-gate-non_exhaustive_omitted_patterns_lint.rs index 9b646060adfd9..d87af753a50ad 100644 --- a/tests/ui/feature-gates/feature-gate-non_exhaustive_omitted_patterns_lint.rs +++ b/tests/ui/feature-gates/feature-gate-non_exhaustive_omitted_patterns_lint.rs @@ -21,7 +21,7 @@ fn main() { Foo::A => {} Foo::B => {} } - //~^^^^ ERROR non-exhaustive patterns: `Foo::C` not covered + //~^^^^ ERROR match is non-exhaustive match Foo::A { Foo::A => {} diff --git a/tests/ui/feature-gates/feature-gate-non_exhaustive_omitted_patterns_lint.stderr b/tests/ui/feature-gates/feature-gate-non_exhaustive_omitted_patterns_lint.stderr index 4d79ce3c6594a..61619ad8b4953 100644 --- a/tests/ui/feature-gates/feature-gate-non_exhaustive_omitted_patterns_lint.stderr +++ b/tests/ui/feature-gates/feature-gate-non_exhaustive_omitted_patterns_lint.stderr @@ -99,7 +99,7 @@ LL | #[warn(non_exhaustive_omitted_patterns)] = note: see issue #89554 for more information = help: add `#![feature(non_exhaustive_omitted_patterns_lint)]` to the crate attributes to enable -error[E0004]: non-exhaustive patterns: `Foo::C` not covered +error[E0004]: match is non-exhaustive --> $DIR/feature-gate-non_exhaustive_omitted_patterns_lint.rs:20:11 | LL | match Foo::A { diff --git a/tests/ui/feature-gates/feature-gate-precise_pointer_size_matching.rs b/tests/ui/feature-gates/feature-gate-precise_pointer_size_matching.rs index 4c77180b767a3..a2463cf4e78e8 100644 --- a/tests/ui/feature-gates/feature-gate-precise_pointer_size_matching.rs +++ b/tests/ui/feature-gates/feature-gate-precise_pointer_size_matching.rs @@ -1,6 +1,6 @@ fn main() { match 0usize { - //~^ ERROR non-exhaustive patterns: `_` not covered + //~^ ERROR match is non-exhaustive //~| NOTE pattern `_` not covered //~| NOTE the matched value is of type `usize` //~| NOTE `usize` does not have a fixed maximum value @@ -8,7 +8,7 @@ fn main() { } match 0isize { - //~^ ERROR non-exhaustive patterns: `_` not covered + //~^ ERROR match is non-exhaustive //~| NOTE pattern `_` not covered //~| NOTE the matched value is of type `isize` //~| NOTE `isize` does not have a fixed maximum value diff --git a/tests/ui/feature-gates/feature-gate-precise_pointer_size_matching.stderr b/tests/ui/feature-gates/feature-gate-precise_pointer_size_matching.stderr index b5510683328f5..6ac51cb4f2af7 100644 --- a/tests/ui/feature-gates/feature-gate-precise_pointer_size_matching.stderr +++ b/tests/ui/feature-gates/feature-gate-precise_pointer_size_matching.stderr @@ -1,4 +1,4 @@ -error[E0004]: non-exhaustive patterns: `_` not covered +error[E0004]: match is non-exhaustive --> $DIR/feature-gate-precise_pointer_size_matching.rs:2:11 | LL | match 0usize { @@ -13,7 +13,7 @@ LL ~ 0..=usize::MAX => {} LL + _ => todo!() | -error[E0004]: non-exhaustive patterns: `_` not covered +error[E0004]: match is non-exhaustive --> $DIR/feature-gate-precise_pointer_size_matching.rs:10:11 | LL | match 0isize { diff --git a/tests/ui/half-open-range-patterns/half-open-range-pats-exhaustive-fail.rs b/tests/ui/half-open-range-patterns/half-open-range-pats-exhaustive-fail.rs index a2a4c62fa0295..6e38f73b9ca9e 100644 --- a/tests/ui/half-open-range-patterns/half-open-range-pats-exhaustive-fail.rs +++ b/tests/ui/half-open-range-patterns/half-open-range-pats-exhaustive-fail.rs @@ -12,8 +12,8 @@ macro_rules! m { } fn floats() { - m!(0f32, f32::NEG_INFINITY..); //~ ERROR non-exhaustive patterns: `_` not covered - m!(0f32, ..f32::INFINITY); //~ ERROR non-exhaustive patterns: `_` not covered + m!(0f32, f32::NEG_INFINITY..); //~ ERROR match is non-exhaustive + m!(0f32, ..f32::INFINITY); //~ ERROR match is non-exhaustive } fn khar() { @@ -22,12 +22,12 @@ fn khar() { const VAL: char = 'a'; const VAL_1: char = 'b'; const VAL_2: char = 'c'; - m!('a', ..core::char::MAX); //~ ERROR non-exhaustive patterns - m!('a', ..ALMOST_MAX); //~ ERROR non-exhaustive patterns - m!('a', ALMOST_MIN..); //~ ERROR non-exhaustive patterns - m!('a', ..=ALMOST_MAX); //~ ERROR non-exhaustive patterns - m!('a', ..=VAL | VAL_2..); //~ ERROR non-exhaustive patterns - m!('a', ..VAL_1 | VAL_2..); //~ ERROR non-exhaustive patterns + m!('a', ..core::char::MAX); //~ ERROR match is non-exhaustive + m!('a', ..ALMOST_MAX); //~ ERROR match is non-exhaustive + m!('a', ALMOST_MIN..); //~ ERROR match is non-exhaustive + m!('a', ..=ALMOST_MAX); //~ ERROR match is non-exhaustive + m!('a', ..=VAL | VAL_2..); //~ ERROR match is non-exhaustive + m!('a', ..VAL_1 | VAL_2..); //~ ERROR match is non-exhaustive } mod unsigned { @@ -37,12 +37,12 @@ mod unsigned { const VAL: u8 = 42; const VAL_1: u8 = VAL + 1; const VAL_2: u8 = VAL + 2; - m!(0, ..u8::MAX); //~ ERROR non-exhaustive patterns - m!(0, ..ALMOST_MAX); //~ ERROR non-exhaustive patterns - m!(0, ALMOST_MIN..); //~ ERROR non-exhaustive patterns - m!(0, ..=ALMOST_MAX); //~ ERROR non-exhaustive patterns - m!(0, ..=VAL | VAL_2..); //~ ERROR non-exhaustive patterns - m!(0, ..VAL_1 | VAL_2..); //~ ERROR non-exhaustive patterns + m!(0, ..u8::MAX); //~ ERROR match is non-exhaustive + m!(0, ..ALMOST_MAX); //~ ERROR match is non-exhaustive + m!(0, ALMOST_MIN..); //~ ERROR match is non-exhaustive + m!(0, ..=ALMOST_MAX); //~ ERROR match is non-exhaustive + m!(0, ..=VAL | VAL_2..); //~ ERROR match is non-exhaustive + m!(0, ..VAL_1 | VAL_2..); //~ ERROR match is non-exhaustive } fn u16() { const ALMOST_MAX: u16 = u16::MAX - 1; @@ -50,12 +50,12 @@ mod unsigned { const VAL: u16 = 42; const VAL_1: u16 = VAL + 1; const VAL_2: u16 = VAL + 2; - m!(0, ..u16::MAX); //~ ERROR non-exhaustive patterns - m!(0, ..ALMOST_MAX); //~ ERROR non-exhaustive patterns - m!(0, ALMOST_MIN..); //~ ERROR non-exhaustive patterns - m!(0, ..=ALMOST_MAX); //~ ERROR non-exhaustive patterns - m!(0, ..=VAL | VAL_2..); //~ ERROR non-exhaustive patterns - m!(0, ..VAL_1 | VAL_2..); //~ ERROR non-exhaustive patterns + m!(0, ..u16::MAX); //~ ERROR match is non-exhaustive + m!(0, ..ALMOST_MAX); //~ ERROR match is non-exhaustive + m!(0, ALMOST_MIN..); //~ ERROR match is non-exhaustive + m!(0, ..=ALMOST_MAX); //~ ERROR match is non-exhaustive + m!(0, ..=VAL | VAL_2..); //~ ERROR match is non-exhaustive + m!(0, ..VAL_1 | VAL_2..); //~ ERROR match is non-exhaustive } fn u32() { const ALMOST_MAX: u32 = u32::MAX - 1; @@ -63,12 +63,12 @@ mod unsigned { const VAL: u32 = 42; const VAL_1: u32 = VAL + 1; const VAL_2: u32 = VAL + 2; - m!(0, ..u32::MAX); //~ ERROR non-exhaustive patterns - m!(0, ..ALMOST_MAX); //~ ERROR non-exhaustive patterns - m!(0, ALMOST_MIN..); //~ ERROR non-exhaustive patterns - m!(0, ..=ALMOST_MAX); //~ ERROR non-exhaustive patterns - m!(0, ..=VAL | VAL_2..); //~ ERROR non-exhaustive patterns - m!(0, ..VAL_1 | VAL_2..); //~ ERROR non-exhaustive patterns + m!(0, ..u32::MAX); //~ ERROR match is non-exhaustive + m!(0, ..ALMOST_MAX); //~ ERROR match is non-exhaustive + m!(0, ALMOST_MIN..); //~ ERROR match is non-exhaustive + m!(0, ..=ALMOST_MAX); //~ ERROR match is non-exhaustive + m!(0, ..=VAL | VAL_2..); //~ ERROR match is non-exhaustive + m!(0, ..VAL_1 | VAL_2..); //~ ERROR match is non-exhaustive } fn u64() { const ALMOST_MAX: u64 = u64::MAX - 1; @@ -76,12 +76,12 @@ mod unsigned { const VAL: u64 = 42; const VAL_1: u64 = VAL + 1; const VAL_2: u64 = VAL + 2; - m!(0, ..u64::MAX); //~ ERROR non-exhaustive patterns - m!(0, ..ALMOST_MAX); //~ ERROR non-exhaustive patterns - m!(0, ALMOST_MIN..); //~ ERROR non-exhaustive patterns - m!(0, ..=ALMOST_MAX); //~ ERROR non-exhaustive patterns - m!(0, ..=VAL | VAL_2..); //~ ERROR non-exhaustive patterns - m!(0, ..VAL_1 | VAL_2..); //~ ERROR non-exhaustive patterns + m!(0, ..u64::MAX); //~ ERROR match is non-exhaustive + m!(0, ..ALMOST_MAX); //~ ERROR match is non-exhaustive + m!(0, ALMOST_MIN..); //~ ERROR match is non-exhaustive + m!(0, ..=ALMOST_MAX); //~ ERROR match is non-exhaustive + m!(0, ..=VAL | VAL_2..); //~ ERROR match is non-exhaustive + m!(0, ..VAL_1 | VAL_2..); //~ ERROR match is non-exhaustive } fn u128() { const ALMOST_MAX: u128 = u128::MAX - 1; @@ -89,12 +89,12 @@ mod unsigned { const VAL: u128 = 42; const VAL_1: u128 = VAL + 1; const VAL_2: u128 = VAL + 2; - m!(0, ..u128::MAX); //~ ERROR non-exhaustive patterns - m!(0, ..ALMOST_MAX); //~ ERROR non-exhaustive patterns - m!(0, ALMOST_MIN..); //~ ERROR non-exhaustive patterns - m!(0, ..=ALMOST_MAX); //~ ERROR non-exhaustive patterns - m!(0, ..=VAL | VAL_2..); //~ ERROR non-exhaustive patterns - m!(0, ..VAL_1 | VAL_2..); //~ ERROR non-exhaustive patterns + m!(0, ..u128::MAX); //~ ERROR match is non-exhaustive + m!(0, ..ALMOST_MAX); //~ ERROR match is non-exhaustive + m!(0, ALMOST_MIN..); //~ ERROR match is non-exhaustive + m!(0, ..=ALMOST_MAX); //~ ERROR match is non-exhaustive + m!(0, ..=VAL | VAL_2..); //~ ERROR match is non-exhaustive + m!(0, ..VAL_1 | VAL_2..); //~ ERROR match is non-exhaustive } } @@ -105,12 +105,12 @@ mod signed { const VAL: i8 = 42; const VAL_1: i8 = VAL + 1; const VAL_2: i8 = VAL + 2; - m!(0, ..i8::MAX); //~ ERROR non-exhaustive patterns - m!(0, ..ALMOST_MAX); //~ ERROR non-exhaustive patterns - m!(0, ALMOST_MIN..); //~ ERROR non-exhaustive patterns - m!(0, ..=ALMOST_MAX); //~ ERROR non-exhaustive patterns - m!(0, ..=VAL | VAL_2..); //~ ERROR non-exhaustive patterns - m!(0, ..VAL_1 | VAL_2..); //~ ERROR non-exhaustive patterns + m!(0, ..i8::MAX); //~ ERROR match is non-exhaustive + m!(0, ..ALMOST_MAX); //~ ERROR match is non-exhaustive + m!(0, ALMOST_MIN..); //~ ERROR match is non-exhaustive + m!(0, ..=ALMOST_MAX); //~ ERROR match is non-exhaustive + m!(0, ..=VAL | VAL_2..); //~ ERROR match is non-exhaustive + m!(0, ..VAL_1 | VAL_2..); //~ ERROR match is non-exhaustive } fn i16() { const ALMOST_MAX: i16 = i16::MAX - 1; @@ -118,12 +118,12 @@ mod signed { const VAL: i16 = 42; const VAL_1: i16 = VAL + 1; const VAL_2: i16 = VAL + 2; - m!(0, ..i16::MAX); //~ ERROR non-exhaustive patterns - m!(0, ..ALMOST_MAX); //~ ERROR non-exhaustive patterns - m!(0, ALMOST_MIN..); //~ ERROR non-exhaustive patterns - m!(0, ..=ALMOST_MAX); //~ ERROR non-exhaustive patterns - m!(0, ..=VAL | VAL_2..); //~ ERROR non-exhaustive patterns - m!(0, ..VAL_1 | VAL_2..); //~ ERROR non-exhaustive patterns + m!(0, ..i16::MAX); //~ ERROR match is non-exhaustive + m!(0, ..ALMOST_MAX); //~ ERROR match is non-exhaustive + m!(0, ALMOST_MIN..); //~ ERROR match is non-exhaustive + m!(0, ..=ALMOST_MAX); //~ ERROR match is non-exhaustive + m!(0, ..=VAL | VAL_2..); //~ ERROR match is non-exhaustive + m!(0, ..VAL_1 | VAL_2..); //~ ERROR match is non-exhaustive } fn i32() { const ALMOST_MAX: i32 = i32::MAX - 1; @@ -131,12 +131,12 @@ mod signed { const VAL: i32 = 42; const VAL_1: i32 = VAL + 1; const VAL_2: i32 = VAL + 2; - m!(0, ..i32::MAX); //~ ERROR non-exhaustive patterns - m!(0, ..ALMOST_MAX); //~ ERROR non-exhaustive patterns - m!(0, ALMOST_MIN..); //~ ERROR non-exhaustive patterns - m!(0, ..=ALMOST_MAX); //~ ERROR non-exhaustive patterns - m!(0, ..=VAL | VAL_2..); //~ ERROR non-exhaustive patterns - m!(0, ..VAL_1 | VAL_2..); //~ ERROR non-exhaustive patterns + m!(0, ..i32::MAX); //~ ERROR match is non-exhaustive + m!(0, ..ALMOST_MAX); //~ ERROR match is non-exhaustive + m!(0, ALMOST_MIN..); //~ ERROR match is non-exhaustive + m!(0, ..=ALMOST_MAX); //~ ERROR match is non-exhaustive + m!(0, ..=VAL | VAL_2..); //~ ERROR match is non-exhaustive + m!(0, ..VAL_1 | VAL_2..); //~ ERROR match is non-exhaustive } fn i64() { const ALMOST_MAX: i64 = i64::MAX - 1; @@ -144,12 +144,12 @@ mod signed { const VAL: i64 = 42; const VAL_1: i64 = VAL + 1; const VAL_2: i64 = VAL + 2; - m!(0, ..i64::MAX); //~ ERROR non-exhaustive patterns - m!(0, ..ALMOST_MAX); //~ ERROR non-exhaustive patterns - m!(0, ALMOST_MIN..); //~ ERROR non-exhaustive patterns - m!(0, ..=ALMOST_MAX); //~ ERROR non-exhaustive patterns - m!(0, ..=VAL | VAL_2..); //~ ERROR non-exhaustive patterns - m!(0, ..VAL_1 | VAL_2..); //~ ERROR non-exhaustive patterns + m!(0, ..i64::MAX); //~ ERROR match is non-exhaustive + m!(0, ..ALMOST_MAX); //~ ERROR match is non-exhaustive + m!(0, ALMOST_MIN..); //~ ERROR match is non-exhaustive + m!(0, ..=ALMOST_MAX); //~ ERROR match is non-exhaustive + m!(0, ..=VAL | VAL_2..); //~ ERROR match is non-exhaustive + m!(0, ..VAL_1 | VAL_2..); //~ ERROR match is non-exhaustive } fn i128() { const ALMOST_MAX: i128 = i128::MAX - 1; @@ -157,11 +157,11 @@ mod signed { const VAL: i128 = 42; const VAL_1: i128 = VAL + 1; const VAL_2: i128 = VAL + 2; - m!(0, ..i128::MAX); //~ ERROR non-exhaustive patterns - m!(0, ..ALMOST_MAX); //~ ERROR non-exhaustive patterns - m!(0, ALMOST_MIN..); //~ ERROR non-exhaustive patterns - m!(0, ..=ALMOST_MAX); //~ ERROR non-exhaustive patterns - m!(0, ..=VAL | VAL_2..); //~ ERROR non-exhaustive patterns - m!(0, ..VAL_1 | VAL_2..); //~ ERROR non-exhaustive patterns + m!(0, ..i128::MAX); //~ ERROR match is non-exhaustive + m!(0, ..ALMOST_MAX); //~ ERROR match is non-exhaustive + m!(0, ALMOST_MIN..); //~ ERROR match is non-exhaustive + m!(0, ..=ALMOST_MAX); //~ ERROR match is non-exhaustive + m!(0, ..=VAL | VAL_2..); //~ ERROR match is non-exhaustive + m!(0, ..VAL_1 | VAL_2..); //~ ERROR match is non-exhaustive } } diff --git a/tests/ui/half-open-range-patterns/half-open-range-pats-exhaustive-fail.stderr b/tests/ui/half-open-range-patterns/half-open-range-pats-exhaustive-fail.stderr index 6b20a820b7302..09c61bd416a68 100644 --- a/tests/ui/half-open-range-patterns/half-open-range-pats-exhaustive-fail.stderr +++ b/tests/ui/half-open-range-patterns/half-open-range-pats-exhaustive-fail.stderr @@ -1,4 +1,4 @@ -error[E0004]: non-exhaustive patterns: `_` not covered +error[E0004]: match is non-exhaustive --> $DIR/half-open-range-pats-exhaustive-fail.rs:15:8 | LL | m!(0f32, f32::NEG_INFINITY..); @@ -10,7 +10,7 @@ help: ensure that all possible cases are being handled by adding a match arm wit LL | match $s { $($t)+ => {}, _ => todo!() } | ++++++++++++++ -error[E0004]: non-exhaustive patterns: `_` not covered +error[E0004]: match is non-exhaustive --> $DIR/half-open-range-pats-exhaustive-fail.rs:16:8 | LL | m!(0f32, ..f32::INFINITY); @@ -22,7 +22,7 @@ help: ensure that all possible cases are being handled by adding a match arm wit LL | match $s { $($t)+ => {}, _ => todo!() } | ++++++++++++++ -error[E0004]: non-exhaustive patterns: `'\u{10ffff}'` not covered +error[E0004]: match is non-exhaustive --> $DIR/half-open-range-pats-exhaustive-fail.rs:25:8 | LL | m!('a', ..core::char::MAX); @@ -34,7 +34,7 @@ help: ensure that all possible cases are being handled by adding a match arm wit LL | match $s { $($t)+ => {}, '\u{10ffff}' => todo!() } | +++++++++++++++++++++++++ -error[E0004]: non-exhaustive patterns: `'\u{10fffe}'..='\u{10ffff}'` not covered +error[E0004]: match is non-exhaustive --> $DIR/half-open-range-pats-exhaustive-fail.rs:26:8 | LL | m!('a', ..ALMOST_MAX); @@ -46,7 +46,7 @@ help: ensure that all possible cases are being handled by adding a match arm wit LL | match $s { $($t)+ => {}, '\u{10fffe}'..='\u{10ffff}' => todo!() } | ++++++++++++++++++++++++++++++++++++++++ -error[E0004]: non-exhaustive patterns: `'\0'` not covered +error[E0004]: match is non-exhaustive --> $DIR/half-open-range-pats-exhaustive-fail.rs:27:8 | LL | m!('a', ALMOST_MIN..); @@ -58,7 +58,7 @@ help: ensure that all possible cases are being handled by adding a match arm wit LL | match $s { $($t)+ => {}, '\0' => todo!() } | +++++++++++++++++ -error[E0004]: non-exhaustive patterns: `'\u{10ffff}'` not covered +error[E0004]: match is non-exhaustive --> $DIR/half-open-range-pats-exhaustive-fail.rs:28:8 | LL | m!('a', ..=ALMOST_MAX); @@ -70,7 +70,7 @@ help: ensure that all possible cases are being handled by adding a match arm wit LL | match $s { $($t)+ => {}, '\u{10ffff}' => todo!() } | +++++++++++++++++++++++++ -error[E0004]: non-exhaustive patterns: `'b'` not covered +error[E0004]: match is non-exhaustive --> $DIR/half-open-range-pats-exhaustive-fail.rs:29:8 | LL | m!('a', ..=VAL | VAL_2..); @@ -82,7 +82,7 @@ help: ensure that all possible cases are being handled by adding a match arm wit LL | match $s { $($t)+ => {}, 'b' => todo!() } | ++++++++++++++++ -error[E0004]: non-exhaustive patterns: `'b'` not covered +error[E0004]: match is non-exhaustive --> $DIR/half-open-range-pats-exhaustive-fail.rs:30:8 | LL | m!('a', ..VAL_1 | VAL_2..); @@ -94,7 +94,7 @@ help: ensure that all possible cases are being handled by adding a match arm wit LL | match $s { $($t)+ => {}, 'b' => todo!() } | ++++++++++++++++ -error[E0004]: non-exhaustive patterns: `u8::MAX` not covered +error[E0004]: match is non-exhaustive --> $DIR/half-open-range-pats-exhaustive-fail.rs:40:12 | LL | m!(0, ..u8::MAX); @@ -106,7 +106,7 @@ help: ensure that all possible cases are being handled by adding a match arm wit LL | match $s { $($t)+ => {}, u8::MAX => todo!() } | ++++++++++++++++++++ -error[E0004]: non-exhaustive patterns: `254_u8..=u8::MAX` not covered +error[E0004]: match is non-exhaustive --> $DIR/half-open-range-pats-exhaustive-fail.rs:41:12 | LL | m!(0, ..ALMOST_MAX); @@ -118,7 +118,7 @@ help: ensure that all possible cases are being handled by adding a match arm wit LL | match $s { $($t)+ => {}, 254_u8..=u8::MAX => todo!() } | +++++++++++++++++++++++++++++ -error[E0004]: non-exhaustive patterns: `0_u8` not covered +error[E0004]: match is non-exhaustive --> $DIR/half-open-range-pats-exhaustive-fail.rs:42:12 | LL | m!(0, ALMOST_MIN..); @@ -130,7 +130,7 @@ help: ensure that all possible cases are being handled by adding a match arm wit LL | match $s { $($t)+ => {}, 0_u8 => todo!() } | +++++++++++++++++ -error[E0004]: non-exhaustive patterns: `u8::MAX` not covered +error[E0004]: match is non-exhaustive --> $DIR/half-open-range-pats-exhaustive-fail.rs:43:12 | LL | m!(0, ..=ALMOST_MAX); @@ -142,7 +142,7 @@ help: ensure that all possible cases are being handled by adding a match arm wit LL | match $s { $($t)+ => {}, u8::MAX => todo!() } | ++++++++++++++++++++ -error[E0004]: non-exhaustive patterns: `43_u8` not covered +error[E0004]: match is non-exhaustive --> $DIR/half-open-range-pats-exhaustive-fail.rs:44:12 | LL | m!(0, ..=VAL | VAL_2..); @@ -154,7 +154,7 @@ help: ensure that all possible cases are being handled by adding a match arm wit LL | match $s { $($t)+ => {}, 43_u8 => todo!() } | ++++++++++++++++++ -error[E0004]: non-exhaustive patterns: `43_u8` not covered +error[E0004]: match is non-exhaustive --> $DIR/half-open-range-pats-exhaustive-fail.rs:45:12 | LL | m!(0, ..VAL_1 | VAL_2..); @@ -166,7 +166,7 @@ help: ensure that all possible cases are being handled by adding a match arm wit LL | match $s { $($t)+ => {}, 43_u8 => todo!() } | ++++++++++++++++++ -error[E0004]: non-exhaustive patterns: `u16::MAX` not covered +error[E0004]: match is non-exhaustive --> $DIR/half-open-range-pats-exhaustive-fail.rs:53:12 | LL | m!(0, ..u16::MAX); @@ -178,7 +178,7 @@ help: ensure that all possible cases are being handled by adding a match arm wit LL | match $s { $($t)+ => {}, u16::MAX => todo!() } | +++++++++++++++++++++ -error[E0004]: non-exhaustive patterns: `65534_u16..=u16::MAX` not covered +error[E0004]: match is non-exhaustive --> $DIR/half-open-range-pats-exhaustive-fail.rs:54:12 | LL | m!(0, ..ALMOST_MAX); @@ -190,7 +190,7 @@ help: ensure that all possible cases are being handled by adding a match arm wit LL | match $s { $($t)+ => {}, 65534_u16..=u16::MAX => todo!() } | +++++++++++++++++++++++++++++++++ -error[E0004]: non-exhaustive patterns: `0_u16` not covered +error[E0004]: match is non-exhaustive --> $DIR/half-open-range-pats-exhaustive-fail.rs:55:12 | LL | m!(0, ALMOST_MIN..); @@ -202,7 +202,7 @@ help: ensure that all possible cases are being handled by adding a match arm wit LL | match $s { $($t)+ => {}, 0_u16 => todo!() } | ++++++++++++++++++ -error[E0004]: non-exhaustive patterns: `u16::MAX` not covered +error[E0004]: match is non-exhaustive --> $DIR/half-open-range-pats-exhaustive-fail.rs:56:12 | LL | m!(0, ..=ALMOST_MAX); @@ -214,7 +214,7 @@ help: ensure that all possible cases are being handled by adding a match arm wit LL | match $s { $($t)+ => {}, u16::MAX => todo!() } | +++++++++++++++++++++ -error[E0004]: non-exhaustive patterns: `43_u16` not covered +error[E0004]: match is non-exhaustive --> $DIR/half-open-range-pats-exhaustive-fail.rs:57:12 | LL | m!(0, ..=VAL | VAL_2..); @@ -226,7 +226,7 @@ help: ensure that all possible cases are being handled by adding a match arm wit LL | match $s { $($t)+ => {}, 43_u16 => todo!() } | +++++++++++++++++++ -error[E0004]: non-exhaustive patterns: `43_u16` not covered +error[E0004]: match is non-exhaustive --> $DIR/half-open-range-pats-exhaustive-fail.rs:58:12 | LL | m!(0, ..VAL_1 | VAL_2..); @@ -238,7 +238,7 @@ help: ensure that all possible cases are being handled by adding a match arm wit LL | match $s { $($t)+ => {}, 43_u16 => todo!() } | +++++++++++++++++++ -error[E0004]: non-exhaustive patterns: `u32::MAX` not covered +error[E0004]: match is non-exhaustive --> $DIR/half-open-range-pats-exhaustive-fail.rs:66:12 | LL | m!(0, ..u32::MAX); @@ -250,7 +250,7 @@ help: ensure that all possible cases are being handled by adding a match arm wit LL | match $s { $($t)+ => {}, u32::MAX => todo!() } | +++++++++++++++++++++ -error[E0004]: non-exhaustive patterns: `4294967294_u32..=u32::MAX` not covered +error[E0004]: match is non-exhaustive --> $DIR/half-open-range-pats-exhaustive-fail.rs:67:12 | LL | m!(0, ..ALMOST_MAX); @@ -262,7 +262,7 @@ help: ensure that all possible cases are being handled by adding a match arm wit LL | match $s { $($t)+ => {}, 4294967294_u32..=u32::MAX => todo!() } | ++++++++++++++++++++++++++++++++++++++ -error[E0004]: non-exhaustive patterns: `0_u32` not covered +error[E0004]: match is non-exhaustive --> $DIR/half-open-range-pats-exhaustive-fail.rs:68:12 | LL | m!(0, ALMOST_MIN..); @@ -274,7 +274,7 @@ help: ensure that all possible cases are being handled by adding a match arm wit LL | match $s { $($t)+ => {}, 0_u32 => todo!() } | ++++++++++++++++++ -error[E0004]: non-exhaustive patterns: `u32::MAX` not covered +error[E0004]: match is non-exhaustive --> $DIR/half-open-range-pats-exhaustive-fail.rs:69:12 | LL | m!(0, ..=ALMOST_MAX); @@ -286,7 +286,7 @@ help: ensure that all possible cases are being handled by adding a match arm wit LL | match $s { $($t)+ => {}, u32::MAX => todo!() } | +++++++++++++++++++++ -error[E0004]: non-exhaustive patterns: `43_u32` not covered +error[E0004]: match is non-exhaustive --> $DIR/half-open-range-pats-exhaustive-fail.rs:70:12 | LL | m!(0, ..=VAL | VAL_2..); @@ -298,7 +298,7 @@ help: ensure that all possible cases are being handled by adding a match arm wit LL | match $s { $($t)+ => {}, 43_u32 => todo!() } | +++++++++++++++++++ -error[E0004]: non-exhaustive patterns: `43_u32` not covered +error[E0004]: match is non-exhaustive --> $DIR/half-open-range-pats-exhaustive-fail.rs:71:12 | LL | m!(0, ..VAL_1 | VAL_2..); @@ -310,7 +310,7 @@ help: ensure that all possible cases are being handled by adding a match arm wit LL | match $s { $($t)+ => {}, 43_u32 => todo!() } | +++++++++++++++++++ -error[E0004]: non-exhaustive patterns: `u64::MAX` not covered +error[E0004]: match is non-exhaustive --> $DIR/half-open-range-pats-exhaustive-fail.rs:79:12 | LL | m!(0, ..u64::MAX); @@ -322,7 +322,7 @@ help: ensure that all possible cases are being handled by adding a match arm wit LL | match $s { $($t)+ => {}, u64::MAX => todo!() } | +++++++++++++++++++++ -error[E0004]: non-exhaustive patterns: `18446744073709551614_u64..=u64::MAX` not covered +error[E0004]: match is non-exhaustive --> $DIR/half-open-range-pats-exhaustive-fail.rs:80:12 | LL | m!(0, ..ALMOST_MAX); @@ -334,7 +334,7 @@ help: ensure that all possible cases are being handled by adding a match arm wit LL | match $s { $($t)+ => {}, 18446744073709551614_u64..=u64::MAX => todo!() } | ++++++++++++++++++++++++++++++++++++++++++++++++ -error[E0004]: non-exhaustive patterns: `0_u64` not covered +error[E0004]: match is non-exhaustive --> $DIR/half-open-range-pats-exhaustive-fail.rs:81:12 | LL | m!(0, ALMOST_MIN..); @@ -346,7 +346,7 @@ help: ensure that all possible cases are being handled by adding a match arm wit LL | match $s { $($t)+ => {}, 0_u64 => todo!() } | ++++++++++++++++++ -error[E0004]: non-exhaustive patterns: `u64::MAX` not covered +error[E0004]: match is non-exhaustive --> $DIR/half-open-range-pats-exhaustive-fail.rs:82:12 | LL | m!(0, ..=ALMOST_MAX); @@ -358,7 +358,7 @@ help: ensure that all possible cases are being handled by adding a match arm wit LL | match $s { $($t)+ => {}, u64::MAX => todo!() } | +++++++++++++++++++++ -error[E0004]: non-exhaustive patterns: `43_u64` not covered +error[E0004]: match is non-exhaustive --> $DIR/half-open-range-pats-exhaustive-fail.rs:83:12 | LL | m!(0, ..=VAL | VAL_2..); @@ -370,7 +370,7 @@ help: ensure that all possible cases are being handled by adding a match arm wit LL | match $s { $($t)+ => {}, 43_u64 => todo!() } | +++++++++++++++++++ -error[E0004]: non-exhaustive patterns: `43_u64` not covered +error[E0004]: match is non-exhaustive --> $DIR/half-open-range-pats-exhaustive-fail.rs:84:12 | LL | m!(0, ..VAL_1 | VAL_2..); @@ -382,7 +382,7 @@ help: ensure that all possible cases are being handled by adding a match arm wit LL | match $s { $($t)+ => {}, 43_u64 => todo!() } | +++++++++++++++++++ -error[E0004]: non-exhaustive patterns: `u128::MAX` not covered +error[E0004]: match is non-exhaustive --> $DIR/half-open-range-pats-exhaustive-fail.rs:92:12 | LL | m!(0, ..u128::MAX); @@ -394,7 +394,7 @@ help: ensure that all possible cases are being handled by adding a match arm wit LL | match $s { $($t)+ => {}, u128::MAX => todo!() } | ++++++++++++++++++++++ -error[E0004]: non-exhaustive patterns: `340282366920938463463374607431768211454_u128..=u128::MAX` not covered +error[E0004]: match is non-exhaustive --> $DIR/half-open-range-pats-exhaustive-fail.rs:93:12 | LL | m!(0, ..ALMOST_MAX); @@ -406,7 +406,7 @@ help: ensure that all possible cases are being handled by adding a match arm wit LL | match $s { $($t)+ => {}, 340282366920938463463374607431768211454_u128..=u128::MAX => todo!() } | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -error[E0004]: non-exhaustive patterns: `0_u128` not covered +error[E0004]: match is non-exhaustive --> $DIR/half-open-range-pats-exhaustive-fail.rs:94:12 | LL | m!(0, ALMOST_MIN..); @@ -418,7 +418,7 @@ help: ensure that all possible cases are being handled by adding a match arm wit LL | match $s { $($t)+ => {}, 0_u128 => todo!() } | +++++++++++++++++++ -error[E0004]: non-exhaustive patterns: `u128::MAX` not covered +error[E0004]: match is non-exhaustive --> $DIR/half-open-range-pats-exhaustive-fail.rs:95:12 | LL | m!(0, ..=ALMOST_MAX); @@ -430,7 +430,7 @@ help: ensure that all possible cases are being handled by adding a match arm wit LL | match $s { $($t)+ => {}, u128::MAX => todo!() } | ++++++++++++++++++++++ -error[E0004]: non-exhaustive patterns: `43_u128` not covered +error[E0004]: match is non-exhaustive --> $DIR/half-open-range-pats-exhaustive-fail.rs:96:12 | LL | m!(0, ..=VAL | VAL_2..); @@ -442,7 +442,7 @@ help: ensure that all possible cases are being handled by adding a match arm wit LL | match $s { $($t)+ => {}, 43_u128 => todo!() } | ++++++++++++++++++++ -error[E0004]: non-exhaustive patterns: `43_u128` not covered +error[E0004]: match is non-exhaustive --> $DIR/half-open-range-pats-exhaustive-fail.rs:97:12 | LL | m!(0, ..VAL_1 | VAL_2..); @@ -454,7 +454,7 @@ help: ensure that all possible cases are being handled by adding a match arm wit LL | match $s { $($t)+ => {}, 43_u128 => todo!() } | ++++++++++++++++++++ -error[E0004]: non-exhaustive patterns: `i8::MAX` not covered +error[E0004]: match is non-exhaustive --> $DIR/half-open-range-pats-exhaustive-fail.rs:108:12 | LL | m!(0, ..i8::MAX); @@ -466,7 +466,7 @@ help: ensure that all possible cases are being handled by adding a match arm wit LL | match $s { $($t)+ => {}, i8::MAX => todo!() } | ++++++++++++++++++++ -error[E0004]: non-exhaustive patterns: `126_i8..=i8::MAX` not covered +error[E0004]: match is non-exhaustive --> $DIR/half-open-range-pats-exhaustive-fail.rs:109:12 | LL | m!(0, ..ALMOST_MAX); @@ -478,7 +478,7 @@ help: ensure that all possible cases are being handled by adding a match arm wit LL | match $s { $($t)+ => {}, 126_i8..=i8::MAX => todo!() } | +++++++++++++++++++++++++++++ -error[E0004]: non-exhaustive patterns: `i8::MIN` not covered +error[E0004]: match is non-exhaustive --> $DIR/half-open-range-pats-exhaustive-fail.rs:110:12 | LL | m!(0, ALMOST_MIN..); @@ -490,7 +490,7 @@ help: ensure that all possible cases are being handled by adding a match arm wit LL | match $s { $($t)+ => {}, i8::MIN => todo!() } | ++++++++++++++++++++ -error[E0004]: non-exhaustive patterns: `i8::MAX` not covered +error[E0004]: match is non-exhaustive --> $DIR/half-open-range-pats-exhaustive-fail.rs:111:12 | LL | m!(0, ..=ALMOST_MAX); @@ -502,7 +502,7 @@ help: ensure that all possible cases are being handled by adding a match arm wit LL | match $s { $($t)+ => {}, i8::MAX => todo!() } | ++++++++++++++++++++ -error[E0004]: non-exhaustive patterns: `43_i8` not covered +error[E0004]: match is non-exhaustive --> $DIR/half-open-range-pats-exhaustive-fail.rs:112:12 | LL | m!(0, ..=VAL | VAL_2..); @@ -514,7 +514,7 @@ help: ensure that all possible cases are being handled by adding a match arm wit LL | match $s { $($t)+ => {}, 43_i8 => todo!() } | ++++++++++++++++++ -error[E0004]: non-exhaustive patterns: `43_i8` not covered +error[E0004]: match is non-exhaustive --> $DIR/half-open-range-pats-exhaustive-fail.rs:113:12 | LL | m!(0, ..VAL_1 | VAL_2..); @@ -526,7 +526,7 @@ help: ensure that all possible cases are being handled by adding a match arm wit LL | match $s { $($t)+ => {}, 43_i8 => todo!() } | ++++++++++++++++++ -error[E0004]: non-exhaustive patterns: `i16::MAX` not covered +error[E0004]: match is non-exhaustive --> $DIR/half-open-range-pats-exhaustive-fail.rs:121:12 | LL | m!(0, ..i16::MAX); @@ -538,7 +538,7 @@ help: ensure that all possible cases are being handled by adding a match arm wit LL | match $s { $($t)+ => {}, i16::MAX => todo!() } | +++++++++++++++++++++ -error[E0004]: non-exhaustive patterns: `32766_i16..=i16::MAX` not covered +error[E0004]: match is non-exhaustive --> $DIR/half-open-range-pats-exhaustive-fail.rs:122:12 | LL | m!(0, ..ALMOST_MAX); @@ -550,7 +550,7 @@ help: ensure that all possible cases are being handled by adding a match arm wit LL | match $s { $($t)+ => {}, 32766_i16..=i16::MAX => todo!() } | +++++++++++++++++++++++++++++++++ -error[E0004]: non-exhaustive patterns: `i16::MIN` not covered +error[E0004]: match is non-exhaustive --> $DIR/half-open-range-pats-exhaustive-fail.rs:123:12 | LL | m!(0, ALMOST_MIN..); @@ -562,7 +562,7 @@ help: ensure that all possible cases are being handled by adding a match arm wit LL | match $s { $($t)+ => {}, i16::MIN => todo!() } | +++++++++++++++++++++ -error[E0004]: non-exhaustive patterns: `i16::MAX` not covered +error[E0004]: match is non-exhaustive --> $DIR/half-open-range-pats-exhaustive-fail.rs:124:12 | LL | m!(0, ..=ALMOST_MAX); @@ -574,7 +574,7 @@ help: ensure that all possible cases are being handled by adding a match arm wit LL | match $s { $($t)+ => {}, i16::MAX => todo!() } | +++++++++++++++++++++ -error[E0004]: non-exhaustive patterns: `43_i16` not covered +error[E0004]: match is non-exhaustive --> $DIR/half-open-range-pats-exhaustive-fail.rs:125:12 | LL | m!(0, ..=VAL | VAL_2..); @@ -586,7 +586,7 @@ help: ensure that all possible cases are being handled by adding a match arm wit LL | match $s { $($t)+ => {}, 43_i16 => todo!() } | +++++++++++++++++++ -error[E0004]: non-exhaustive patterns: `43_i16` not covered +error[E0004]: match is non-exhaustive --> $DIR/half-open-range-pats-exhaustive-fail.rs:126:12 | LL | m!(0, ..VAL_1 | VAL_2..); @@ -598,7 +598,7 @@ help: ensure that all possible cases are being handled by adding a match arm wit LL | match $s { $($t)+ => {}, 43_i16 => todo!() } | +++++++++++++++++++ -error[E0004]: non-exhaustive patterns: `i32::MAX` not covered +error[E0004]: match is non-exhaustive --> $DIR/half-open-range-pats-exhaustive-fail.rs:134:12 | LL | m!(0, ..i32::MAX); @@ -610,7 +610,7 @@ help: ensure that all possible cases are being handled by adding a match arm wit LL | match $s { $($t)+ => {}, i32::MAX => todo!() } | +++++++++++++++++++++ -error[E0004]: non-exhaustive patterns: `2147483646_i32..=i32::MAX` not covered +error[E0004]: match is non-exhaustive --> $DIR/half-open-range-pats-exhaustive-fail.rs:135:12 | LL | m!(0, ..ALMOST_MAX); @@ -622,7 +622,7 @@ help: ensure that all possible cases are being handled by adding a match arm wit LL | match $s { $($t)+ => {}, 2147483646_i32..=i32::MAX => todo!() } | ++++++++++++++++++++++++++++++++++++++ -error[E0004]: non-exhaustive patterns: `i32::MIN` not covered +error[E0004]: match is non-exhaustive --> $DIR/half-open-range-pats-exhaustive-fail.rs:136:12 | LL | m!(0, ALMOST_MIN..); @@ -634,7 +634,7 @@ help: ensure that all possible cases are being handled by adding a match arm wit LL | match $s { $($t)+ => {}, i32::MIN => todo!() } | +++++++++++++++++++++ -error[E0004]: non-exhaustive patterns: `i32::MAX` not covered +error[E0004]: match is non-exhaustive --> $DIR/half-open-range-pats-exhaustive-fail.rs:137:12 | LL | m!(0, ..=ALMOST_MAX); @@ -646,7 +646,7 @@ help: ensure that all possible cases are being handled by adding a match arm wit LL | match $s { $($t)+ => {}, i32::MAX => todo!() } | +++++++++++++++++++++ -error[E0004]: non-exhaustive patterns: `43_i32` not covered +error[E0004]: match is non-exhaustive --> $DIR/half-open-range-pats-exhaustive-fail.rs:138:12 | LL | m!(0, ..=VAL | VAL_2..); @@ -658,7 +658,7 @@ help: ensure that all possible cases are being handled by adding a match arm wit LL | match $s { $($t)+ => {}, 43_i32 => todo!() } | +++++++++++++++++++ -error[E0004]: non-exhaustive patterns: `43_i32` not covered +error[E0004]: match is non-exhaustive --> $DIR/half-open-range-pats-exhaustive-fail.rs:139:12 | LL | m!(0, ..VAL_1 | VAL_2..); @@ -670,7 +670,7 @@ help: ensure that all possible cases are being handled by adding a match arm wit LL | match $s { $($t)+ => {}, 43_i32 => todo!() } | +++++++++++++++++++ -error[E0004]: non-exhaustive patterns: `i64::MAX` not covered +error[E0004]: match is non-exhaustive --> $DIR/half-open-range-pats-exhaustive-fail.rs:147:12 | LL | m!(0, ..i64::MAX); @@ -682,7 +682,7 @@ help: ensure that all possible cases are being handled by adding a match arm wit LL | match $s { $($t)+ => {}, i64::MAX => todo!() } | +++++++++++++++++++++ -error[E0004]: non-exhaustive patterns: `9223372036854775806_i64..=i64::MAX` not covered +error[E0004]: match is non-exhaustive --> $DIR/half-open-range-pats-exhaustive-fail.rs:148:12 | LL | m!(0, ..ALMOST_MAX); @@ -694,7 +694,7 @@ help: ensure that all possible cases are being handled by adding a match arm wit LL | match $s { $($t)+ => {}, 9223372036854775806_i64..=i64::MAX => todo!() } | +++++++++++++++++++++++++++++++++++++++++++++++ -error[E0004]: non-exhaustive patterns: `i64::MIN` not covered +error[E0004]: match is non-exhaustive --> $DIR/half-open-range-pats-exhaustive-fail.rs:149:12 | LL | m!(0, ALMOST_MIN..); @@ -706,7 +706,7 @@ help: ensure that all possible cases are being handled by adding a match arm wit LL | match $s { $($t)+ => {}, i64::MIN => todo!() } | +++++++++++++++++++++ -error[E0004]: non-exhaustive patterns: `i64::MAX` not covered +error[E0004]: match is non-exhaustive --> $DIR/half-open-range-pats-exhaustive-fail.rs:150:12 | LL | m!(0, ..=ALMOST_MAX); @@ -718,7 +718,7 @@ help: ensure that all possible cases are being handled by adding a match arm wit LL | match $s { $($t)+ => {}, i64::MAX => todo!() } | +++++++++++++++++++++ -error[E0004]: non-exhaustive patterns: `43_i64` not covered +error[E0004]: match is non-exhaustive --> $DIR/half-open-range-pats-exhaustive-fail.rs:151:12 | LL | m!(0, ..=VAL | VAL_2..); @@ -730,7 +730,7 @@ help: ensure that all possible cases are being handled by adding a match arm wit LL | match $s { $($t)+ => {}, 43_i64 => todo!() } | +++++++++++++++++++ -error[E0004]: non-exhaustive patterns: `43_i64` not covered +error[E0004]: match is non-exhaustive --> $DIR/half-open-range-pats-exhaustive-fail.rs:152:12 | LL | m!(0, ..VAL_1 | VAL_2..); @@ -742,7 +742,7 @@ help: ensure that all possible cases are being handled by adding a match arm wit LL | match $s { $($t)+ => {}, 43_i64 => todo!() } | +++++++++++++++++++ -error[E0004]: non-exhaustive patterns: `i128::MAX` not covered +error[E0004]: match is non-exhaustive --> $DIR/half-open-range-pats-exhaustive-fail.rs:160:12 | LL | m!(0, ..i128::MAX); @@ -754,7 +754,7 @@ help: ensure that all possible cases are being handled by adding a match arm wit LL | match $s { $($t)+ => {}, i128::MAX => todo!() } | ++++++++++++++++++++++ -error[E0004]: non-exhaustive patterns: `170141183460469231731687303715884105726_i128..=i128::MAX` not covered +error[E0004]: match is non-exhaustive --> $DIR/half-open-range-pats-exhaustive-fail.rs:161:12 | LL | m!(0, ..ALMOST_MAX); @@ -766,7 +766,7 @@ help: ensure that all possible cases are being handled by adding a match arm wit LL | match $s { $($t)+ => {}, 170141183460469231731687303715884105726_i128..=i128::MAX => todo!() } | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -error[E0004]: non-exhaustive patterns: `i128::MIN` not covered +error[E0004]: match is non-exhaustive --> $DIR/half-open-range-pats-exhaustive-fail.rs:162:12 | LL | m!(0, ALMOST_MIN..); @@ -778,7 +778,7 @@ help: ensure that all possible cases are being handled by adding a match arm wit LL | match $s { $($t)+ => {}, i128::MIN => todo!() } | ++++++++++++++++++++++ -error[E0004]: non-exhaustive patterns: `i128::MAX` not covered +error[E0004]: match is non-exhaustive --> $DIR/half-open-range-pats-exhaustive-fail.rs:163:12 | LL | m!(0, ..=ALMOST_MAX); @@ -790,7 +790,7 @@ help: ensure that all possible cases are being handled by adding a match arm wit LL | match $s { $($t)+ => {}, i128::MAX => todo!() } | ++++++++++++++++++++++ -error[E0004]: non-exhaustive patterns: `43_i128` not covered +error[E0004]: match is non-exhaustive --> $DIR/half-open-range-pats-exhaustive-fail.rs:164:12 | LL | m!(0, ..=VAL | VAL_2..); @@ -802,7 +802,7 @@ help: ensure that all possible cases are being handled by adding a match arm wit LL | match $s { $($t)+ => {}, 43_i128 => todo!() } | ++++++++++++++++++++ -error[E0004]: non-exhaustive patterns: `43_i128` not covered +error[E0004]: match is non-exhaustive --> $DIR/half-open-range-pats-exhaustive-fail.rs:165:12 | LL | m!(0, ..VAL_1 | VAL_2..); diff --git a/tests/ui/issue-94866.rs b/tests/ui/issue-94866.rs index c420348793692..798c1f8670b0a 100644 --- a/tests/ui/issue-94866.rs +++ b/tests/ui/issue-94866.rs @@ -8,7 +8,7 @@ enum Enum { A, B } fn main() { match Enum::A { - //~^ ERROR non-exhaustive patterns + //~^ ERROR match is non-exhaustive Enum::A => m!() } } diff --git a/tests/ui/issue-94866.stderr b/tests/ui/issue-94866.stderr index b3c17ce8974df..82517b2f53ff2 100644 --- a/tests/ui/issue-94866.stderr +++ b/tests/ui/issue-94866.stderr @@ -1,4 +1,4 @@ -error[E0004]: non-exhaustive patterns: `Enum::B` not covered +error[E0004]: match is non-exhaustive --> $DIR/issue-94866.rs:10:11 | LL | match Enum::A { diff --git a/tests/ui/match/match_non_exhaustive.rs b/tests/ui/match/match_non_exhaustive.rs index f162dd60f5033..5eee4310c5725 100644 --- a/tests/ui/match/match_non_exhaustive.rs +++ b/tests/ui/match/match_non_exhaustive.rs @@ -21,12 +21,12 @@ fn main() { match l { L::A => (), L::B => () }; // (except if the match is already non-exhaustive) match l { L::A => () }; - //~^ ERROR: non-exhaustive patterns: `L::B` not covered [E0004] + //~^ ERROR match is non-exhaustive [E0004] // E1 is not visibly uninhabited from here let (e1, e2) = bar(); match e1 {}; //~^ ERROR: non-exhaustive patterns: type `E1` is non-empty [E0004] match e2 { E2::A => (), E2::B => () }; - //~^ ERROR: non-exhaustive patterns: `_` not covered [E0004] + //~^ ERROR match is non-exhaustive [E0004] } diff --git a/tests/ui/match/match_non_exhaustive.stderr b/tests/ui/match/match_non_exhaustive.stderr index 46ee8d5179e6b..8d9d0aff7acc6 100644 --- a/tests/ui/match/match_non_exhaustive.stderr +++ b/tests/ui/match/match_non_exhaustive.stderr @@ -1,4 +1,4 @@ -error[E0004]: non-exhaustive patterns: `L::B` not covered +error[E0004]: match is non-exhaustive --> $DIR/match_non_exhaustive.rs:23:11 | LL | match l { L::A => () }; @@ -34,7 +34,7 @@ LL + _ => todo!(), LL ~ }; | -error[E0004]: non-exhaustive patterns: `_` not covered +error[E0004]: match is non-exhaustive --> $DIR/match_non_exhaustive.rs:30:11 | LL | match e2 { E2::A => (), E2::B => () }; diff --git a/tests/ui/or-patterns/exhaustiveness-non-exhaustive.rs b/tests/ui/or-patterns/exhaustiveness-non-exhaustive.rs index 5999e04e0e2dd..b574814d1c882 100644 --- a/tests/ui/or-patterns/exhaustiveness-non-exhaustive.rs +++ b/tests/ui/or-patterns/exhaustiveness-non-exhaustive.rs @@ -3,15 +3,15 @@ // We wrap patterns in a tuple because top-level or-patterns were special-cased. fn main() { match (0u8, 0u8) { - //~^ ERROR non-exhaustive patterns: `(2_u8..=u8::MAX, _)` + //~^ ERROR match is non-exhaustive (0 | 1, 2 | 3) => {} } match ((0u8,),) { - //~^ ERROR non-exhaustive patterns: `((4_u8..=u8::MAX))` + //~^ ERROR match is non-exhaustive ((0 | 1,) | (2 | 3,),) => {} } match (Some(0u8),) { - //~^ ERROR non-exhaustive patterns: `(Some(2_u8..=u8::MAX))` + //~^ ERROR match is non-exhaustive (None | Some(0 | 1),) => {} } } diff --git a/tests/ui/or-patterns/exhaustiveness-non-exhaustive.stderr b/tests/ui/or-patterns/exhaustiveness-non-exhaustive.stderr index 9aa808e6bc9a6..bfdb4009577d5 100644 --- a/tests/ui/or-patterns/exhaustiveness-non-exhaustive.stderr +++ b/tests/ui/or-patterns/exhaustiveness-non-exhaustive.stderr @@ -1,4 +1,4 @@ -error[E0004]: non-exhaustive patterns: `(2_u8..=u8::MAX, _)` not covered +error[E0004]: match is non-exhaustive --> $DIR/exhaustiveness-non-exhaustive.rs:5:11 | LL | match (0u8, 0u8) { @@ -11,7 +11,7 @@ LL ~ (0 | 1, 2 | 3) => {} LL + (2_u8..=u8::MAX, _) => todo!() | -error[E0004]: non-exhaustive patterns: `((4_u8..=u8::MAX))` not covered +error[E0004]: match is non-exhaustive --> $DIR/exhaustiveness-non-exhaustive.rs:9:11 | LL | match ((0u8,),) { @@ -24,7 +24,7 @@ LL ~ ((0 | 1,) | (2 | 3,),) => {} LL + ((4_u8..=u8::MAX)) => todo!() | -error[E0004]: non-exhaustive patterns: `(Some(2_u8..=u8::MAX))` not covered +error[E0004]: match is non-exhaustive --> $DIR/exhaustiveness-non-exhaustive.rs:13:11 | LL | match (Some(0u8),) { diff --git a/tests/ui/or-patterns/issue-69875-should-have-been-expanded-earlier-non-exhaustive.rs b/tests/ui/or-patterns/issue-69875-should-have-been-expanded-earlier-non-exhaustive.rs index 3538aad5d772f..f5bfa04960ec0 100644 --- a/tests/ui/or-patterns/issue-69875-should-have-been-expanded-earlier-non-exhaustive.rs +++ b/tests/ui/or-patterns/issue-69875-should-have-been-expanded-earlier-non-exhaustive.rs @@ -1,7 +1,7 @@ fn main() { let (0 | (1 | 2)) = 0; //~ ERROR refutable pattern in local binding match 0 { - //~^ ERROR non-exhaustive patterns + //~^ ERROR match is non-exhaustive 0 | (1 | 2) => {} } } diff --git a/tests/ui/or-patterns/issue-69875-should-have-been-expanded-earlier-non-exhaustive.stderr b/tests/ui/or-patterns/issue-69875-should-have-been-expanded-earlier-non-exhaustive.stderr index 4adcf4feee90d..4472773d95569 100644 --- a/tests/ui/or-patterns/issue-69875-should-have-been-expanded-earlier-non-exhaustive.stderr +++ b/tests/ui/or-patterns/issue-69875-should-have-been-expanded-earlier-non-exhaustive.stderr @@ -12,7 +12,7 @@ help: you might want to use `if let` to ignore the variants that aren't matched LL | if let (0 | (1 | 2)) = 0 { todo!() } | ++ ~~~~~~~~~~~ -error[E0004]: non-exhaustive patterns: `i32::MIN..=-1_i32` and `3_i32..=i32::MAX` not covered +error[E0004]: match is non-exhaustive --> $DIR/issue-69875-should-have-been-expanded-earlier-non-exhaustive.rs:3:11 | LL | match 0 { diff --git a/tests/ui/pattern/suggest-adding-appropriate-missing-pattern-excluding-comments.fixed b/tests/ui/pattern/suggest-adding-appropriate-missing-pattern-excluding-comments.fixed index b28dce8810593..e1f27310cfe5c 100644 --- a/tests/ui/pattern/suggest-adding-appropriate-missing-pattern-excluding-comments.fixed +++ b/tests/ui/pattern/suggest-adding-appropriate-missing-pattern-excluding-comments.fixed @@ -1,7 +1,7 @@ // run-rustfix fn main() { - match Some(1) { //~ ERROR non-exhaustive patterns: `None` not covered + match Some(1) { //~ ERROR match is non-exhaustive Some(1) => {} // hello Some(_) => {} diff --git a/tests/ui/pattern/suggest-adding-appropriate-missing-pattern-excluding-comments.rs b/tests/ui/pattern/suggest-adding-appropriate-missing-pattern-excluding-comments.rs index 42493a6327173..07c9ec1a38523 100644 --- a/tests/ui/pattern/suggest-adding-appropriate-missing-pattern-excluding-comments.rs +++ b/tests/ui/pattern/suggest-adding-appropriate-missing-pattern-excluding-comments.rs @@ -1,7 +1,7 @@ // run-rustfix fn main() { - match Some(1) { //~ ERROR non-exhaustive patterns: `None` not covered + match Some(1) { //~ ERROR match is non-exhaustive Some(1) => {} // hello Some(_) => {} diff --git a/tests/ui/pattern/suggest-adding-appropriate-missing-pattern-excluding-comments.stderr b/tests/ui/pattern/suggest-adding-appropriate-missing-pattern-excluding-comments.stderr index 2a016048f2f7a..40062661c2aac 100644 --- a/tests/ui/pattern/suggest-adding-appropriate-missing-pattern-excluding-comments.stderr +++ b/tests/ui/pattern/suggest-adding-appropriate-missing-pattern-excluding-comments.stderr @@ -1,4 +1,4 @@ -error[E0004]: non-exhaustive patterns: `None` not covered +error[E0004]: match is non-exhaustive --> $DIR/suggest-adding-appropriate-missing-pattern-excluding-comments.rs:4:11 | LL | match Some(1) { diff --git a/tests/ui/pattern/usefulness/doc-hidden-non-exhaustive.rs b/tests/ui/pattern/usefulness/doc-hidden-non-exhaustive.rs index 5d4181a30f052..92c85fa98e4e8 100644 --- a/tests/ui/pattern/usefulness/doc-hidden-non-exhaustive.rs +++ b/tests/ui/pattern/usefulness/doc-hidden-non-exhaustive.rs @@ -16,28 +16,28 @@ fn main() { HiddenEnum::A => {} HiddenEnum::B => {} } - //~^^^^ non-exhaustive patterns: `_` not covered + //~^^^^ match is non-exhaustive match HiddenEnum::A { HiddenEnum::A => {} HiddenEnum::C => {} } - //~^^^^ non-exhaustive patterns: `HiddenEnum::B` not covered + //~^^^^ match is non-exhaustive match HiddenEnum::A { HiddenEnum::A => {} } - //~^^^ non-exhaustive patterns: `HiddenEnum::B` and `_` not covered + //~^^^ match is non-exhaustive match None { None => {} Some(HiddenEnum::A) => {} } - //~^^^^ non-exhaustive patterns: `Some(HiddenEnum::B)` and `Some(_)` not covered + //~^^^^ match is non-exhaustive match InCrate::A { InCrate::A => {} InCrate::B => {} } - //~^^^^ non-exhaustive patterns: `InCrate::C` not covered + //~^^^^ match is non-exhaustive } diff --git a/tests/ui/pattern/usefulness/doc-hidden-non-exhaustive.stderr b/tests/ui/pattern/usefulness/doc-hidden-non-exhaustive.stderr index 17e1a2304a13c..8a6d0b7161cba 100644 --- a/tests/ui/pattern/usefulness/doc-hidden-non-exhaustive.stderr +++ b/tests/ui/pattern/usefulness/doc-hidden-non-exhaustive.stderr @@ -1,4 +1,4 @@ -error[E0004]: non-exhaustive patterns: `_` not covered +error[E0004]: match is non-exhaustive --> $DIR/doc-hidden-non-exhaustive.rs:15:11 | LL | match HiddenEnum::A { @@ -16,7 +16,7 @@ LL ~ HiddenEnum::B => {} LL + _ => todo!() | -error[E0004]: non-exhaustive patterns: `HiddenEnum::B` not covered +error[E0004]: match is non-exhaustive --> $DIR/doc-hidden-non-exhaustive.rs:21:11 | LL | match HiddenEnum::A { @@ -37,7 +37,7 @@ LL ~ HiddenEnum::C => {} LL + HiddenEnum::B => todo!() | -error[E0004]: non-exhaustive patterns: `HiddenEnum::B` and `_` not covered +error[E0004]: match is non-exhaustive --> $DIR/doc-hidden-non-exhaustive.rs:27:11 | LL | match HiddenEnum::A { @@ -58,7 +58,7 @@ LL ~ HiddenEnum::A => {} LL + HiddenEnum::B | _ => todo!() | -error[E0004]: non-exhaustive patterns: `Some(HiddenEnum::B)` and `Some(_)` not covered +error[E0004]: match is non-exhaustive --> $DIR/doc-hidden-non-exhaustive.rs:32:11 | LL | match None { @@ -76,7 +76,7 @@ LL ~ Some(HiddenEnum::A) => {} LL + Some(HiddenEnum::B) | Some(_) => todo!() | -error[E0004]: non-exhaustive patterns: `InCrate::C` not covered +error[E0004]: match is non-exhaustive --> $DIR/doc-hidden-non-exhaustive.rs:38:11 | LL | match InCrate::A { diff --git a/tests/ui/pattern/usefulness/empty-match.exhaustive_patterns.stderr b/tests/ui/pattern/usefulness/empty-match.exhaustive_patterns.stderr index 5e12bc1d22f01..3ae6b67f60ed1 100644 --- a/tests/ui/pattern/usefulness/empty-match.exhaustive_patterns.stderr +++ b/tests/ui/pattern/usefulness/empty-match.exhaustive_patterns.stderr @@ -105,7 +105,7 @@ LL | union NonEmptyUnion2 { = note: the matched value is of type `NonEmptyUnion2` = help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern -error[E0004]: non-exhaustive patterns: `NonEmptyEnum1::Foo(_)` not covered +error[E0004]: match is non-exhaustive --> $DIR/empty-match.rs:83:20 | LL | match_no_arms!(NonEmptyEnum1::Foo(true)); @@ -121,7 +121,7 @@ LL | Foo(bool), = note: the matched value is of type `NonEmptyEnum1` = help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern -error[E0004]: non-exhaustive patterns: `NonEmptyEnum2::Foo(_)` and `NonEmptyEnum2::Bar` not covered +error[E0004]: match is non-exhaustive --> $DIR/empty-match.rs:84:20 | LL | match_no_arms!(NonEmptyEnum2::Foo(true)); @@ -139,7 +139,7 @@ LL | Bar, = note: the matched value is of type `NonEmptyEnum2` = help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or multiple match arms -error[E0004]: non-exhaustive patterns: `NonEmptyEnum5::V1`, `NonEmptyEnum5::V2`, `NonEmptyEnum5::V3` and 2 more not covered +error[E0004]: match is non-exhaustive --> $DIR/empty-match.rs:85:20 | LL | match_no_arms!(NonEmptyEnum5::V1); @@ -153,7 +153,7 @@ LL | enum NonEmptyEnum5 { = note: the matched value is of type `NonEmptyEnum5` = help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or multiple match arms -error[E0004]: non-exhaustive patterns: `_` not covered +error[E0004]: match is non-exhaustive --> $DIR/empty-match.rs:87:24 | LL | match_guarded_arm!(0u8); @@ -166,7 +166,7 @@ LL ~ _ if false => {} LL + _ => todo!() | -error[E0004]: non-exhaustive patterns: `NonEmptyStruct1` not covered +error[E0004]: match is non-exhaustive --> $DIR/empty-match.rs:88:24 | LL | match_guarded_arm!(NonEmptyStruct1); @@ -184,7 +184,7 @@ LL ~ _ if false => {} LL + NonEmptyStruct1 => todo!() | -error[E0004]: non-exhaustive patterns: `NonEmptyStruct2(_)` not covered +error[E0004]: match is non-exhaustive --> $DIR/empty-match.rs:89:24 | LL | match_guarded_arm!(NonEmptyStruct2(true)); @@ -202,7 +202,7 @@ LL ~ _ if false => {} LL + NonEmptyStruct2(_) => todo!() | -error[E0004]: non-exhaustive patterns: `NonEmptyUnion1 { .. }` not covered +error[E0004]: match is non-exhaustive --> $DIR/empty-match.rs:90:24 | LL | match_guarded_arm!((NonEmptyUnion1 { foo: () })); @@ -220,7 +220,7 @@ LL ~ _ if false => {} LL + NonEmptyUnion1 { .. } => todo!() | -error[E0004]: non-exhaustive patterns: `NonEmptyUnion2 { .. }` not covered +error[E0004]: match is non-exhaustive --> $DIR/empty-match.rs:91:24 | LL | match_guarded_arm!((NonEmptyUnion2 { foo: () })); @@ -238,7 +238,7 @@ LL ~ _ if false => {} LL + NonEmptyUnion2 { .. } => todo!() | -error[E0004]: non-exhaustive patterns: `NonEmptyEnum1::Foo(_)` not covered +error[E0004]: match is non-exhaustive --> $DIR/empty-match.rs:92:24 | LL | match_guarded_arm!(NonEmptyEnum1::Foo(true)); @@ -258,7 +258,7 @@ LL ~ _ if false => {} LL + NonEmptyEnum1::Foo(_) => todo!() | -error[E0004]: non-exhaustive patterns: `NonEmptyEnum2::Foo(_)` and `NonEmptyEnum2::Bar` not covered +error[E0004]: match is non-exhaustive --> $DIR/empty-match.rs:93:24 | LL | match_guarded_arm!(NonEmptyEnum2::Foo(true)); @@ -280,7 +280,7 @@ LL ~ _ if false => {} LL + NonEmptyEnum2::Foo(_) | NonEmptyEnum2::Bar => todo!() | -error[E0004]: non-exhaustive patterns: `NonEmptyEnum5::V1`, `NonEmptyEnum5::V2`, `NonEmptyEnum5::V3` and 2 more not covered +error[E0004]: match is non-exhaustive --> $DIR/empty-match.rs:94:24 | LL | match_guarded_arm!(NonEmptyEnum5::V1); diff --git a/tests/ui/pattern/usefulness/empty-match.normal.stderr b/tests/ui/pattern/usefulness/empty-match.normal.stderr index 5e12bc1d22f01..3ae6b67f60ed1 100644 --- a/tests/ui/pattern/usefulness/empty-match.normal.stderr +++ b/tests/ui/pattern/usefulness/empty-match.normal.stderr @@ -105,7 +105,7 @@ LL | union NonEmptyUnion2 { = note: the matched value is of type `NonEmptyUnion2` = help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern -error[E0004]: non-exhaustive patterns: `NonEmptyEnum1::Foo(_)` not covered +error[E0004]: match is non-exhaustive --> $DIR/empty-match.rs:83:20 | LL | match_no_arms!(NonEmptyEnum1::Foo(true)); @@ -121,7 +121,7 @@ LL | Foo(bool), = note: the matched value is of type `NonEmptyEnum1` = help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern -error[E0004]: non-exhaustive patterns: `NonEmptyEnum2::Foo(_)` and `NonEmptyEnum2::Bar` not covered +error[E0004]: match is non-exhaustive --> $DIR/empty-match.rs:84:20 | LL | match_no_arms!(NonEmptyEnum2::Foo(true)); @@ -139,7 +139,7 @@ LL | Bar, = note: the matched value is of type `NonEmptyEnum2` = help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or multiple match arms -error[E0004]: non-exhaustive patterns: `NonEmptyEnum5::V1`, `NonEmptyEnum5::V2`, `NonEmptyEnum5::V3` and 2 more not covered +error[E0004]: match is non-exhaustive --> $DIR/empty-match.rs:85:20 | LL | match_no_arms!(NonEmptyEnum5::V1); @@ -153,7 +153,7 @@ LL | enum NonEmptyEnum5 { = note: the matched value is of type `NonEmptyEnum5` = help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or multiple match arms -error[E0004]: non-exhaustive patterns: `_` not covered +error[E0004]: match is non-exhaustive --> $DIR/empty-match.rs:87:24 | LL | match_guarded_arm!(0u8); @@ -166,7 +166,7 @@ LL ~ _ if false => {} LL + _ => todo!() | -error[E0004]: non-exhaustive patterns: `NonEmptyStruct1` not covered +error[E0004]: match is non-exhaustive --> $DIR/empty-match.rs:88:24 | LL | match_guarded_arm!(NonEmptyStruct1); @@ -184,7 +184,7 @@ LL ~ _ if false => {} LL + NonEmptyStruct1 => todo!() | -error[E0004]: non-exhaustive patterns: `NonEmptyStruct2(_)` not covered +error[E0004]: match is non-exhaustive --> $DIR/empty-match.rs:89:24 | LL | match_guarded_arm!(NonEmptyStruct2(true)); @@ -202,7 +202,7 @@ LL ~ _ if false => {} LL + NonEmptyStruct2(_) => todo!() | -error[E0004]: non-exhaustive patterns: `NonEmptyUnion1 { .. }` not covered +error[E0004]: match is non-exhaustive --> $DIR/empty-match.rs:90:24 | LL | match_guarded_arm!((NonEmptyUnion1 { foo: () })); @@ -220,7 +220,7 @@ LL ~ _ if false => {} LL + NonEmptyUnion1 { .. } => todo!() | -error[E0004]: non-exhaustive patterns: `NonEmptyUnion2 { .. }` not covered +error[E0004]: match is non-exhaustive --> $DIR/empty-match.rs:91:24 | LL | match_guarded_arm!((NonEmptyUnion2 { foo: () })); @@ -238,7 +238,7 @@ LL ~ _ if false => {} LL + NonEmptyUnion2 { .. } => todo!() | -error[E0004]: non-exhaustive patterns: `NonEmptyEnum1::Foo(_)` not covered +error[E0004]: match is non-exhaustive --> $DIR/empty-match.rs:92:24 | LL | match_guarded_arm!(NonEmptyEnum1::Foo(true)); @@ -258,7 +258,7 @@ LL ~ _ if false => {} LL + NonEmptyEnum1::Foo(_) => todo!() | -error[E0004]: non-exhaustive patterns: `NonEmptyEnum2::Foo(_)` and `NonEmptyEnum2::Bar` not covered +error[E0004]: match is non-exhaustive --> $DIR/empty-match.rs:93:24 | LL | match_guarded_arm!(NonEmptyEnum2::Foo(true)); @@ -280,7 +280,7 @@ LL ~ _ if false => {} LL + NonEmptyEnum2::Foo(_) | NonEmptyEnum2::Bar => todo!() | -error[E0004]: non-exhaustive patterns: `NonEmptyEnum5::V1`, `NonEmptyEnum5::V2`, `NonEmptyEnum5::V3` and 2 more not covered +error[E0004]: match is non-exhaustive --> $DIR/empty-match.rs:94:24 | LL | match_guarded_arm!(NonEmptyEnum5::V1); diff --git a/tests/ui/pattern/usefulness/empty-match.rs b/tests/ui/pattern/usefulness/empty-match.rs index 9cdc0413ba10f..a2c11813c8391 100644 --- a/tests/ui/pattern/usefulness/empty-match.rs +++ b/tests/ui/pattern/usefulness/empty-match.rs @@ -80,16 +80,16 @@ fn main() { match_no_arms!(NonEmptyStruct2(true)); //~ ERROR type `NonEmptyStruct2` is non-empty match_no_arms!((NonEmptyUnion1 { foo: () })); //~ ERROR type `NonEmptyUnion1` is non-empty match_no_arms!((NonEmptyUnion2 { foo: () })); //~ ERROR type `NonEmptyUnion2` is non-empty - match_no_arms!(NonEmptyEnum1::Foo(true)); //~ ERROR `NonEmptyEnum1::Foo(_)` not covered - match_no_arms!(NonEmptyEnum2::Foo(true)); //~ ERROR `NonEmptyEnum2::Foo(_)` and `NonEmptyEnum2::Bar` not covered - match_no_arms!(NonEmptyEnum5::V1); //~ ERROR `NonEmptyEnum5::V1`, `NonEmptyEnum5::V2`, `NonEmptyEnum5::V3` and 2 more not covered + match_no_arms!(NonEmptyEnum1::Foo(true)); //~ ERROR match is non-exhaustive [E0004] + match_no_arms!(NonEmptyEnum2::Foo(true)); //~ ERROR match is non-exhaustive [E0004] + match_no_arms!(NonEmptyEnum5::V1); //~ ERROR match is non-exhaustive [E0004] - match_guarded_arm!(0u8); //~ ERROR `_` not covered - match_guarded_arm!(NonEmptyStruct1); //~ ERROR `NonEmptyStruct1` not covered - match_guarded_arm!(NonEmptyStruct2(true)); //~ ERROR `NonEmptyStruct2(_)` not covered - match_guarded_arm!((NonEmptyUnion1 { foo: () })); //~ ERROR `NonEmptyUnion1 { .. }` not covered - match_guarded_arm!((NonEmptyUnion2 { foo: () })); //~ ERROR `NonEmptyUnion2 { .. }` not covered - match_guarded_arm!(NonEmptyEnum1::Foo(true)); //~ ERROR `NonEmptyEnum1::Foo(_)` not covered - match_guarded_arm!(NonEmptyEnum2::Foo(true)); //~ ERROR `NonEmptyEnum2::Foo(_)` and `NonEmptyEnum2::Bar` not covered - match_guarded_arm!(NonEmptyEnum5::V1); //~ ERROR `NonEmptyEnum5::V1`, `NonEmptyEnum5::V2`, `NonEmptyEnum5::V3` and 2 more not covered + match_guarded_arm!(0u8); //~ ERROR match is non-exhaustive [E0004] + match_guarded_arm!(NonEmptyStruct1); //~ ERROR match is non-exhaustive [E0004] + match_guarded_arm!(NonEmptyStruct2(true)); //~ ERROR match is non-exhaustive [E0004] + match_guarded_arm!((NonEmptyUnion1 { foo: () })); //~ ERROR match is non-exhaustive [E0004] + match_guarded_arm!((NonEmptyUnion2 { foo: () })); //~ ERROR match is non-exhaustive [E0004] + match_guarded_arm!(NonEmptyEnum1::Foo(true)); //~ ERROR match is non-exhaustive [E0004] + match_guarded_arm!(NonEmptyEnum2::Foo(true)); //~ ERROR match is non-exhaustive [E0004] + match_guarded_arm!(NonEmptyEnum5::V1); //~ ERROR match is non-exhaustive [E0004] } diff --git a/tests/ui/pattern/usefulness/floats.rs b/tests/ui/pattern/usefulness/floats.rs index 095f5ac9a8970..448075069b056 100644 --- a/tests/ui/pattern/usefulness/floats.rs +++ b/tests/ui/pattern/usefulness/floats.rs @@ -7,7 +7,7 @@ fn main() { _ => {} // ok } - match 0.0 { //~ ERROR non-exhaustive patterns + match 0.0 { //~ ERROR match is non-exhaustive 0.0..=1.0 => {} } diff --git a/tests/ui/pattern/usefulness/floats.stderr b/tests/ui/pattern/usefulness/floats.stderr index c926e50b3580b..983767e45f09b 100644 --- a/tests/ui/pattern/usefulness/floats.stderr +++ b/tests/ui/pattern/usefulness/floats.stderr @@ -1,4 +1,4 @@ -error[E0004]: non-exhaustive patterns: `_` not covered +error[E0004]: match is non-exhaustive --> $DIR/floats.rs:10:11 | LL | match 0.0 { diff --git a/tests/ui/pattern/usefulness/guards.rs b/tests/ui/pattern/usefulness/guards.rs index b15440cf608bd..15804e5d8b6c0 100644 --- a/tests/ui/pattern/usefulness/guards.rs +++ b/tests/ui/pattern/usefulness/guards.rs @@ -9,7 +9,7 @@ pub fn main() { _ => {} } - match 0u8 { //~ ERROR non-exhaustive patterns + match 0u8 { //~ ERROR match is non-exhaustive 0 .. 128 => {} 128 ..= 255 if true => {} } diff --git a/tests/ui/pattern/usefulness/guards.stderr b/tests/ui/pattern/usefulness/guards.stderr index 0c1563c160c1c..c1af6837861f6 100644 --- a/tests/ui/pattern/usefulness/guards.stderr +++ b/tests/ui/pattern/usefulness/guards.stderr @@ -1,4 +1,4 @@ -error[E0004]: non-exhaustive patterns: `128_u8..=u8::MAX` not covered +error[E0004]: match is non-exhaustive --> $DIR/guards.rs:12:11 | LL | match 0u8 { diff --git a/tests/ui/pattern/usefulness/integer-ranges/exhaustiveness.rs b/tests/ui/pattern/usefulness/integer-ranges/exhaustiveness.rs index 0f5f49c4ca473..e215d8dd23e1b 100644 --- a/tests/ui/pattern/usefulness/integer-ranges/exhaustiveness.rs +++ b/tests/ui/pattern/usefulness/integer-ranges/exhaustiveness.rs @@ -44,21 +44,21 @@ fn main() { let '\u{0000}'..='\u{10FFFF}' = 'v'; // Almost exhaustive - m!(0u8, 0..255); //~ ERROR non-exhaustive patterns - m!(0u8, 0..=254); //~ ERROR non-exhaustive patterns - m!(0u8, 1..=255); //~ ERROR non-exhaustive patterns - m!(0u8, 0..42 | 43..=255); //~ ERROR non-exhaustive patterns - m!(0i8, -128..127); //~ ERROR non-exhaustive patterns - m!(0i8, -128..=126); //~ ERROR non-exhaustive patterns - m!(0i8, -127..=127); //~ ERROR non-exhaustive patterns - match 0i8 { //~ ERROR non-exhaustive patterns + m!(0u8, 0..255); //~ ERROR match is non-exhaustive + m!(0u8, 0..=254); //~ ERROR match is non-exhaustive + m!(0u8, 1..=255); //~ ERROR match is non-exhaustive + m!(0u8, 0..42 | 43..=255); //~ ERROR match is non-exhaustive + m!(0i8, -128..127); //~ ERROR match is non-exhaustive + m!(0i8, -128..=126); //~ ERROR match is non-exhaustive + m!(0i8, -127..=127); //~ ERROR match is non-exhaustive + match 0i8 { //~ ERROR match is non-exhaustive i8::MIN ..= -1 => {} 1 ..= i8::MAX => {} } const ALMOST_MAX: u128 = u128::MAX - 1; - m!(0u128, 0..=ALMOST_MAX); //~ ERROR non-exhaustive patterns - m!(0u128, 0..=4); //~ ERROR non-exhaustive patterns - m!(0u128, 1..=u128::MAX); //~ ERROR non-exhaustive patterns + m!(0u128, 0..=ALMOST_MAX); //~ ERROR match is non-exhaustive + m!(0u128, 0..=4); //~ ERROR match is non-exhaustive + m!(0u128, 1..=u128::MAX); //~ ERROR match is non-exhaustive // More complicatedly (non-)exhaustive match 0u8 { @@ -66,7 +66,7 @@ fn main() { 20 ..= 70 => {} 50 ..= 255 => {} } - match (0u8, true) { //~ ERROR non-exhaustive patterns + match (0u8, true) { //~ ERROR match is non-exhaustive (0 ..= 125, false) => {} (128 ..= 255, false) => {} (0 ..= 255, true) => {} diff --git a/tests/ui/pattern/usefulness/integer-ranges/exhaustiveness.stderr b/tests/ui/pattern/usefulness/integer-ranges/exhaustiveness.stderr index f30ba05dff9e4..a41f03b857cc7 100644 --- a/tests/ui/pattern/usefulness/integer-ranges/exhaustiveness.stderr +++ b/tests/ui/pattern/usefulness/integer-ranges/exhaustiveness.stderr @@ -1,4 +1,4 @@ -error[E0004]: non-exhaustive patterns: `u8::MAX` not covered +error[E0004]: match is non-exhaustive --> $DIR/exhaustiveness.rs:47:8 | LL | m!(0u8, 0..255); @@ -10,7 +10,7 @@ help: ensure that all possible cases are being handled by adding a match arm wit LL | match $s { $($t)+ => {}, u8::MAX => todo!() } | ++++++++++++++++++++ -error[E0004]: non-exhaustive patterns: `u8::MAX` not covered +error[E0004]: match is non-exhaustive --> $DIR/exhaustiveness.rs:48:8 | LL | m!(0u8, 0..=254); @@ -22,7 +22,7 @@ help: ensure that all possible cases are being handled by adding a match arm wit LL | match $s { $($t)+ => {}, u8::MAX => todo!() } | ++++++++++++++++++++ -error[E0004]: non-exhaustive patterns: `0_u8` not covered +error[E0004]: match is non-exhaustive --> $DIR/exhaustiveness.rs:49:8 | LL | m!(0u8, 1..=255); @@ -34,7 +34,7 @@ help: ensure that all possible cases are being handled by adding a match arm wit LL | match $s { $($t)+ => {}, 0_u8 => todo!() } | +++++++++++++++++ -error[E0004]: non-exhaustive patterns: `42_u8` not covered +error[E0004]: match is non-exhaustive --> $DIR/exhaustiveness.rs:50:8 | LL | m!(0u8, 0..42 | 43..=255); @@ -46,7 +46,7 @@ help: ensure that all possible cases are being handled by adding a match arm wit LL | match $s { $($t)+ => {}, 42_u8 => todo!() } | ++++++++++++++++++ -error[E0004]: non-exhaustive patterns: `i8::MAX` not covered +error[E0004]: match is non-exhaustive --> $DIR/exhaustiveness.rs:51:8 | LL | m!(0i8, -128..127); @@ -58,7 +58,7 @@ help: ensure that all possible cases are being handled by adding a match arm wit LL | match $s { $($t)+ => {}, i8::MAX => todo!() } | ++++++++++++++++++++ -error[E0004]: non-exhaustive patterns: `i8::MAX` not covered +error[E0004]: match is non-exhaustive --> $DIR/exhaustiveness.rs:52:8 | LL | m!(0i8, -128..=126); @@ -70,7 +70,7 @@ help: ensure that all possible cases are being handled by adding a match arm wit LL | match $s { $($t)+ => {}, i8::MAX => todo!() } | ++++++++++++++++++++ -error[E0004]: non-exhaustive patterns: `i8::MIN` not covered +error[E0004]: match is non-exhaustive --> $DIR/exhaustiveness.rs:53:8 | LL | m!(0i8, -127..=127); @@ -82,7 +82,7 @@ help: ensure that all possible cases are being handled by adding a match arm wit LL | match $s { $($t)+ => {}, i8::MIN => todo!() } | ++++++++++++++++++++ -error[E0004]: non-exhaustive patterns: `0_i8` not covered +error[E0004]: match is non-exhaustive --> $DIR/exhaustiveness.rs:54:11 | LL | match 0i8 { @@ -95,7 +95,7 @@ LL ~ 1 ..= i8::MAX => {} LL + 0_i8 => todo!() | -error[E0004]: non-exhaustive patterns: `u128::MAX` not covered +error[E0004]: match is non-exhaustive --> $DIR/exhaustiveness.rs:59:8 | LL | m!(0u128, 0..=ALMOST_MAX); @@ -107,7 +107,7 @@ help: ensure that all possible cases are being handled by adding a match arm wit LL | match $s { $($t)+ => {}, u128::MAX => todo!() } | ++++++++++++++++++++++ -error[E0004]: non-exhaustive patterns: `5_u128..=u128::MAX` not covered +error[E0004]: match is non-exhaustive --> $DIR/exhaustiveness.rs:60:8 | LL | m!(0u128, 0..=4); @@ -119,7 +119,7 @@ help: ensure that all possible cases are being handled by adding a match arm wit LL | match $s { $($t)+ => {}, 5_u128..=u128::MAX => todo!() } | +++++++++++++++++++++++++++++++ -error[E0004]: non-exhaustive patterns: `0_u128` not covered +error[E0004]: match is non-exhaustive --> $DIR/exhaustiveness.rs:61:8 | LL | m!(0u128, 1..=u128::MAX); @@ -131,7 +131,7 @@ help: ensure that all possible cases are being handled by adding a match arm wit LL | match $s { $($t)+ => {}, 0_u128 => todo!() } | +++++++++++++++++++ -error[E0004]: non-exhaustive patterns: `(126_u8..=127_u8, false)` not covered +error[E0004]: match is non-exhaustive --> $DIR/exhaustiveness.rs:69:11 | LL | match (0u8, true) { diff --git a/tests/ui/pattern/usefulness/integer-ranges/pointer-sized-int.deny.stderr b/tests/ui/pattern/usefulness/integer-ranges/pointer-sized-int.deny.stderr index e3eb98ccdcda5..15e30df356cbf 100644 --- a/tests/ui/pattern/usefulness/integer-ranges/pointer-sized-int.deny.stderr +++ b/tests/ui/pattern/usefulness/integer-ranges/pointer-sized-int.deny.stderr @@ -1,4 +1,4 @@ -error[E0004]: non-exhaustive patterns: `_` not covered +error[E0004]: match is non-exhaustive --> $DIR/pointer-sized-int.rs:12:11 | LL | match 0usize { @@ -13,7 +13,7 @@ LL ~ 0 ..= usize::MAX => {} LL + _ => todo!() | -error[E0004]: non-exhaustive patterns: `_` not covered +error[E0004]: match is non-exhaustive --> $DIR/pointer-sized-int.rs:17:11 | LL | match 0isize { @@ -28,7 +28,7 @@ LL ~ isize::MIN ..= isize::MAX => {} LL + _ => todo!() | -error[E0004]: non-exhaustive patterns: `_` not covered +error[E0004]: match is non-exhaustive --> $DIR/pointer-sized-int.rs:22:8 | LL | m!(0usize, 0..=usize::MAX); @@ -42,7 +42,7 @@ help: ensure that all possible cases are being handled by adding a match arm wit LL | match $s { $($t)+ => {}, _ => todo!() } | ++++++++++++++ -error[E0004]: non-exhaustive patterns: `_` not covered +error[E0004]: match is non-exhaustive --> $DIR/pointer-sized-int.rs:24:8 | LL | m!(0usize, 0..5 | 5..=usize::MAX); @@ -56,7 +56,7 @@ help: ensure that all possible cases are being handled by adding a match arm wit LL | match $s { $($t)+ => {}, _ => todo!() } | ++++++++++++++ -error[E0004]: non-exhaustive patterns: `_` not covered +error[E0004]: match is non-exhaustive --> $DIR/pointer-sized-int.rs:26:8 | LL | m!(0usize, 0..usize::MAX | usize::MAX); @@ -70,7 +70,7 @@ help: ensure that all possible cases are being handled by adding a match arm wit LL | match $s { $($t)+ => {}, _ => todo!() } | ++++++++++++++ -error[E0004]: non-exhaustive patterns: `(_, _)` not covered +error[E0004]: match is non-exhaustive --> $DIR/pointer-sized-int.rs:28:8 | LL | m!((0usize, true), (0..5, true) | (5..=usize::MAX, true) | (0..=usize::MAX, false)); @@ -82,7 +82,7 @@ help: ensure that all possible cases are being handled by adding a match arm wit LL | match $s { $($t)+ => {}, (_, _) => todo!() } | +++++++++++++++++++ -error[E0004]: non-exhaustive patterns: `_` not covered +error[E0004]: match is non-exhaustive --> $DIR/pointer-sized-int.rs:31:8 | LL | m!(0isize, isize::MIN..=isize::MAX); @@ -96,7 +96,7 @@ help: ensure that all possible cases are being handled by adding a match arm wit LL | match $s { $($t)+ => {}, _ => todo!() } | ++++++++++++++ -error[E0004]: non-exhaustive patterns: `_` not covered +error[E0004]: match is non-exhaustive --> $DIR/pointer-sized-int.rs:33:8 | LL | m!(0isize, isize::MIN..5 | 5..=isize::MAX); @@ -110,7 +110,7 @@ help: ensure that all possible cases are being handled by adding a match arm wit LL | match $s { $($t)+ => {}, _ => todo!() } | ++++++++++++++ -error[E0004]: non-exhaustive patterns: `_` not covered +error[E0004]: match is non-exhaustive --> $DIR/pointer-sized-int.rs:35:8 | LL | m!(0isize, isize::MIN..isize::MAX | isize::MAX); @@ -124,7 +124,7 @@ help: ensure that all possible cases are being handled by adding a match arm wit LL | match $s { $($t)+ => {}, _ => todo!() } | ++++++++++++++ -error[E0004]: non-exhaustive patterns: `(_, _)` not covered +error[E0004]: match is non-exhaustive --> $DIR/pointer-sized-int.rs:37:8 | LL | m!((0isize, true), (isize::MIN..5, true) @@ -136,7 +136,7 @@ help: ensure that all possible cases are being handled by adding a match arm wit LL | match $s { $($t)+ => {}, (_, _) => todo!() } | +++++++++++++++++++ -error[E0004]: non-exhaustive patterns: `_` not covered +error[E0004]: match is non-exhaustive --> $DIR/pointer-sized-int.rs:41:11 | LL | match 0isize { diff --git a/tests/ui/pattern/usefulness/integer-ranges/pointer-sized-int.rs b/tests/ui/pattern/usefulness/integer-ranges/pointer-sized-int.rs index 1ed18c2676358..e37b789ddd360 100644 --- a/tests/ui/pattern/usefulness/integer-ranges/pointer-sized-int.rs +++ b/tests/ui/pattern/usefulness/integer-ranges/pointer-sized-int.rs @@ -10,36 +10,36 @@ macro_rules! m { fn main() { match 0usize { - //[deny]~^ ERROR non-exhaustive patterns + //[deny]~^ ERROR match is non-exhaustive 0 ..= usize::MAX => {} } match 0isize { - //[deny]~^ ERROR non-exhaustive patterns + //[deny]~^ ERROR match is non-exhaustive isize::MIN ..= isize::MAX => {} } m!(0usize, 0..=usize::MAX); - //[deny]~^ ERROR non-exhaustive patterns + //[deny]~^ ERROR match is non-exhaustive m!(0usize, 0..5 | 5..=usize::MAX); - //[deny]~^ ERROR non-exhaustive patterns + //[deny]~^ ERROR match is non-exhaustive m!(0usize, 0..usize::MAX | usize::MAX); - //[deny]~^ ERROR non-exhaustive patterns + //[deny]~^ ERROR match is non-exhaustive m!((0usize, true), (0..5, true) | (5..=usize::MAX, true) | (0..=usize::MAX, false)); - //[deny]~^ ERROR non-exhaustive patterns + //[deny]~^ ERROR match is non-exhaustive m!(0isize, isize::MIN..=isize::MAX); - //[deny]~^ ERROR non-exhaustive patterns + //[deny]~^ ERROR match is non-exhaustive m!(0isize, isize::MIN..5 | 5..=isize::MAX); - //[deny]~^ ERROR non-exhaustive patterns + //[deny]~^ ERROR match is non-exhaustive m!(0isize, isize::MIN..isize::MAX | isize::MAX); - //[deny]~^ ERROR non-exhaustive patterns + //[deny]~^ ERROR match is non-exhaustive m!((0isize, true), (isize::MIN..5, true) | (5..=isize::MAX, true) | (isize::MIN..=isize::MAX, false)); - //[deny]~^^ ERROR non-exhaustive patterns + //[deny]~^^ ERROR match is non-exhaustive match 0isize { - //[deny]~^ ERROR non-exhaustive patterns + //[deny]~^ ERROR match is non-exhaustive isize::MIN ..= -1 => {} 0 => {} 1 ..= isize::MAX => {} diff --git a/tests/ui/pattern/usefulness/integer-ranges/precise_pointer_matching-message.rs b/tests/ui/pattern/usefulness/integer-ranges/precise_pointer_matching-message.rs index a2aa655ca5413..275f0d7369639 100644 --- a/tests/ui/pattern/usefulness/integer-ranges/precise_pointer_matching-message.rs +++ b/tests/ui/pattern/usefulness/integer-ranges/precise_pointer_matching-message.rs @@ -1,7 +1,7 @@ // This tests that the lint message explains the reason for the error. fn main() { match 0usize { - //~^ ERROR non-exhaustive patterns: `_` not covered + //~^ ERROR match is non-exhaustive //~| NOTE pattern `_` not covered //~| NOTE the matched value is of type `usize` //~| NOTE `usize` does not have a fixed maximum value @@ -9,7 +9,7 @@ fn main() { } match 0isize { - //~^ ERROR non-exhaustive patterns: `_` not covered + //~^ ERROR match is non-exhaustive //~| NOTE pattern `_` not covered //~| NOTE the matched value is of type `isize` //~| NOTE `isize` does not have a fixed maximum value diff --git a/tests/ui/pattern/usefulness/integer-ranges/precise_pointer_matching-message.stderr b/tests/ui/pattern/usefulness/integer-ranges/precise_pointer_matching-message.stderr index 30492c98206c9..f950e01587334 100644 --- a/tests/ui/pattern/usefulness/integer-ranges/precise_pointer_matching-message.stderr +++ b/tests/ui/pattern/usefulness/integer-ranges/precise_pointer_matching-message.stderr @@ -1,4 +1,4 @@ -error[E0004]: non-exhaustive patterns: `_` not covered +error[E0004]: match is non-exhaustive --> $DIR/precise_pointer_matching-message.rs:3:11 | LL | match 0usize { @@ -13,7 +13,7 @@ LL ~ 0..=usize::MAX => {} LL + _ => todo!() | -error[E0004]: non-exhaustive patterns: `_` not covered +error[E0004]: match is non-exhaustive --> $DIR/precise_pointer_matching-message.rs:11:11 | LL | match 0isize { diff --git a/tests/ui/pattern/usefulness/issue-15129.rs b/tests/ui/pattern/usefulness/issue-15129.rs index f02e5c0c6f8a7..ba8efe79fed06 100644 --- a/tests/ui/pattern/usefulness/issue-15129.rs +++ b/tests/ui/pattern/usefulness/issue-15129.rs @@ -10,7 +10,7 @@ pub enum V { fn main() { match (T::T1(()), V::V2(true)) { - //~^ ERROR non-exhaustive patterns: `(T::T1(()), V::V2(_))` and `(T::T2(()), V::V1(_))` not covered + //~^ ERROR match is non-exhaustive (T::T1(()), V::V1(i)) => (), (T::T2(()), V::V2(b)) => (), } diff --git a/tests/ui/pattern/usefulness/issue-15129.stderr b/tests/ui/pattern/usefulness/issue-15129.stderr index ee8410b765089..9b91c806d39e7 100644 --- a/tests/ui/pattern/usefulness/issue-15129.stderr +++ b/tests/ui/pattern/usefulness/issue-15129.stderr @@ -1,4 +1,4 @@ -error[E0004]: non-exhaustive patterns: `(T::T1(()), V::V2(_))` and `(T::T2(()), V::V1(_))` not covered +error[E0004]: match is non-exhaustive --> $DIR/issue-15129.rs:12:11 | LL | match (T::T1(()), V::V2(true)) { diff --git a/tests/ui/pattern/usefulness/issue-2111.rs b/tests/ui/pattern/usefulness/issue-2111.rs index d27beaeffd637..913dc94713598 100644 --- a/tests/ui/pattern/usefulness/issue-2111.rs +++ b/tests/ui/pattern/usefulness/issue-2111.rs @@ -1,6 +1,6 @@ fn foo(a: Option, b: Option) { match (a, b) { - //~^ ERROR: non-exhaustive patterns: `(None, None)` and `(Some(_), Some(_))` not covered + //~^ ERROR: match is non-exhaustive (Some(a), Some(b)) if a == b => {} (Some(_), None) | (None, Some(_)) => {} } diff --git a/tests/ui/pattern/usefulness/issue-2111.stderr b/tests/ui/pattern/usefulness/issue-2111.stderr index 01890b73cbdd8..226c29c995de8 100644 --- a/tests/ui/pattern/usefulness/issue-2111.stderr +++ b/tests/ui/pattern/usefulness/issue-2111.stderr @@ -1,4 +1,4 @@ -error[E0004]: non-exhaustive patterns: `(None, None)` and `(Some(_), Some(_))` not covered +error[E0004]: match is non-exhaustive --> $DIR/issue-2111.rs:2:11 | LL | match (a, b) { diff --git a/tests/ui/pattern/usefulness/issue-30240.rs b/tests/ui/pattern/usefulness/issue-30240.rs index a0c0d1626ec45..eaaa61143b449 100644 --- a/tests/ui/pattern/usefulness/issue-30240.rs +++ b/tests/ui/pattern/usefulness/issue-30240.rs @@ -1,9 +1,9 @@ fn main() { - match "world" { //~ ERROR non-exhaustive patterns: `&_` + match "world" { //~ ERROR match is non-exhaustive "hello" => {} } - match "world" { //~ ERROR non-exhaustive patterns: `&_` + match "world" { //~ ERROR match is non-exhaustive ref _x if false => {} "hello" => {} } diff --git a/tests/ui/pattern/usefulness/issue-30240.stderr b/tests/ui/pattern/usefulness/issue-30240.stderr index 759fdeafe4eb5..0b4c8bd585063 100644 --- a/tests/ui/pattern/usefulness/issue-30240.stderr +++ b/tests/ui/pattern/usefulness/issue-30240.stderr @@ -1,4 +1,4 @@ -error[E0004]: non-exhaustive patterns: `&_` not covered +error[E0004]: match is non-exhaustive --> $DIR/issue-30240.rs:2:11 | LL | match "world" { @@ -11,7 +11,7 @@ LL ~ "hello" => {} LL + &_ => todo!() | -error[E0004]: non-exhaustive patterns: `&_` not covered +error[E0004]: match is non-exhaustive --> $DIR/issue-30240.rs:6:11 | LL | match "world" { diff --git a/tests/ui/pattern/usefulness/issue-35609.stderr b/tests/ui/pattern/usefulness/issue-35609.stderr index 12113957d6340..61c4b4963e22b 100644 --- a/tests/ui/pattern/usefulness/issue-35609.stderr +++ b/tests/ui/pattern/usefulness/issue-35609.stderr @@ -1,4 +1,4 @@ -error[E0004]: non-exhaustive patterns: `(Enum::B, _)`, `(Enum::C, _)`, `(Enum::D, _)` and 2 more not covered +error[E0004]: match is non-exhaustive --> $DIR/issue-35609.rs:10:11 | LL | match (A, ()) { @@ -11,7 +11,7 @@ LL ~ (A, _) => {} LL + _ => todo!() | -error[E0004]: non-exhaustive patterns: `(_, Enum::B)`, `(_, Enum::C)`, `(_, Enum::D)` and 2 more not covered +error[E0004]: match is non-exhaustive --> $DIR/issue-35609.rs:14:11 | LL | match (A, A) { @@ -24,7 +24,7 @@ LL ~ (_, A) => {} LL + _ => todo!() | -error[E0004]: non-exhaustive patterns: `((Enum::B, _), _)`, `((Enum::C, _), _)`, `((Enum::D, _), _)` and 2 more not covered +error[E0004]: match is non-exhaustive --> $DIR/issue-35609.rs:18:11 | LL | match ((A, ()), ()) { @@ -37,7 +37,7 @@ LL ~ ((A, ()), _) => {} LL + _ => todo!() | -error[E0004]: non-exhaustive patterns: `((Enum::B, _), _)`, `((Enum::C, _), _)`, `((Enum::D, _), _)` and 2 more not covered +error[E0004]: match is non-exhaustive --> $DIR/issue-35609.rs:22:11 | LL | match ((A, ()), A) { @@ -50,7 +50,7 @@ LL ~ ((A, ()), _) => {} LL + _ => todo!() | -error[E0004]: non-exhaustive patterns: `((Enum::B, _), _)`, `((Enum::C, _), _)`, `((Enum::D, _), _)` and 2 more not covered +error[E0004]: match is non-exhaustive --> $DIR/issue-35609.rs:26:11 | LL | match ((A, ()), ()) { @@ -63,7 +63,7 @@ LL ~ ((A, _), _) => {} LL + _ => todo!() | -error[E0004]: non-exhaustive patterns: `S(Enum::B, _)`, `S(Enum::C, _)`, `S(Enum::D, _)` and 2 more not covered +error[E0004]: match is non-exhaustive --> $DIR/issue-35609.rs:31:11 | LL | match S(A, ()) { @@ -81,7 +81,7 @@ LL ~ S(A, _) => {} LL + _ => todo!() | -error[E0004]: non-exhaustive patterns: `Sd { x: Enum::B, .. }`, `Sd { x: Enum::C, .. }`, `Sd { x: Enum::D, .. }` and 2 more not covered +error[E0004]: match is non-exhaustive --> $DIR/issue-35609.rs:35:11 | LL | match (Sd { x: A, y: () }) { @@ -99,7 +99,7 @@ LL ~ Sd { x: A, y: _ } => {} LL + _ => todo!() | -error[E0004]: non-exhaustive patterns: `Some(Enum::B)`, `Some(Enum::C)`, `Some(Enum::D)` and 2 more not covered +error[E0004]: match is non-exhaustive --> $DIR/issue-35609.rs:39:11 | LL | match Some(A) { diff --git a/tests/ui/pattern/usefulness/issue-3601.rs b/tests/ui/pattern/usefulness/issue-3601.rs index 6215a23980d6d..86983ff087dd8 100644 --- a/tests/ui/pattern/usefulness/issue-3601.rs +++ b/tests/ui/pattern/usefulness/issue-3601.rs @@ -27,7 +27,7 @@ fn main() { // n.b. span could be better match n.kind { - box NodeKind::Element(ed) => match ed.kind { //~ ERROR non-exhaustive patterns + box NodeKind::Element(ed) => match ed.kind { //~ ERROR match is non-exhaustive box ElementKind::HTMLImageElement(ref d) if d.image.is_some() => { true } }, }; diff --git a/tests/ui/pattern/usefulness/issue-3601.stderr b/tests/ui/pattern/usefulness/issue-3601.stderr index 59d7bcd4b5e79..139c31b97a75b 100644 --- a/tests/ui/pattern/usefulness/issue-3601.stderr +++ b/tests/ui/pattern/usefulness/issue-3601.stderr @@ -1,4 +1,4 @@ -error[E0004]: non-exhaustive patterns: `box _` not covered +error[E0004]: match is non-exhaustive --> $DIR/issue-3601.rs:30:44 | LL | box NodeKind::Element(ed) => match ed.kind { diff --git a/tests/ui/pattern/usefulness/issue-39362.rs b/tests/ui/pattern/usefulness/issue-39362.rs index ea3c8f88e0b36..c23ed1454a152 100644 --- a/tests/ui/pattern/usefulness/issue-39362.rs +++ b/tests/ui/pattern/usefulness/issue-39362.rs @@ -8,7 +8,7 @@ enum Bar { fn test(f: Foo) { match f { - //~^ ERROR non-exhaustive patterns + //~^ ERROR match is non-exhaustive //~| patterns Foo::Bar { bar: Bar::A, .. } => (), Foo::Bar { bar: Bar::B, .. } => (), diff --git a/tests/ui/pattern/usefulness/issue-39362.stderr b/tests/ui/pattern/usefulness/issue-39362.stderr index b8b17918aef8c..39d951181d5b6 100644 --- a/tests/ui/pattern/usefulness/issue-39362.stderr +++ b/tests/ui/pattern/usefulness/issue-39362.stderr @@ -1,4 +1,4 @@ -error[E0004]: non-exhaustive patterns: `Foo::Bar { bar: Bar::C, .. }`, `Foo::Bar { bar: Bar::D, .. }`, `Foo::Bar { bar: Bar::E, .. }` and 1 more not covered +error[E0004]: match is non-exhaustive --> $DIR/issue-39362.rs:10:11 | LL | match f { diff --git a/tests/ui/pattern/usefulness/issue-40221.rs b/tests/ui/pattern/usefulness/issue-40221.rs index e1f7e975b80e4..0e1d45654a623 100644 --- a/tests/ui/pattern/usefulness/issue-40221.rs +++ b/tests/ui/pattern/usefulness/issue-40221.rs @@ -8,7 +8,7 @@ enum PC { } fn test(proto: P) { - match proto { //~ ERROR non-exhaustive patterns + match proto { //~ ERROR match is non-exhaustive P::C(PC::Q) => (), } } diff --git a/tests/ui/pattern/usefulness/issue-40221.stderr b/tests/ui/pattern/usefulness/issue-40221.stderr index 4973e42b05447..e8a8f974ee089 100644 --- a/tests/ui/pattern/usefulness/issue-40221.stderr +++ b/tests/ui/pattern/usefulness/issue-40221.stderr @@ -1,4 +1,4 @@ -error[E0004]: non-exhaustive patterns: `P::C(PC::QA)` not covered +error[E0004]: match is non-exhaustive --> $DIR/issue-40221.rs:11:11 | LL | match proto { diff --git a/tests/ui/pattern/usefulness/issue-4321.rs b/tests/ui/pattern/usefulness/issue-4321.rs index 9715f2eba2fc8..ef1692cb8ec85 100644 --- a/tests/ui/pattern/usefulness/issue-4321.rs +++ b/tests/ui/pattern/usefulness/issue-4321.rs @@ -1,6 +1,6 @@ fn main() { let tup = (true, true); - println!("foo {:}", match tup { //~ ERROR non-exhaustive patterns: `(true, false)` not covered + println!("foo {:}", match tup { //~ ERROR match is non-exhaustive (false, false) => "foo", (false, true) => "bar", (true, true) => "baz" diff --git a/tests/ui/pattern/usefulness/issue-4321.stderr b/tests/ui/pattern/usefulness/issue-4321.stderr index 2932731741016..db556de6f13a6 100644 --- a/tests/ui/pattern/usefulness/issue-4321.stderr +++ b/tests/ui/pattern/usefulness/issue-4321.stderr @@ -1,4 +1,4 @@ -error[E0004]: non-exhaustive patterns: `(true, false)` not covered +error[E0004]: match is non-exhaustive --> $DIR/issue-4321.rs:3:31 | LL | println!("foo {:}", match tup { diff --git a/tests/ui/pattern/usefulness/issue-50900.rs b/tests/ui/pattern/usefulness/issue-50900.rs index 9cc760e9a10d7..c6e4d90d3c795 100644 --- a/tests/ui/pattern/usefulness/issue-50900.rs +++ b/tests/ui/pattern/usefulness/issue-50900.rs @@ -13,7 +13,7 @@ impl Tag { fn main() { match Tag::ExifIFDPointer { - //~^ ERROR: non-exhaustive patterns: `Tag(Context::Exif, _)` not covered + //~^ ERROR: match is non-exhaustive Tag::ExifIFDPointer => {} } } diff --git a/tests/ui/pattern/usefulness/issue-50900.stderr b/tests/ui/pattern/usefulness/issue-50900.stderr index 348246d28aaca..07f2e66d3764d 100644 --- a/tests/ui/pattern/usefulness/issue-50900.stderr +++ b/tests/ui/pattern/usefulness/issue-50900.stderr @@ -1,4 +1,4 @@ -error[E0004]: non-exhaustive patterns: `Tag(Context::Exif, _)` not covered +error[E0004]: match is non-exhaustive --> $DIR/issue-50900.rs:15:11 | LL | match Tag::ExifIFDPointer { diff --git a/tests/ui/pattern/usefulness/issue-56379.rs b/tests/ui/pattern/usefulness/issue-56379.rs index 097cf98d0126b..73aa12c2ed4c6 100644 --- a/tests/ui/pattern/usefulness/issue-56379.rs +++ b/tests/ui/pattern/usefulness/issue-56379.rs @@ -6,7 +6,7 @@ enum Foo { fn main() { match Foo::A(true) { - //~^ ERROR non-exhaustive patterns: `Foo::A(false)`, `Foo::B(false)` and `Foo::C(false)` not covered + //~^ ERROR match is non-exhaustive Foo::A(true) => {} Foo::B(true) => {} Foo::C(true) => {} diff --git a/tests/ui/pattern/usefulness/issue-56379.stderr b/tests/ui/pattern/usefulness/issue-56379.stderr index 6eed6bfae4c90..390300fd99e0f 100644 --- a/tests/ui/pattern/usefulness/issue-56379.stderr +++ b/tests/ui/pattern/usefulness/issue-56379.stderr @@ -1,4 +1,4 @@ -error[E0004]: non-exhaustive patterns: `Foo::A(false)`, `Foo::B(false)` and `Foo::C(false)` not covered +error[E0004]: match is non-exhaustive --> $DIR/issue-56379.rs:8:11 | LL | match Foo::A(true) { diff --git a/tests/ui/pattern/usefulness/issue-72377.rs b/tests/ui/pattern/usefulness/issue-72377.rs index b5ad3075ca725..039315471fead 100644 --- a/tests/ui/pattern/usefulness/issue-72377.rs +++ b/tests/ui/pattern/usefulness/issue-72377.rs @@ -6,7 +6,7 @@ fn main() { let y = Some(X::A); match (x, y) { - //~^ ERROR non-exhaustive patterns: `(X::A, Some(X::A))`, `(X::A, Some(X::B))`, `(X::B, Some(X::B))` and 2 + //~^ ERROR match is non-exhaustive //~| more not covered (_, None) => false, (v, Some(w)) if v == w => true, diff --git a/tests/ui/pattern/usefulness/issue-72377.stderr b/tests/ui/pattern/usefulness/issue-72377.stderr index 123dd051d2495..97db8ec7ffce4 100644 --- a/tests/ui/pattern/usefulness/issue-72377.stderr +++ b/tests/ui/pattern/usefulness/issue-72377.stderr @@ -1,4 +1,4 @@ -error[E0004]: non-exhaustive patterns: `(X::A, Some(X::A))`, `(X::A, Some(X::B))`, `(X::B, Some(X::B))` and 2 more not covered +error[E0004]: match is non-exhaustive --> $DIR/issue-72377.rs:8:11 | LL | match (x, y) { diff --git a/tests/ui/pattern/usefulness/match-arm-statics-2.rs b/tests/ui/pattern/usefulness/match-arm-statics-2.rs index 3c9c16561c028..3d84de71fd032 100644 --- a/tests/ui/pattern/usefulness/match-arm-statics-2.rs +++ b/tests/ui/pattern/usefulness/match-arm-statics-2.rs @@ -15,7 +15,7 @@ const TRUE_TRUE: (bool, bool) = (true, true); fn nonexhaustive_1() { match (true, false) { - //~^ ERROR non-exhaustive patterns: `(true, false)` not covered + //~^ ERROR match is non-exhaustive TRUE_TRUE => (), (false, false) => (), (false, true) => () @@ -27,7 +27,7 @@ const EAST: Direction = East; fn nonexhaustive_2() { match Some(Some(North)) { - //~^ ERROR non-exhaustive patterns: `Some(Some(Direction::West))` not covered + //~^ ERROR match is non-exhaustive Some(NONE) => (), Some(Some(North)) => (), Some(Some(EAST)) => (), @@ -46,7 +46,7 @@ const STATIC_FOO: Foo = Foo { bar: None, baz: NEW_FALSE }; fn nonexhaustive_3() { match (Foo { bar: Some(North), baz: NewBool(true) }) { - //~^ ERROR non-exhaustive patterns: `Foo { bar: Some(Direction::North), baz: NewBool(true) }` + //~^ ERROR match is non-exhaustive Foo { bar: None, baz: NewBool(true) } => (), Foo { bar: _, baz: NEW_FALSE } => (), Foo { bar: Some(West), baz: NewBool(true) } => (), diff --git a/tests/ui/pattern/usefulness/match-arm-statics-2.stderr b/tests/ui/pattern/usefulness/match-arm-statics-2.stderr index e4dd35a59958e..a16a23469504b 100644 --- a/tests/ui/pattern/usefulness/match-arm-statics-2.stderr +++ b/tests/ui/pattern/usefulness/match-arm-statics-2.stderr @@ -1,4 +1,4 @@ -error[E0004]: non-exhaustive patterns: `(true, false)` not covered +error[E0004]: match is non-exhaustive --> $DIR/match-arm-statics-2.rs:17:11 | LL | match (true, false) { @@ -11,7 +11,7 @@ LL ~ (false, true) => (), LL + (true, false) => todo!() | -error[E0004]: non-exhaustive patterns: `Some(Some(Direction::West))` not covered +error[E0004]: match is non-exhaustive --> $DIR/match-arm-statics-2.rs:29:11 | LL | match Some(Some(North)) { @@ -31,7 +31,7 @@ LL ~ None => (), LL + Some(Some(Direction::West)) => todo!() | -error[E0004]: non-exhaustive patterns: `Foo { bar: Some(Direction::North), baz: NewBool(true) }` not covered +error[E0004]: match is non-exhaustive --> $DIR/match-arm-statics-2.rs:48:11 | LL | match (Foo { bar: Some(North), baz: NewBool(true) }) { diff --git a/tests/ui/pattern/usefulness/match-byte-array-patterns-2.stderr b/tests/ui/pattern/usefulness/match-byte-array-patterns-2.stderr index a90f32f7aebf3..6068063e300c3 100644 --- a/tests/ui/pattern/usefulness/match-byte-array-patterns-2.stderr +++ b/tests/ui/pattern/usefulness/match-byte-array-patterns-2.stderr @@ -1,4 +1,4 @@ -error[E0004]: non-exhaustive patterns: `&[0_u8..=64_u8, _, _, _]` and `&[66_u8..=u8::MAX, _, _, _]` not covered +error[E0004]: match is non-exhaustive --> $DIR/match-byte-array-patterns-2.rs:4:11 | LL | match buf { @@ -11,7 +11,7 @@ LL ~ b"AAAA" => {} LL + &[0_u8..=64_u8, _, _, _] | &[66_u8..=u8::MAX, _, _, _] => todo!() | -error[E0004]: non-exhaustive patterns: `&[]`, `&[_]`, `&[_, _]` and 2 more not covered +error[E0004]: match is non-exhaustive --> $DIR/match-byte-array-patterns-2.rs:10:11 | LL | match buf { diff --git a/tests/ui/pattern/usefulness/match-non-exhaustive.rs b/tests/ui/pattern/usefulness/match-non-exhaustive.rs index 3b210a115d21a..6748488a92774 100644 --- a/tests/ui/pattern/usefulness/match-non-exhaustive.rs +++ b/tests/ui/pattern/usefulness/match-non-exhaustive.rs @@ -1,4 +1,4 @@ fn main() { - match 0 { 1 => () } //~ ERROR non-exhaustive patterns - match 0 { 0 if false => () } //~ ERROR non-exhaustive patterns + match 0 { 1 => () } //~ ERROR match is non-exhaustive [E0004] + match 0 { 0 if false => () } //~ ERROR match is non-exhaustive [E0004] } diff --git a/tests/ui/pattern/usefulness/match-non-exhaustive.stderr b/tests/ui/pattern/usefulness/match-non-exhaustive.stderr index 08dde523a15fb..56140e055b8e6 100644 --- a/tests/ui/pattern/usefulness/match-non-exhaustive.stderr +++ b/tests/ui/pattern/usefulness/match-non-exhaustive.stderr @@ -1,4 +1,4 @@ -error[E0004]: non-exhaustive patterns: `i32::MIN..=0_i32` and `2_i32..=i32::MAX` not covered +error[E0004]: match is non-exhaustive --> $DIR/match-non-exhaustive.rs:2:11 | LL | match 0 { 1 => () } @@ -10,7 +10,7 @@ help: ensure that all possible cases are being handled by adding a match arm wit LL | match 0 { 1 => (), i32::MIN..=0_i32 | 2_i32..=i32::MAX => todo!() } | ++++++++++++++++++++++++++++++++++++++++++++++++ -error[E0004]: non-exhaustive patterns: `_` not covered +error[E0004]: match is non-exhaustive --> $DIR/match-non-exhaustive.rs:3:11 | LL | match 0 { 0 if false => () } diff --git a/tests/ui/pattern/usefulness/match-privately-empty.rs b/tests/ui/pattern/usefulness/match-privately-empty.rs index 315eb03d16564..008ddbb643e85 100644 --- a/tests/ui/pattern/usefulness/match-privately-empty.rs +++ b/tests/ui/pattern/usefulness/match-privately-empty.rs @@ -11,7 +11,7 @@ mod private { fn main() { match private::DATA { - //~^ ERROR non-exhaustive patterns: `Some(Private { misc: true, .. })` not covered + //~^ ERROR match is non-exhaustive None => {} Some(private::Private { misc: false, diff --git a/tests/ui/pattern/usefulness/match-privately-empty.stderr b/tests/ui/pattern/usefulness/match-privately-empty.stderr index 86f75d15cfde7..6d241b343bc1e 100644 --- a/tests/ui/pattern/usefulness/match-privately-empty.stderr +++ b/tests/ui/pattern/usefulness/match-privately-empty.stderr @@ -1,4 +1,4 @@ -error[E0004]: non-exhaustive patterns: `Some(Private { misc: true, .. })` not covered +error[E0004]: match is non-exhaustive --> $DIR/match-privately-empty.rs:13:11 | LL | match private::DATA { diff --git a/tests/ui/pattern/usefulness/match-slice-patterns.rs b/tests/ui/pattern/usefulness/match-slice-patterns.rs index 92d74b8c229d6..75d46067530a4 100644 --- a/tests/ui/pattern/usefulness/match-slice-patterns.rs +++ b/tests/ui/pattern/usefulness/match-slice-patterns.rs @@ -1,6 +1,6 @@ fn check(list: &[Option<()>]) { match list { - //~^ ERROR `&[_, Some(_), .., None, _]` not covered + //~^ ERROR match is non-exhaustive [E0004] &[] => {}, &[_] => {}, &[_, _] => {}, diff --git a/tests/ui/pattern/usefulness/match-slice-patterns.stderr b/tests/ui/pattern/usefulness/match-slice-patterns.stderr index 961dd59011961..516d58d4c8b8a 100644 --- a/tests/ui/pattern/usefulness/match-slice-patterns.stderr +++ b/tests/ui/pattern/usefulness/match-slice-patterns.stderr @@ -1,4 +1,4 @@ -error[E0004]: non-exhaustive patterns: `&[_, Some(_), .., None, _]` not covered +error[E0004]: match is non-exhaustive --> $DIR/match-slice-patterns.rs:2:11 | LL | match list { diff --git a/tests/ui/pattern/usefulness/non-exhaustive-defined-here.rs b/tests/ui/pattern/usefulness/non-exhaustive-defined-here.rs index 5145f769075d9..f8a8c4a2c0de6 100644 --- a/tests/ui/pattern/usefulness/non-exhaustive-defined-here.rs +++ b/tests/ui/pattern/usefulness/non-exhaustive-defined-here.rs @@ -32,7 +32,7 @@ enum E { fn by_val(e: E) { let e1 = e.clone(); - match e1 { //~ ERROR non-exhaustive patterns: `E::B` and `E::C` not covered + match e1 { //~ ERROR match is non-exhaustive //~^ NOTE patterns `E::B` and `E::C` not covered //~| NOTE the matched value is of type `E` E::A => {} @@ -48,7 +48,7 @@ fn by_val(e: E) { fn by_ref_once(e: &E) { match e { - //~^ ERROR non-exhaustive patterns + //~^ ERROR match is non-exhaustive //~| patterns `&E::B` and `&E::C` not covered //~| NOTE the matched value is of type `&E` E::A => {} @@ -64,7 +64,7 @@ fn by_ref_once(e: &E) { fn by_ref_thrice(e: & &mut &E) { match e { - //~^ ERROR non-exhaustive patterns + //~^ ERROR match is non-exhaustive //~| patterns `&&mut &E::B` and `&&mut &E::C` not covered //~| NOTE the matched value is of type `&&mut &E` E::A => {} @@ -90,7 +90,7 @@ enum Opt { fn ref_pat(e: Opt) { match e { - //~^ ERROR non-exhaustive patterns + //~^ ERROR match is non-exhaustive //~| pattern `Opt::None` not covered //~| NOTE the matched value is of type `Opt` Opt::Some(ref _x) => {} diff --git a/tests/ui/pattern/usefulness/non-exhaustive-defined-here.stderr b/tests/ui/pattern/usefulness/non-exhaustive-defined-here.stderr index 769d4070fb587..cf08d57d91ba1 100644 --- a/tests/ui/pattern/usefulness/non-exhaustive-defined-here.stderr +++ b/tests/ui/pattern/usefulness/non-exhaustive-defined-here.stderr @@ -1,4 +1,4 @@ -error[E0004]: non-exhaustive patterns: `E::B` and `E::C` not covered +error[E0004]: match is non-exhaustive --> $DIR/non-exhaustive-defined-here.rs:35:11 | LL | match e1 { @@ -47,7 +47,7 @@ help: you might want to use `if let` to ignore the variants that aren't matched LL | if let E::A = e { todo!() } | ++ ~~~~~~~~~~~ -error[E0004]: non-exhaustive patterns: `&E::B` and `&E::C` not covered +error[E0004]: match is non-exhaustive --> $DIR/non-exhaustive-defined-here.rs:50:11 | LL | match e { @@ -96,7 +96,7 @@ help: you might want to use `if let` to ignore the variants that aren't matched LL | if let E::A = e { todo!() } | ++ ~~~~~~~~~~~ -error[E0004]: non-exhaustive patterns: `&&mut &E::B` and `&&mut &E::C` not covered +error[E0004]: match is non-exhaustive --> $DIR/non-exhaustive-defined-here.rs:66:11 | LL | match e { @@ -145,7 +145,7 @@ help: you might want to use `if let` to ignore the variants that aren't matched LL | if let E::A = e { todo!() } | ++ ~~~~~~~~~~~ -error[E0004]: non-exhaustive patterns: `Opt::None` not covered +error[E0004]: match is non-exhaustive --> $DIR/non-exhaustive-defined-here.rs:92:11 | LL | match e { diff --git a/tests/ui/pattern/usefulness/non-exhaustive-match-nested.rs b/tests/ui/pattern/usefulness/non-exhaustive-match-nested.rs index 69c3c76580a7a..f4ac74a81b68c 100644 --- a/tests/ui/pattern/usefulness/non-exhaustive-match-nested.rs +++ b/tests/ui/pattern/usefulness/non-exhaustive-match-nested.rs @@ -2,7 +2,7 @@ enum T { A(U), B } enum U { C, D } fn match_nested_vecs<'a, T>(l1: Option<&'a [T]>, l2: Result<&'a [T], ()>) -> &'static str { - match (l1, l2) { //~ ERROR non-exhaustive patterns: `(Some(&[]), Err(_))` not covered + match (l1, l2) { //~ ERROR match is non-exhaustive (Some(&[]), Ok(&[])) => "Some(empty), Ok(empty)", (Some(&[_, ..]), Ok(_)) | (Some(&[_, ..]), Err(())) => "Some(non-empty), any", (None, Ok(&[])) | (None, Err(())) | (None, Ok(&[_])) => "None, Ok(less than one element)", @@ -12,7 +12,7 @@ fn match_nested_vecs<'a, T>(l1: Option<&'a [T]>, l2: Result<&'a [T], ()>) -> &'s fn main() { let x = T::A(U::C); - match x { //~ ERROR non-exhaustive patterns: `T::A(U::C)` not covered + match x { //~ ERROR match is non-exhaustive T::A(U::D) => { panic!("hello"); } T::B => { panic!("goodbye"); } } diff --git a/tests/ui/pattern/usefulness/non-exhaustive-match-nested.stderr b/tests/ui/pattern/usefulness/non-exhaustive-match-nested.stderr index 44f327421109a..5ce7dbce832cd 100644 --- a/tests/ui/pattern/usefulness/non-exhaustive-match-nested.stderr +++ b/tests/ui/pattern/usefulness/non-exhaustive-match-nested.stderr @@ -1,4 +1,4 @@ -error[E0004]: non-exhaustive patterns: `(Some(&[]), Err(_))` not covered +error[E0004]: match is non-exhaustive --> $DIR/non-exhaustive-match-nested.rs:5:11 | LL | match (l1, l2) { @@ -11,7 +11,7 @@ LL ~ (None, Ok(&[_, _, ..])) => "None, Ok(at least two elements)", LL + (Some(&[]), Err(_)) => todo!() | -error[E0004]: non-exhaustive patterns: `T::A(U::C)` not covered +error[E0004]: match is non-exhaustive --> $DIR/non-exhaustive-match-nested.rs:15:11 | LL | match x { diff --git a/tests/ui/pattern/usefulness/non-exhaustive-match.rs b/tests/ui/pattern/usefulness/non-exhaustive-match.rs index 1cb58b8cebef7..994513cb12820 100644 --- a/tests/ui/pattern/usefulness/non-exhaustive-match.rs +++ b/tests/ui/pattern/usefulness/non-exhaustive-match.rs @@ -4,22 +4,22 @@ enum T { A, B } fn main() { let x = T::A; - match x { T::B => { } } //~ ERROR non-exhaustive patterns: `T::A` not covered - match true { //~ ERROR non-exhaustive patterns: `false` not covered + match x { T::B => { } } //~ ERROR match is non-exhaustive + match true { //~ ERROR match is non-exhaustive true => {} } - match Some(10) { //~ ERROR non-exhaustive patterns: `Some(_)` not covered + match Some(10) { //~ ERROR match is non-exhaustive None => {} } - match (2, 3, 4) { //~ ERROR non-exhaustive patterns: `(_, _, i32::MIN..=3_i32)` + match (2, 3, 4) { //~ ERROR match is non-exhaustive // and `(_, _, 5_i32..=i32::MAX)` not covered (_, _, 4) => {} } - match (T::A, T::A) { //~ ERROR non-exhaustive patterns: `(T::A, T::A)` and `(T::B, T::B)` not covered + match (T::A, T::A) { //~ ERROR match is non-exhaustive (T::A, T::B) => {} (T::B, T::A) => {} } - match T::A { //~ ERROR non-exhaustive patterns: `T::B` not covered + match T::A { //~ ERROR match is non-exhaustive T::A => {} } // This is exhaustive, though the algorithm got it wrong at one point @@ -30,7 +30,7 @@ fn main() { } let vec = vec![Some(42), None, Some(21)]; let vec: &[Option] = &vec; - match *vec { //~ ERROR non-exhaustive patterns: `[]` not covered + match *vec { //~ ERROR match is non-exhaustive [Some(..), None, ref tail @ ..] => {} [Some(..), Some(..), ref tail @ ..] => {} [None] => {} @@ -43,7 +43,7 @@ fn main() { } let vec = vec![0.5f32]; let vec: &[f32] = &vec; - match *vec { //~ ERROR non-exhaustive patterns: `[_, _, _, _, ..]` not covered + match *vec { //~ ERROR match is non-exhaustive [0.1, 0.2, 0.3] => (), [0.1, 0.2] => (), [0.1] => (), diff --git a/tests/ui/pattern/usefulness/non-exhaustive-match.stderr b/tests/ui/pattern/usefulness/non-exhaustive-match.stderr index e2260f50bfef2..bdbaa02c0b5a3 100644 --- a/tests/ui/pattern/usefulness/non-exhaustive-match.stderr +++ b/tests/ui/pattern/usefulness/non-exhaustive-match.stderr @@ -1,4 +1,4 @@ -error[E0004]: non-exhaustive patterns: `T::A` not covered +error[E0004]: match is non-exhaustive --> $DIR/non-exhaustive-match.rs:7:11 | LL | match x { T::B => { } } @@ -15,7 +15,7 @@ help: ensure that all possible cases are being handled by adding a match arm wit LL | match x { T::B => { }, T::A => todo!() } | +++++++++++++++++ -error[E0004]: non-exhaustive patterns: `false` not covered +error[E0004]: match is non-exhaustive --> $DIR/non-exhaustive-match.rs:8:11 | LL | match true { @@ -28,7 +28,7 @@ LL ~ true => {} LL + false => todo!() | -error[E0004]: non-exhaustive patterns: `Some(_)` not covered +error[E0004]: match is non-exhaustive --> $DIR/non-exhaustive-match.rs:11:11 | LL | match Some(10) { @@ -46,7 +46,7 @@ LL ~ None => {} LL + Some(_) => todo!() | -error[E0004]: non-exhaustive patterns: `(_, _, i32::MIN..=3_i32)` and `(_, _, 5_i32..=i32::MAX)` not covered +error[E0004]: match is non-exhaustive --> $DIR/non-exhaustive-match.rs:14:11 | LL | match (2, 3, 4) { @@ -59,7 +59,7 @@ LL ~ (_, _, 4) => {} LL + (_, _, i32::MIN..=3_i32) | (_, _, 5_i32..=i32::MAX) => todo!() | -error[E0004]: non-exhaustive patterns: `(T::A, T::A)` and `(T::B, T::B)` not covered +error[E0004]: match is non-exhaustive --> $DIR/non-exhaustive-match.rs:18:11 | LL | match (T::A, T::A) { @@ -72,7 +72,7 @@ LL ~ (T::B, T::A) => {} LL + (T::A, T::A) | (T::B, T::B) => todo!() | -error[E0004]: non-exhaustive patterns: `T::B` not covered +error[E0004]: match is non-exhaustive --> $DIR/non-exhaustive-match.rs:22:11 | LL | match T::A { @@ -90,7 +90,7 @@ LL ~ T::A => {} LL + T::B => todo!() | -error[E0004]: non-exhaustive patterns: `[]` not covered +error[E0004]: match is non-exhaustive --> $DIR/non-exhaustive-match.rs:33:11 | LL | match *vec { @@ -103,7 +103,7 @@ LL ~ [None] => {} LL + [] => todo!() | -error[E0004]: non-exhaustive patterns: `[_, _, _, _, ..]` not covered +error[E0004]: match is non-exhaustive --> $DIR/non-exhaustive-match.rs:46:11 | LL | match *vec { diff --git a/tests/ui/pattern/usefulness/non-exhaustive-pattern-witness.rs b/tests/ui/pattern/usefulness/non-exhaustive-pattern-witness.rs index 4bd34421922bd..905c39ef5da22 100644 --- a/tests/ui/pattern/usefulness/non-exhaustive-pattern-witness.rs +++ b/tests/ui/pattern/usefulness/non-exhaustive-pattern-witness.rs @@ -5,7 +5,7 @@ struct Foo { fn struct_with_a_nested_enum_and_vector() { match (Foo { first: true, second: None }) { -//~^ ERROR non-exhaustive patterns: `Foo { first: false, second: Some([_, _, _, _]) }` not covered +//~^ ERROR match is non-exhaustive Foo { first: true, second: None } => (), Foo { first: true, second: Some(_) } => (), Foo { first: false, second: None } => (), @@ -21,7 +21,7 @@ enum Color { fn enum_with_single_missing_variant() { match Color::Red { - //~^ ERROR non-exhaustive patterns: `Color::Red` not covered + //~^ ERROR match is non-exhaustive Color::CustomRGBA { .. } => (), Color::Green => () } @@ -33,7 +33,7 @@ enum Direction { fn enum_with_multiple_missing_variants() { match Direction::North { - //~^ ERROR non-exhaustive patterns: `Direction::East`, `Direction::South` and `Direction::West` not covered + //~^ ERROR match is non-exhaustive Direction::North => () } } @@ -44,15 +44,14 @@ enum ExcessiveEnum { fn enum_with_excessive_missing_variants() { match ExcessiveEnum::First { - //~^ ERROR `ExcessiveEnum::Second`, `ExcessiveEnum::Third`, `ExcessiveEnum::Fourth` and 8 more not covered - + //~^ ERROR match is non-exhaustive [E0004] ExcessiveEnum::First => () } } fn enum_struct_variant() { match Color::Red { - //~^ ERROR non-exhaustive patterns: `Color::CustomRGBA { a: true, .. }` not covered + //~^ ERROR match is non-exhaustive Color::Red => (), Color::Green => (), Color::CustomRGBA { a: false, r: _, g: _, b: 0 } => (), @@ -68,7 +67,7 @@ enum Enum { fn vectors_with_nested_enums() { let x: &'static [Enum] = &[Enum::First, Enum::Second(false)]; match *x { - //~^ ERROR non-exhaustive patterns: `[Enum::Second(true), Enum::Second(false)]` not covered + //~^ ERROR match is non-exhaustive [] => (), [_] => (), [Enum::First, _] => (), @@ -81,7 +80,7 @@ fn vectors_with_nested_enums() { fn missing_nil() { match ((), false) { - //~^ ERROR non-exhaustive patterns: `((), false)` not covered + //~^ ERROR match is non-exhaustive ((), true) => () } } diff --git a/tests/ui/pattern/usefulness/non-exhaustive-pattern-witness.stderr b/tests/ui/pattern/usefulness/non-exhaustive-pattern-witness.stderr index b8af566de7c68..7ee8869d5ab55 100644 --- a/tests/ui/pattern/usefulness/non-exhaustive-pattern-witness.stderr +++ b/tests/ui/pattern/usefulness/non-exhaustive-pattern-witness.stderr @@ -1,4 +1,4 @@ -error[E0004]: non-exhaustive patterns: `Foo { first: false, second: Some([_, _, _, _]) }` not covered +error[E0004]: match is non-exhaustive --> $DIR/non-exhaustive-pattern-witness.rs:7:11 | LL | match (Foo { first: true, second: None }) { @@ -16,7 +16,7 @@ LL ~ Foo { first: false, second: Some([1, 2, 3, 4]) } => (), LL + Foo { first: false, second: Some([_, _, _, _]) } => todo!() | -error[E0004]: non-exhaustive patterns: `Color::Red` not covered +error[E0004]: match is non-exhaustive --> $DIR/non-exhaustive-pattern-witness.rs:23:11 | LL | match Color::Red { @@ -36,7 +36,7 @@ LL ~ Color::Green => (), LL + Color::Red => todo!() | -error[E0004]: non-exhaustive patterns: `Direction::East`, `Direction::South` and `Direction::West` not covered +error[E0004]: match is non-exhaustive --> $DIR/non-exhaustive-pattern-witness.rs:35:11 | LL | match Direction::North { @@ -59,7 +59,7 @@ LL ~ Direction::North => (), LL + Direction::East | Direction::South | Direction::West => todo!() | -error[E0004]: non-exhaustive patterns: `ExcessiveEnum::Second`, `ExcessiveEnum::Third`, `ExcessiveEnum::Fourth` and 8 more not covered +error[E0004]: match is non-exhaustive --> $DIR/non-exhaustive-pattern-witness.rs:46:11 | LL | match ExcessiveEnum::First { @@ -77,8 +77,8 @@ LL ~ ExcessiveEnum::First => (), LL + _ => todo!() | -error[E0004]: non-exhaustive patterns: `Color::CustomRGBA { a: true, .. }` not covered - --> $DIR/non-exhaustive-pattern-witness.rs:54:11 +error[E0004]: match is non-exhaustive + --> $DIR/non-exhaustive-pattern-witness.rs:53:11 | LL | match Color::Red { | ^^^^^^^^^^ pattern `Color::CustomRGBA { a: true, .. }` not covered @@ -98,8 +98,8 @@ LL ~ Color::CustomRGBA { a: false, r: _, g: _, b: _ } => (), LL + Color::CustomRGBA { a: true, .. } => todo!() | -error[E0004]: non-exhaustive patterns: `[Enum::Second(true), Enum::Second(false)]` not covered - --> $DIR/non-exhaustive-pattern-witness.rs:70:11 +error[E0004]: match is non-exhaustive + --> $DIR/non-exhaustive-pattern-witness.rs:69:11 | LL | match *x { | ^^ pattern `[Enum::Second(true), Enum::Second(false)]` not covered @@ -111,8 +111,8 @@ LL ~ [_, _, ref tail @ .., _] => (), LL + [Enum::Second(true), Enum::Second(false)] => todo!() | -error[E0004]: non-exhaustive patterns: `((), false)` not covered - --> $DIR/non-exhaustive-pattern-witness.rs:83:11 +error[E0004]: match is non-exhaustive + --> $DIR/non-exhaustive-pattern-witness.rs:82:11 | LL | match ((), false) { | ^^^^^^^^^^^ pattern `((), false)` not covered diff --git a/tests/ui/pattern/usefulness/slice-patterns-exhaustiveness.rs b/tests/ui/pattern/usefulness/slice-patterns-exhaustiveness.rs index 46e0da5be9b4f..5ee8f438223d6 100644 --- a/tests/ui/pattern/usefulness/slice-patterns-exhaustiveness.rs +++ b/tests/ui/pattern/usefulness/slice-patterns-exhaustiveness.rs @@ -6,15 +6,15 @@ fn main() { let s10: &[bool; 10] = &[false; 10]; match s2 { - //~^ ERROR `&[false, _]` not covered + //~^ ERROR match is non-exhaustive [E0004] [true, .., true] => {} } match s3 { - //~^ ERROR `&[false, ..]` not covered + //~^ ERROR match is non-exhaustive [E0004] [true, .., true] => {} } match s10 { - //~^ ERROR `&[false, ..]` not covered + //~^ ERROR match is non-exhaustive [E0004] [true, .., true] => {} } @@ -23,58 +23,58 @@ fn main() { [.., false] => {} } match s2 { - //~^ ERROR `&[false, true]` not covered + //~^ ERROR match is non-exhaustive [E0004] [true, ..] => {} [.., false] => {} } match s3 { - //~^ ERROR `&[false, .., true]` not covered + //~^ ERROR match is non-exhaustive [E0004] [true, ..] => {} [.., false] => {} } match s { - //~^ ERROR `&[false, .., true]` not covered + //~^ ERROR match is non-exhaustive [E0004] [] => {} [true, ..] => {} [.., false] => {} } match s { - //~^ ERROR `&[_, ..]` not covered + //~^ ERROR match is non-exhaustive [E0004] [] => {} } match s { - //~^ ERROR `&[_, _, ..]` not covered + //~^ ERROR match is non-exhaustive [E0004] [] => {} [_] => {} } match s { - //~^ ERROR `&[false, ..]` not covered + //~^ ERROR match is non-exhaustive [E0004] [] => {} [true, ..] => {} } match s { - //~^ ERROR `&[false, _, ..]` not covered + //~^ ERROR match is non-exhaustive [E0004] [] => {} [_] => {} [true, ..] => {} } match s { - //~^ ERROR `&[_, .., false]` not covered + //~^ ERROR match is non-exhaustive [E0004] [] => {} [_] => {} [.., true] => {} } match s { - //~^ ERROR `&[_, _, .., true]` not covered + //~^ ERROR match is non-exhaustive [E0004] [] => {} [_] => {} [_, _] => {} [.., false] => {} } match s { - //~^ ERROR `&[true, _, .., _]` not covered + //~^ ERROR match is non-exhaustive [E0004] [] => {} [_] => {} [_, _] => {} @@ -83,30 +83,30 @@ fn main() { const CONST: &[bool] = &[true]; match s { - //~^ ERROR `&[]` and `&[_, _, ..]` not covered + //~^ ERROR match is non-exhaustive [E0004] &[true] => {} } match s { - //~^ ERROR `&[]` and `&[_, _, ..]` not covered + //~^ ERROR match is non-exhaustive [E0004] CONST => {} } match s { - //~^ ERROR `&[]` and `&[_, _, ..]` not covered + //~^ ERROR match is non-exhaustive [E0004] CONST => {} &[false] => {} } match s { - //~^ ERROR `&[]` and `&[_, _, ..]` not covered + //~^ ERROR match is non-exhaustive [E0004] &[false] => {} CONST => {} } match s { - //~^ ERROR `&[_, _, ..]` not covered + //~^ ERROR match is non-exhaustive [E0004] &[] => {} CONST => {} } match s { - //~^ ERROR `&[false]` not covered + //~^ ERROR match is non-exhaustive [E0004] &[] => {} CONST => {} &[_, _, ..] => {} @@ -119,7 +119,7 @@ fn main() { } const CONST1: &[bool; 1] = &[true]; match s1 { - //~^ ERROR `&[false]` not covered + //~^ ERROR match is non-exhaustive [E0004] CONST1 => {} } match s1 { diff --git a/tests/ui/pattern/usefulness/slice-patterns-exhaustiveness.stderr b/tests/ui/pattern/usefulness/slice-patterns-exhaustiveness.stderr index 5d1e170ae6c2b..e34f4c28ba7c7 100644 --- a/tests/ui/pattern/usefulness/slice-patterns-exhaustiveness.stderr +++ b/tests/ui/pattern/usefulness/slice-patterns-exhaustiveness.stderr @@ -1,4 +1,4 @@ -error[E0004]: non-exhaustive patterns: `&[false, _]` not covered +error[E0004]: match is non-exhaustive --> $DIR/slice-patterns-exhaustiveness.rs:8:11 | LL | match s2 { @@ -11,7 +11,7 @@ LL ~ [true, .., true] => {} LL + &[false, _] => todo!() | -error[E0004]: non-exhaustive patterns: `&[false, ..]` not covered +error[E0004]: match is non-exhaustive --> $DIR/slice-patterns-exhaustiveness.rs:12:11 | LL | match s3 { @@ -24,7 +24,7 @@ LL ~ [true, .., true] => {} LL + &[false, ..] => todo!() | -error[E0004]: non-exhaustive patterns: `&[false, ..]` not covered +error[E0004]: match is non-exhaustive --> $DIR/slice-patterns-exhaustiveness.rs:16:11 | LL | match s10 { @@ -37,7 +37,7 @@ LL ~ [true, .., true] => {} LL + &[false, ..] => todo!() | -error[E0004]: non-exhaustive patterns: `&[false, true]` not covered +error[E0004]: match is non-exhaustive --> $DIR/slice-patterns-exhaustiveness.rs:25:11 | LL | match s2 { @@ -50,7 +50,7 @@ LL ~ [.., false] => {} LL + &[false, true] => todo!() | -error[E0004]: non-exhaustive patterns: `&[false, .., true]` not covered +error[E0004]: match is non-exhaustive --> $DIR/slice-patterns-exhaustiveness.rs:30:11 | LL | match s3 { @@ -63,7 +63,7 @@ LL ~ [.., false] => {} LL + &[false, .., true] => todo!() | -error[E0004]: non-exhaustive patterns: `&[false, .., true]` not covered +error[E0004]: match is non-exhaustive --> $DIR/slice-patterns-exhaustiveness.rs:35:11 | LL | match s { @@ -76,7 +76,7 @@ LL ~ [.., false] => {} LL + &[false, .., true] => todo!() | -error[E0004]: non-exhaustive patterns: `&[_, ..]` not covered +error[E0004]: match is non-exhaustive --> $DIR/slice-patterns-exhaustiveness.rs:42:11 | LL | match s { @@ -89,7 +89,7 @@ LL ~ [] => {} LL + &[_, ..] => todo!() | -error[E0004]: non-exhaustive patterns: `&[_, _, ..]` not covered +error[E0004]: match is non-exhaustive --> $DIR/slice-patterns-exhaustiveness.rs:46:11 | LL | match s { @@ -102,7 +102,7 @@ LL ~ [_] => {} LL + &[_, _, ..] => todo!() | -error[E0004]: non-exhaustive patterns: `&[false, ..]` not covered +error[E0004]: match is non-exhaustive --> $DIR/slice-patterns-exhaustiveness.rs:51:11 | LL | match s { @@ -115,7 +115,7 @@ LL ~ [true, ..] => {} LL + &[false, ..] => todo!() | -error[E0004]: non-exhaustive patterns: `&[false, _, ..]` not covered +error[E0004]: match is non-exhaustive --> $DIR/slice-patterns-exhaustiveness.rs:56:11 | LL | match s { @@ -128,7 +128,7 @@ LL ~ [true, ..] => {} LL + &[false, _, ..] => todo!() | -error[E0004]: non-exhaustive patterns: `&[_, .., false]` not covered +error[E0004]: match is non-exhaustive --> $DIR/slice-patterns-exhaustiveness.rs:62:11 | LL | match s { @@ -141,7 +141,7 @@ LL ~ [.., true] => {} LL + &[_, .., false] => todo!() | -error[E0004]: non-exhaustive patterns: `&[_, _, .., true]` not covered +error[E0004]: match is non-exhaustive --> $DIR/slice-patterns-exhaustiveness.rs:69:11 | LL | match s { @@ -154,7 +154,7 @@ LL ~ [.., false] => {} LL + &[_, _, .., true] => todo!() | -error[E0004]: non-exhaustive patterns: `&[true, _, .., _]` not covered +error[E0004]: match is non-exhaustive --> $DIR/slice-patterns-exhaustiveness.rs:76:11 | LL | match s { @@ -167,7 +167,7 @@ LL ~ [false, .., false] => {} LL + &[true, _, .., _] => todo!() | -error[E0004]: non-exhaustive patterns: `&[]` and `&[_, _, ..]` not covered +error[E0004]: match is non-exhaustive --> $DIR/slice-patterns-exhaustiveness.rs:85:11 | LL | match s { @@ -180,7 +180,7 @@ LL ~ &[true] => {} LL + &[] | &[_, _, ..] => todo!() | -error[E0004]: non-exhaustive patterns: `&[]` and `&[_, _, ..]` not covered +error[E0004]: match is non-exhaustive --> $DIR/slice-patterns-exhaustiveness.rs:89:11 | LL | match s { @@ -193,7 +193,7 @@ LL ~ CONST => {} LL + &[] | &[_, _, ..] => todo!() | -error[E0004]: non-exhaustive patterns: `&[]` and `&[_, _, ..]` not covered +error[E0004]: match is non-exhaustive --> $DIR/slice-patterns-exhaustiveness.rs:93:11 | LL | match s { @@ -206,7 +206,7 @@ LL ~ &[false] => {} LL + &[] | &[_, _, ..] => todo!() | -error[E0004]: non-exhaustive patterns: `&[]` and `&[_, _, ..]` not covered +error[E0004]: match is non-exhaustive --> $DIR/slice-patterns-exhaustiveness.rs:98:11 | LL | match s { @@ -219,7 +219,7 @@ LL ~ CONST => {} LL + &[] | &[_, _, ..] => todo!() | -error[E0004]: non-exhaustive patterns: `&[_, _, ..]` not covered +error[E0004]: match is non-exhaustive --> $DIR/slice-patterns-exhaustiveness.rs:103:11 | LL | match s { @@ -232,7 +232,7 @@ LL ~ CONST => {} LL + &[_, _, ..] => todo!() | -error[E0004]: non-exhaustive patterns: `&[false]` not covered +error[E0004]: match is non-exhaustive --> $DIR/slice-patterns-exhaustiveness.rs:108:11 | LL | match s { @@ -245,7 +245,7 @@ LL ~ &[_, _, ..] => {} LL + &[false] => todo!() | -error[E0004]: non-exhaustive patterns: `&[false]` not covered +error[E0004]: match is non-exhaustive --> $DIR/slice-patterns-exhaustiveness.rs:121:11 | LL | match s1 { diff --git a/tests/ui/pattern/usefulness/stable-gated-patterns.rs b/tests/ui/pattern/usefulness/stable-gated-patterns.rs index 03db01160ddab..dbbb631264f50 100644 --- a/tests/ui/pattern/usefulness/stable-gated-patterns.rs +++ b/tests/ui/pattern/usefulness/stable-gated-patterns.rs @@ -8,11 +8,11 @@ fn main() { match UnstableEnum::Stable { UnstableEnum::Stable => {} } - //~^^^ non-exhaustive patterns: `UnstableEnum::Stable2` and `_` not covered + //~^^^ match is non-exhaustive match UnstableEnum::Stable { UnstableEnum::Stable => {} UnstableEnum::Stable2 => {} } - //~^^^^ non-exhaustive patterns: `_` not covered + //~^^^^ match is non-exhaustive } diff --git a/tests/ui/pattern/usefulness/stable-gated-patterns.stderr b/tests/ui/pattern/usefulness/stable-gated-patterns.stderr index 7b8588a3c7350..281e69d57159b 100644 --- a/tests/ui/pattern/usefulness/stable-gated-patterns.stderr +++ b/tests/ui/pattern/usefulness/stable-gated-patterns.stderr @@ -1,4 +1,4 @@ -error[E0004]: non-exhaustive patterns: `UnstableEnum::Stable2` and `_` not covered +error[E0004]: match is non-exhaustive --> $DIR/stable-gated-patterns.rs:8:11 | LL | match UnstableEnum::Stable { @@ -19,7 +19,7 @@ LL ~ UnstableEnum::Stable => {} LL + UnstableEnum::Stable2 | _ => todo!() | -error[E0004]: non-exhaustive patterns: `_` not covered +error[E0004]: match is non-exhaustive --> $DIR/stable-gated-patterns.rs:13:11 | LL | match UnstableEnum::Stable { diff --git a/tests/ui/pattern/usefulness/struct-like-enum-nonexhaustive.rs b/tests/ui/pattern/usefulness/struct-like-enum-nonexhaustive.rs index b1fc0f5ad3e14..913aaa67e7c62 100644 --- a/tests/ui/pattern/usefulness/struct-like-enum-nonexhaustive.rs +++ b/tests/ui/pattern/usefulness/struct-like-enum-nonexhaustive.rs @@ -5,7 +5,7 @@ enum A { fn main() { let x = A::B { x: Some(3) }; - match x { //~ ERROR non-exhaustive patterns + match x { //~ ERROR match is non-exhaustive A::C => {} A::B { x: None } => {} } diff --git a/tests/ui/pattern/usefulness/struct-like-enum-nonexhaustive.stderr b/tests/ui/pattern/usefulness/struct-like-enum-nonexhaustive.stderr index 85c97be29d6d7..993357a2829a4 100644 --- a/tests/ui/pattern/usefulness/struct-like-enum-nonexhaustive.stderr +++ b/tests/ui/pattern/usefulness/struct-like-enum-nonexhaustive.stderr @@ -1,4 +1,4 @@ -error[E0004]: non-exhaustive patterns: `A::B { x: Some(_) }` not covered +error[E0004]: match is non-exhaustive --> $DIR/struct-like-enum-nonexhaustive.rs:8:11 | LL | match x { diff --git a/tests/ui/pattern/usefulness/tuple-struct-nonexhaustive.stderr b/tests/ui/pattern/usefulness/tuple-struct-nonexhaustive.stderr index e2a65ff852404..c56213ecb5654 100644 --- a/tests/ui/pattern/usefulness/tuple-struct-nonexhaustive.stderr +++ b/tests/ui/pattern/usefulness/tuple-struct-nonexhaustive.stderr @@ -1,4 +1,4 @@ -error[E0004]: non-exhaustive patterns: `Foo(_, _)` not covered +error[E0004]: match is non-exhaustive --> $DIR/tuple-struct-nonexhaustive.rs:5:11 | LL | match x { diff --git a/tests/ui/pattern/usefulness/type_polymorphic_byte_str_literals.rs b/tests/ui/pattern/usefulness/type_polymorphic_byte_str_literals.rs index cb44c1da76ba5..fb5afd255c9f6 100644 --- a/tests/ui/pattern/usefulness/type_polymorphic_byte_str_literals.rs +++ b/tests/ui/pattern/usefulness/type_polymorphic_byte_str_literals.rs @@ -8,7 +8,7 @@ fn parse_data1(data: &[u8]) -> u32 { } fn parse_data2(data: &[u8]) -> u32 { - match data { //~ ERROR non-exhaustive patterns: `&[_, ..]` not covered + match data { //~ ERROR match is non-exhaustive b"" => 1, } } @@ -20,7 +20,7 @@ fn parse_data3(data: &[u8; 0]) -> u8 { } fn parse_data4(data: &[u8]) -> u8 { - match data { //~ ERROR non-exhaustive patterns + match data { //~ ERROR match is non-exhaustive b"aaa" => 0, [_, _, _] => 1, } diff --git a/tests/ui/pattern/usefulness/type_polymorphic_byte_str_literals.stderr b/tests/ui/pattern/usefulness/type_polymorphic_byte_str_literals.stderr index acae605dae3a8..f7bbe1ed18d2f 100644 --- a/tests/ui/pattern/usefulness/type_polymorphic_byte_str_literals.stderr +++ b/tests/ui/pattern/usefulness/type_polymorphic_byte_str_literals.stderr @@ -1,4 +1,4 @@ -error[E0004]: non-exhaustive patterns: `&[_, ..]` not covered +error[E0004]: match is non-exhaustive --> $DIR/type_polymorphic_byte_str_literals.rs:11:11 | LL | match data { @@ -11,7 +11,7 @@ LL ~ b"" => 1, LL ~ &[_, ..] => todo!(), | -error[E0004]: non-exhaustive patterns: `&[]`, `&[_]`, `&[_, _]` and 1 more not covered +error[E0004]: match is non-exhaustive --> $DIR/type_polymorphic_byte_str_literals.rs:23:11 | LL | match data { diff --git a/tests/ui/pattern/usefulness/unstable-gated-patterns.rs b/tests/ui/pattern/usefulness/unstable-gated-patterns.rs index 7046555e0d2f0..3b0fe31ea02c3 100644 --- a/tests/ui/pattern/usefulness/unstable-gated-patterns.rs +++ b/tests/ui/pattern/usefulness/unstable-gated-patterns.rs @@ -11,7 +11,7 @@ fn main() { UnstableEnum::Stable => {} UnstableEnum::Stable2 => {} } - //~^^^^ non-exhaustive patterns: `UnstableEnum::Unstable` not covered + //~^^^^ match is non-exhaustive // Ok: all variants are explicitly matched match UnstableEnum::Stable { diff --git a/tests/ui/pattern/usefulness/unstable-gated-patterns.stderr b/tests/ui/pattern/usefulness/unstable-gated-patterns.stderr index 6dc9a40583985..2dd5bfc07ab68 100644 --- a/tests/ui/pattern/usefulness/unstable-gated-patterns.stderr +++ b/tests/ui/pattern/usefulness/unstable-gated-patterns.stderr @@ -1,4 +1,4 @@ -error[E0004]: non-exhaustive patterns: `UnstableEnum::Unstable` not covered +error[E0004]: match is non-exhaustive --> $DIR/unstable-gated-patterns.rs:10:11 | LL | match UnstableEnum::Stable { diff --git a/tests/ui/rfc-2005-default-binding-mode/slice.rs b/tests/ui/rfc-2005-default-binding-mode/slice.rs index 363a0e3e649d9..61abf74ce2709 100644 --- a/tests/ui/rfc-2005-default-binding-mode/slice.rs +++ b/tests/ui/rfc-2005-default-binding-mode/slice.rs @@ -1,7 +1,7 @@ pub fn main() { let sl: &[u8] = b"foo"; - match sl { //~ ERROR non-exhaustive patterns + match sl { //~ ERROR match is non-exhaustive [first, remainder @ ..] => {}, }; } diff --git a/tests/ui/rfc-2005-default-binding-mode/slice.stderr b/tests/ui/rfc-2005-default-binding-mode/slice.stderr index 60c1f5420f62c..c6150fe5c9283 100644 --- a/tests/ui/rfc-2005-default-binding-mode/slice.stderr +++ b/tests/ui/rfc-2005-default-binding-mode/slice.stderr @@ -1,4 +1,4 @@ -error[E0004]: non-exhaustive patterns: `&[]` not covered +error[E0004]: match is non-exhaustive --> $DIR/slice.rs:4:11 | LL | match sl { diff --git a/tests/ui/rfc-2008-non-exhaustive/enum.rs b/tests/ui/rfc-2008-non-exhaustive/enum.rs index 9d2855f5c6166..213a8d823effe 100644 --- a/tests/ui/rfc-2008-non-exhaustive/enum.rs +++ b/tests/ui/rfc-2008-non-exhaustive/enum.rs @@ -14,14 +14,14 @@ fn main() { let enum_unit = NonExhaustiveEnum::Unit; match enum_unit { - //~^ ERROR non-exhaustive patterns: `_` not covered [E0004] + //~^ ERROR match is non-exhaustive [E0004] NonExhaustiveEnum::Unit => "first", NonExhaustiveEnum::Tuple(_) => "second", NonExhaustiveEnum::Struct { .. } => "third" }; match enum_unit {}; - //~^ ERROR non-exhaustive patterns: `_` not covered [E0004] + //~^ ERROR match is non-exhaustive [E0004] // Everything below this is expected to compile successfully. diff --git a/tests/ui/rfc-2008-non-exhaustive/enum.stderr b/tests/ui/rfc-2008-non-exhaustive/enum.stderr index 872cb9b8bc68e..b4622274f317b 100644 --- a/tests/ui/rfc-2008-non-exhaustive/enum.stderr +++ b/tests/ui/rfc-2008-non-exhaustive/enum.stderr @@ -17,7 +17,7 @@ LL + _ => todo!(), LL ~ } | -error[E0004]: non-exhaustive patterns: `_` not covered +error[E0004]: match is non-exhaustive --> $DIR/enum.rs:16:11 | LL | match enum_unit { @@ -35,7 +35,7 @@ LL ~ NonExhaustiveEnum::Struct { .. } => "third", LL + _ => todo!() | -error[E0004]: non-exhaustive patterns: `_` not covered +error[E0004]: match is non-exhaustive --> $DIR/enum.rs:23:11 | LL | match enum_unit {}; diff --git a/tests/ui/rfc-2008-non-exhaustive/enum_same_crate_empty_match.rs b/tests/ui/rfc-2008-non-exhaustive/enum_same_crate_empty_match.rs index 69a283c31633d..d603ce14d1c37 100644 --- a/tests/ui/rfc-2008-non-exhaustive/enum_same_crate_empty_match.rs +++ b/tests/ui/rfc-2008-non-exhaustive/enum_same_crate_empty_match.rs @@ -31,7 +31,7 @@ fn empty_non_exhaustive(x: EmptyNonExhaustiveEnum) { fn main() { match NonExhaustiveEnum::Unit {} - //~^ ERROR `NonExhaustiveEnum::Unit`, `NonExhaustiveEnum::Tuple(_)` and `NonExhaustiveEnum::Struct { .. }` not covered [E0004] + //~^ ERROR match is non-exhaustive [E0004] match NormalEnum::Unit {} - //~^ ERROR `NormalEnum::Unit`, `NormalEnum::Tuple(_)` and `NormalEnum::Struct { .. }` not covered [E0004] + //~^ ERROR match is non-exhaustive [E0004] } diff --git a/tests/ui/rfc-2008-non-exhaustive/enum_same_crate_empty_match.stderr b/tests/ui/rfc-2008-non-exhaustive/enum_same_crate_empty_match.stderr index de1bf8be8854e..7aea4f97cf657 100644 --- a/tests/ui/rfc-2008-non-exhaustive/enum_same_crate_empty_match.stderr +++ b/tests/ui/rfc-2008-non-exhaustive/enum_same_crate_empty_match.stderr @@ -10,7 +10,7 @@ note: the lint level is defined here LL | #![deny(unreachable_patterns)] | ^^^^^^^^^^^^^^^^^^^^ -error[E0004]: non-exhaustive patterns: `NonExhaustiveEnum::Unit`, `NonExhaustiveEnum::Tuple(_)` and `NonExhaustiveEnum::Struct { .. }` not covered +error[E0004]: match is non-exhaustive --> $DIR/enum_same_crate_empty_match.rs:33:11 | LL | match NonExhaustiveEnum::Unit {} @@ -37,7 +37,7 @@ LL + NonExhaustiveEnum::Unit | NonExhaustiveEnum::Tuple(_) | NonExhausti LL + } | -error[E0004]: non-exhaustive patterns: `NormalEnum::Unit`, `NormalEnum::Tuple(_)` and `NormalEnum::Struct { .. }` not covered +error[E0004]: match is non-exhaustive --> $DIR/enum_same_crate_empty_match.rs:35:11 | LL | match NormalEnum::Unit {} diff --git a/tests/ui/rfc-2008-non-exhaustive/uninhabited/match.rs b/tests/ui/rfc-2008-non-exhaustive/uninhabited/match.rs index e54098d4d48b9..3459037408d24 100644 --- a/tests/ui/rfc-2008-non-exhaustive/uninhabited/match.rs +++ b/tests/ui/rfc-2008-non-exhaustive/uninhabited/match.rs @@ -28,7 +28,7 @@ fn cannot_empty_match_on_empty_tuple_struct_to_anything(x: UninhabitedTupleStruc } fn cannot_empty_match_on_enum_with_empty_variants_struct_to_anything(x: UninhabitedVariants) -> A { - match x {} //~ ERROR non-exhaustive patterns + match x {} //~ ERROR match is non-exhaustive [E0004] } fn main() {} diff --git a/tests/ui/rfc-2008-non-exhaustive/uninhabited/match.stderr b/tests/ui/rfc-2008-non-exhaustive/uninhabited/match.stderr index a9c54af0418a5..35881918eb1c0 100644 --- a/tests/ui/rfc-2008-non-exhaustive/uninhabited/match.stderr +++ b/tests/ui/rfc-2008-non-exhaustive/uninhabited/match.stderr @@ -55,7 +55,7 @@ LL + _ => todo!(), LL ~ } | -error[E0004]: non-exhaustive patterns: `UninhabitedVariants::Tuple(_)` and `UninhabitedVariants::Struct { .. }` not covered +error[E0004]: match is non-exhaustive --> $DIR/match.rs:31:11 | LL | match x {} diff --git a/tests/ui/rfc-2008-non-exhaustive/uninhabited/match_same_crate.rs b/tests/ui/rfc-2008-non-exhaustive/uninhabited/match_same_crate.rs index ebbdfba15f3a3..b12af3123ac15 100644 --- a/tests/ui/rfc-2008-non-exhaustive/uninhabited/match_same_crate.rs +++ b/tests/ui/rfc-2008-non-exhaustive/uninhabited/match_same_crate.rs @@ -35,7 +35,7 @@ fn cannot_empty_match_on_empty_tuple_struct_to_anything(x: UninhabitedTupleStruc } fn cannot_empty_match_on_enum_with_empty_variants_struct_to_anything(x: UninhabitedVariants) -> A { - match x {} //~ ERROR non-exhaustive patterns + match x {} //~ ERROR match is non-exhaustive [E0004] } fn main() {} diff --git a/tests/ui/rfc-2008-non-exhaustive/uninhabited/match_same_crate.stderr b/tests/ui/rfc-2008-non-exhaustive/uninhabited/match_same_crate.stderr index ec2a2f6f05531..628adb9f4978e 100644 --- a/tests/ui/rfc-2008-non-exhaustive/uninhabited/match_same_crate.stderr +++ b/tests/ui/rfc-2008-non-exhaustive/uninhabited/match_same_crate.stderr @@ -36,7 +36,7 @@ LL + _ => todo!(), LL ~ } | -error[E0004]: non-exhaustive patterns: `UninhabitedVariants::Tuple(_)` and `UninhabitedVariants::Struct { .. }` not covered +error[E0004]: match is non-exhaustive --> $DIR/match_same_crate.rs:38:11 | LL | match x {} diff --git a/tests/ui/rfc-2008-non-exhaustive/uninhabited/match_with_exhaustive_patterns.rs b/tests/ui/rfc-2008-non-exhaustive/uninhabited/match_with_exhaustive_patterns.rs index 900dfff652ea6..693e6da240933 100644 --- a/tests/ui/rfc-2008-non-exhaustive/uninhabited/match_with_exhaustive_patterns.rs +++ b/tests/ui/rfc-2008-non-exhaustive/uninhabited/match_with_exhaustive_patterns.rs @@ -31,7 +31,7 @@ fn cannot_empty_match_on_empty_tuple_struct_to_anything(x: UninhabitedTupleStruc } fn cannot_empty_match_on_enum_with_empty_variants_struct_to_anything(x: UninhabitedVariants) -> A { - match x {} //~ ERROR non-exhaustive patterns + match x {} //~ ERROR match is non-exhaustive [E0004] } fn main() {} diff --git a/tests/ui/rfc-2008-non-exhaustive/uninhabited/match_with_exhaustive_patterns.stderr b/tests/ui/rfc-2008-non-exhaustive/uninhabited/match_with_exhaustive_patterns.stderr index b6b777ec56c43..dd7dec5320e8f 100644 --- a/tests/ui/rfc-2008-non-exhaustive/uninhabited/match_with_exhaustive_patterns.stderr +++ b/tests/ui/rfc-2008-non-exhaustive/uninhabited/match_with_exhaustive_patterns.stderr @@ -55,7 +55,7 @@ LL + _ => todo!(), LL ~ } | -error[E0004]: non-exhaustive patterns: `UninhabitedVariants::Tuple(_)` and `UninhabitedVariants::Struct { .. }` not covered +error[E0004]: match is non-exhaustive --> $DIR/match_with_exhaustive_patterns.rs:34:11 | LL | match x {} diff --git a/tests/ui/uninhabited/uninhabited-matches-feature-gated.stderr b/tests/ui/uninhabited/uninhabited-matches-feature-gated.stderr index 466d7f2eadb92..39b80da2c8f61 100644 --- a/tests/ui/uninhabited/uninhabited-matches-feature-gated.stderr +++ b/tests/ui/uninhabited/uninhabited-matches-feature-gated.stderr @@ -1,4 +1,4 @@ -error[E0004]: non-exhaustive patterns: `Err(_)` not covered +error[E0004]: match is non-exhaustive --> $DIR/uninhabited-matches-feature-gated.rs:6:19 | LL | let _ = match x { @@ -64,7 +64,7 @@ LL + _ => todo!(), LL ~ }; | -error[E0004]: non-exhaustive patterns: `&[_, ..]` not covered +error[E0004]: match is non-exhaustive --> $DIR/uninhabited-matches-feature-gated.rs:24:19 | LL | let _ = match x { @@ -77,7 +77,7 @@ LL ~ &[] => (), LL ~ &[_, ..] => todo!(), | -error[E0004]: non-exhaustive patterns: `Err(_)` not covered +error[E0004]: match is non-exhaustive --> $DIR/uninhabited-matches-feature-gated.rs:32:19 | LL | let _ = match x { From 239050559a8408ba93f78e57c2e5eb1264f3dc41 Mon Sep 17 00:00:00 2001 From: mejrs <59372212+mejrs@users.noreply.github.com> Date: Sun, 19 Feb 2023 10:31:36 +0100 Subject: [PATCH 02/11] Remove wildcard errors import --- .../src/thir/pattern/check_match.rs | 74 ++++++++++--------- 1 file changed, 41 insertions(+), 33 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 47615c53ed750..21778c7aa513b 100644 --- a/compiler/rustc_mir_build/src/thir/pattern/check_match.rs +++ b/compiler/rustc_mir_build/src/thir/pattern/check_match.rs @@ -4,7 +4,7 @@ use super::usefulness::{ }; use super::{PatCtxt, PatternError}; -use crate::errors::{self, *}; +use crate::errors; use hir::{ExprKind, PatKind}; use rustc_arena::TypedArena; @@ -100,16 +100,16 @@ impl PatCtxt<'_, '_> { for error in &self.errors { match *error { PatternError::StaticInPattern(span) => { - self.tcx.sess.emit_err(StaticInPattern { span }); + self.tcx.sess.emit_err(errors::StaticInPattern { span }); } PatternError::AssocConstInPattern(span) => { - self.tcx.sess.emit_err(AssocConstInPattern { span }); + self.tcx.sess.emit_err(errors::AssocConstInPattern { span }); } PatternError::ConstParamInPattern(span) => { - self.tcx.sess.emit_err(ConstParamInPattern { span }); + self.tcx.sess.emit_err(errors::ConstParamInPattern { span }); } PatternError::NonConstPath(span) => { - self.tcx.sess.emit_err(NonConstPath { span }); + self.tcx.sess.emit_err(errors::NonConstPath { span }); } } } @@ -347,7 +347,7 @@ impl<'p, 'tcx> MatchVisitor<'_, 'p, 'tcx> { let span_end = prefix.last().unwrap().unwrap().0; let span = span_start.to(span_end); let count = prefix.len(); - cx.tcx.emit_spanned_lint(IRREFUTABLE_LET_PATTERNS, top, span, LeadingIrrefutableLetPatterns { count }); + cx.tcx.emit_spanned_lint(IRREFUTABLE_LET_PATTERNS, top, span, errors::LeadingIrrefutableLetPatterns { count }); } } if let Some(from) = chain_refutabilities.iter().rposition(|r| !matches!(*r, Some((_, false)))) && from != (chain_refutabilities.len() - 1) { @@ -357,7 +357,7 @@ impl<'p, 'tcx> MatchVisitor<'_, 'p, 'tcx> { let span_end = suffix.last().unwrap().unwrap().0; let span = span_start.to(span_end); let count = suffix.len(); - cx.tcx.emit_spanned_lint(IRREFUTABLE_LET_PATTERNS, top, span, TrailingIrrefutableLetPatterns { count }); + cx.tcx.emit_spanned_lint(IRREFUTABLE_LET_PATTERNS, top, span, errors::TrailingIrrefutableLetPatterns { count }); } true } @@ -390,14 +390,14 @@ impl<'p, 'tcx> MatchVisitor<'_, 'p, 'tcx> { { ( None, - Some(InterpretedAsConst { + Some(errors::InterpretedAsConst { span: pat.span, article: res.article(), variable: ident.to_string().to_lowercase(), res, }), try { - ResDefinedHere { + errors::ResDefinedHere { def_span: cx.tcx.hir().res_span(res)?, res, } @@ -423,13 +423,13 @@ impl<'p, 'tcx> MatchVisitor<'_, 'p, 'tcx> { && bindings.is_empty() && let ExprKind::Lit(Spanned { node: LitKind::Int(_, _), span }) = expr.kind { // Then give a suggestion, the user might've meant to create a binding instead. - Some(MiscPatternSuggestion::AttemptedIntegerLiteral { start_span: span.shrink_to_lo() }) + Some(errors::MiscPatternSuggestion::AttemptedIntegerLiteral { start_span: span.shrink_to_lo() }) } else { None }; - let let_suggestion = if bindings.is_empty() {SuggestLet::If{start_span, semi_span, count}} else{ SuggestLet::Else{end_span, count }}; - (sp.map(|_|Inform), None, None, Some(let_suggestion), int_suggestion) + let let_suggestion = if bindings.is_empty() {errors::SuggestLet::If{start_span, semi_span, count}} else{ errors::SuggestLet::Else{end_span, count }}; + (sp.map(|_|errors::Inform), None, None, Some(let_suggestion), int_suggestion) } else{ - (sp.map(|_|Inform), None, None, None, None) + (sp.map(|_|errors::Inform), None, None, None, None) }; let adt_defined_here = try { @@ -439,15 +439,15 @@ impl<'p, 'tcx> MatchVisitor<'_, 'p, 'tcx> { let mut variants = vec![]; for span in maybe_point_at_variant(&cx, *def, witnesses.iter().take(5)) { - variants.push(Variant { span }); + variants.push(errors::Variant { span }); } - AdtDefinedHere { adt_def_span, ty, variants } + errors::AdtDefinedHere { adt_def_span, ty, variants } }; - self.tcx.sess.emit_err(PatternNotCovered { + self.tcx.sess.emit_err(errors::PatternNotCovered { span: pat.span, origin, - uncovered: Uncovered::new(pat.span, &cx, &witnesses), + uncovered: errors::Uncovered::new(pat.span, &cx, &witnesses), inform, interpreted_as_const, _p: (), @@ -484,7 +484,7 @@ fn check_for_bindings_named_same_as_variants( BINDINGS_WITH_VARIANT_NAME, p.hir_id, p.span, - BindingsWithVariantName { + errors::BindingsWithVariantName { // If this is an irrefutable pattern, and there's > 1 variant, // then we can't actually match on this. Applying the below // suggestion would produce code that breaks on `check_irrefutable`. @@ -514,7 +514,10 @@ fn unreachable_pattern(tcx: TyCtxt<'_>, span: Span, id: HirId, catchall: Option< UNREACHABLE_PATTERNS, id, span, - UnreachablePattern { span: if catchall.is_some() { Some(span) } else { None }, catchall }, + errors::UnreachablePattern { + span: if catchall.is_some() { Some(span) } else { None }, + catchall, + }, ); } @@ -532,7 +535,7 @@ fn irrefutable_let_patterns( ) { macro_rules! emit_diag { ($lint:tt) => {{ - tcx.emit_spanned_lint(IRREFUTABLE_LET_PATTERNS, id, span, $lint { count }); + tcx.emit_spanned_lint(IRREFUTABLE_LET_PATTERNS, id, span, errors::$lint { count }); }}; } @@ -607,7 +610,12 @@ fn non_exhaustive_match<'p, 'tcx>( // In the case of an empty match, replace the '`_` not covered' diagnostic with something more // informative. if is_empty_match && !non_empty_enum { - cx.tcx.sess.emit_err(NonExhaustivePatternsTypeNotEmpty { cx, expr_span, span, scrut_ty }); + cx.tcx.sess.emit_err(errors::NonExhaustivePatternsTypeNotEmpty { + cx, + expr_span, + span, + scrut_ty, + }); return; } @@ -624,7 +632,7 @@ fn non_exhaustive_match<'p, 'tcx>( let mut err = cx.tcx.sess.create_err(errors::NonExhaustivePatterns { span, - uncovered: Uncovered::new(span, &cx, &witnesses), + uncovered: errors::Uncovered::new(span, &cx, &witnesses), }); let is_variant_list_non_exhaustive = match scrut_ty.kind() { @@ -850,7 +858,7 @@ fn check_borrow_conflicts_in_at_patterns(cx: &MatchVisitor<'_, '_, '_>, pat: &Pa } }); if !conflicts_ref.is_empty() { - sess.emit_err(BorrowOfMovedValue { + sess.emit_err(errors::BorrowOfMovedValue { span: pat.span, binding_span, conflicts_ref, @@ -880,17 +888,17 @@ fn check_borrow_conflicts_in_at_patterns(cx: &MatchVisitor<'_, '_, '_>, pat: &Pa (Mutability::Not, Mutability::Not) => {} // 2x `ref mut`. (Mutability::Mut, Mutability::Mut) => { - conflicts_mut_mut.push(Conflict::Mut { span, name }) + conflicts_mut_mut.push(errors::Conflict::Mut { span, name }) } (Mutability::Not, Mutability::Mut) => { - conflicts_mut_ref.push(Conflict::Mut { span, name }) + conflicts_mut_ref.push(errors::Conflict::Mut { span, name }) } (Mutability::Mut, Mutability::Not) => { - conflicts_mut_ref.push(Conflict::Ref { span, name }) + conflicts_mut_ref.push(errors::Conflict::Ref { span, name }) } }, Some(ty::BindByValue(_)) if is_binding_by_move(cx, hir_id) => { - conflicts_move.push(Conflict::Moved { span, name }) // `ref mut?` + by-move conflict. + conflicts_move.push(errors::Conflict::Moved { span, name }) // `ref mut?` + by-move conflict. } Some(ty::BindByValue(_)) | None => {} // `ref mut?` + by-copy is fine. } @@ -901,8 +909,8 @@ fn check_borrow_conflicts_in_at_patterns(cx: &MatchVisitor<'_, '_, '_>, pat: &Pa let report_move_conflict = !conflicts_move.is_empty(); let mut occurences = match mut_outer { - Mutability::Mut => vec![Conflict::Mut { span: binding_span, name }], - Mutability::Not => vec![Conflict::Ref { span: binding_span, name }], + Mutability::Mut => vec![errors::Conflict::Mut { span: binding_span, name }], + Mutability::Not => vec![errors::Conflict::Ref { span: binding_span, name }], }; occurences.extend(conflicts_mut_mut); occurences.extend(conflicts_mut_ref); @@ -911,20 +919,20 @@ fn check_borrow_conflicts_in_at_patterns(cx: &MatchVisitor<'_, '_, '_>, pat: &Pa // Report errors if any. if report_mut_mut { // Report mutability conflicts for e.g. `ref mut x @ Some(ref mut y)`. - sess.emit_err(MultipleMutBorrows { span: pat.span, occurences }); + sess.emit_err(errors::MultipleMutBorrows { span: pat.span, occurences }); } else if report_mut_ref { // Report mutability conflicts for e.g. `ref x @ Some(ref mut y)` or the converse. match mut_outer { Mutability::Mut => { - sess.emit_err(AlreadyMutBorrowed { span: pat.span, occurences }); + sess.emit_err(errors::AlreadyMutBorrowed { span: pat.span, occurences }); } Mutability::Not => { - sess.emit_err(AlreadyBorrowed { span: pat.span, occurences }); + sess.emit_err(errors::AlreadyBorrowed { span: pat.span, occurences }); } }; } else if report_move_conflict { // Report by-ref and by-move conflicts, e.g. `ref x @ y`. - sess.emit_err(MovedWhileBorrowed { span: pat.span, occurences }); + sess.emit_err(errors::MovedWhileBorrowed { span: pat.span, occurences }); } } From 08bce7faedf38e4a1ae166b9bcd26418bd29ee2b Mon Sep 17 00:00:00 2001 From: mejrs <59372212+mejrs@users.noreply.github.com> Date: Sun, 19 Feb 2023 12:00:25 +0100 Subject: [PATCH 03/11] Use AdtDefinedHere subdiagnostic --- compiler/rustc_mir_build/src/errors.rs | 57 +++++++++++-- .../src/thir/pattern/check_match.rs | 79 +------------------ .../src/thir/pattern/deconstruct_pat.rs | 10 +-- .../match/non-exhaustive-match.stderr | 9 +-- tests/ui/error-codes/E0004-2.stderr | 8 -- tests/ui/error-codes/E0004.stderr | 6 +- ...on_exhaustive_omitted_patterns_lint.stderr | 6 +- tests/ui/issue-94866.stderr | 4 +- tests/ui/match/match_non_exhaustive.stderr | 9 +-- ...-missing-pattern-excluding-comments.stderr | 5 -- .../doc-hidden-non-exhaustive.stderr | 32 +------- .../empty-match.exhaustive_patterns.stderr | 42 ++++++---- .../usefulness/empty-match.normal.stderr | 42 ++++++---- .../ui/pattern/usefulness/issue-35609.stderr | 2 - tests/ui/pattern/usefulness/issue-3601.stderr | 2 - .../ui/pattern/usefulness/issue-39362.stderr | 6 +- .../ui/pattern/usefulness/issue-40221.stderr | 6 +- .../ui/pattern/usefulness/issue-56379.stderr | 10 +-- .../usefulness/match-arm-statics-2.stderr | 7 -- .../usefulness/match-privately-empty.stderr | 5 -- .../usefulness/non-exhaustive-defined-here.rs | 16 ++-- .../non-exhaustive-defined-here.stderr | 48 +++++------ .../non-exhaustive-match-nested.stderr | 4 +- .../usefulness/non-exhaustive-match.stderr | 13 +-- .../non-exhaustive-pattern-witness.stderr | 25 +++--- .../usefulness/stable-gated-patterns.stderr | 13 --- .../struct-like-enum-nonexhaustive.stderr | 6 +- .../usefulness/unstable-gated-patterns.stderr | 8 -- tests/ui/rfc-2008-non-exhaustive/enum.stderr | 10 --- .../enum_same_crate_empty_match.stderr | 20 ++--- .../uninhabited/match.stderr | 9 --- .../uninhabited/match_same_crate.stderr | 8 +- .../match_with_exhaustive_patterns.stderr | 9 --- .../uninhabited-matches-feature-gated.stderr | 10 --- 34 files changed, 209 insertions(+), 337 deletions(-) diff --git a/compiler/rustc_mir_build/src/errors.rs b/compiler/rustc_mir_build/src/errors.rs index 2bbeed562a572..52d33e638ec8b 100644 --- a/compiler/rustc_mir_build/src/errors.rs +++ b/compiler/rustc_mir_build/src/errors.rs @@ -1,7 +1,8 @@ use crate::{ fluent_generated as fluent, - thir::pattern::{deconstruct_pat::DeconstructedPat, MatchCheckCtxt}, + thir::pattern::{deconstruct_pat::{Constructor, DeconstructedPat}, MatchCheckCtxt}, }; +use rustc_errors::Handler; use rustc_errors::{ error_code, AddToDiagnostic, Applicability, Diagnostic, DiagnosticBuilder, ErrorGuaranteed, Handler, IntoDiagnostic, MultiSpan, SubdiagnosticMessage, @@ -9,7 +10,7 @@ use rustc_errors::{ use rustc_hir::def::Res; use rustc_macros::{Diagnostic, LintDiagnostic, Subdiagnostic}; use rustc_middle::thir::Pat; -use rustc_middle::ty::{self, Ty}; +use rustc_middle::ty::{self, AdtDef, Ty}; use rustc_span::{symbol::Ident, Span}; #[derive(LintDiagnostic)] @@ -805,14 +806,52 @@ pub(crate) struct PatternNotCovered<'s, 'tcx> { #[note(mir_build_more_information)] pub struct Inform; -pub struct AdtDefinedHere<'tcx> { - pub adt_def_span: Span, - pub ty: Ty<'tcx>, - pub variants: Vec, +pub(crate) struct AdtDefinedHere<'tcx> { + adt_def_span: Span, + ty: Ty<'tcx>, + variants: Vec, } -pub struct Variant { - pub span: Span, +impl<'tcx> AdtDefinedHere<'tcx> { + pub fn new<'p>( + cx: &MatchCheckCtxt<'p, 'tcx>, + ty: Ty<'tcx>, + witnesses: &[DeconstructedPat<'p, 'tcx>], + ) -> Option { + fn maybe_point_at_variant<'a, 'p: 'a, 'tcx: 'a>( + cx: &MatchCheckCtxt<'p, 'tcx>, + def: AdtDef<'tcx>, + patterns: impl Iterator>, + ) -> Vec { + let mut covered = vec![]; + for pattern in patterns { + if let Constructor::Variant(variant_index) = pattern.ctor() { + if let ty::Adt(this_def, _) = pattern.ty().kind() && this_def.did() != def.did() { + continue; + } + let sp = def.variant(*variant_index).ident(cx.tcx).span; + if covered.contains(&sp) { + // Don't point at variants that have already been covered due to other patterns to avoid + // visual clutter. + continue; + } + covered.push(sp); + } + covered.extend(maybe_point_at_variant(cx, def, pattern.iter_fields())); + } + covered + } + + let ty = ty.peel_refs(); + let ty::Adt(def, _) = ty.kind() else { None? }; + let adt_def_span = cx.tcx.hir().get_if_local(def.did())?.ident()?.span; + let mut variants = vec![]; + + for span in maybe_point_at_variant(&cx, *def, witnesses.iter().take(5)) { + variants.push(span); + } + Some(AdtDefinedHere { adt_def_span, ty, variants }) + } } impl<'tcx> AddToDiagnostic for AdtDefinedHere<'tcx> { @@ -912,4 +951,6 @@ pub(crate) struct NonExhaustivePatterns<'tcx> { pub span: Span, #[subdiagnostic] pub uncovered: Uncovered<'tcx>, + #[subdiagnostic] + pub adt_defined_here: Option>, } 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 21778c7aa513b..feae2f0b834b9 100644 --- a/compiler/rustc_mir_build/src/thir/pattern/check_match.rs +++ b/compiler/rustc_mir_build/src/thir/pattern/check_match.rs @@ -9,14 +9,14 @@ use crate::errors; use hir::{ExprKind, PatKind}; use rustc_arena::TypedArena; use rustc_ast::{LitKind, Mutability}; -use rustc_errors::{Applicability, Diagnostic, MultiSpan}; +use rustc_errors::Applicability; use rustc_hir as hir; use rustc_hir::def::*; use rustc_hir::def_id::DefId; use rustc_hir::intravisit::{self, Visitor}; use rustc_hir::{HirId, Pat}; use rustc_middle::ty::print::with_no_trimmed_paths; -use rustc_middle::ty::{self, AdtDef, Ty, TyCtxt}; +use rustc_middle::ty::{self, Ty, TyCtxt}; use rustc_session::lint::builtin::{ BINDINGS_WITH_VARIANT_NAME, IRREFUTABLE_LET_PATTERNS, UNREACHABLE_PATTERNS, @@ -432,18 +432,6 @@ impl<'p, 'tcx> MatchVisitor<'_, 'p, 'tcx> { (sp.map(|_|errors::Inform), None, None, None, None) }; - let adt_defined_here = try { - let ty = pattern_ty.peel_refs(); - let ty::Adt(def, _) = ty.kind() else { None? }; - let adt_def_span = cx.tcx.hir().get_if_local(def.did())?.ident()?.span; - let mut variants = vec![]; - - for span in maybe_point_at_variant(&cx, *def, witnesses.iter().take(5)) { - variants.push(errors::Variant { span }); - } - errors::AdtDefinedHere { adt_def_span, ty, variants } - }; - self.tcx.sess.emit_err(errors::PatternNotCovered { span: pat.span, origin, @@ -455,7 +443,7 @@ impl<'p, 'tcx> MatchVisitor<'_, 'p, 'tcx> { let_suggestion, misc_suggestion, res_defined_here, - adt_defined_here, + adt_defined_here: errors::AdtDefinedHere::new(&cx, pattern_ty, &witnesses), }); } } @@ -633,14 +621,13 @@ fn non_exhaustive_match<'p, 'tcx>( let mut err = cx.tcx.sess.create_err(errors::NonExhaustivePatterns { span, uncovered: errors::Uncovered::new(span, &cx, &witnesses), + adt_defined_here: errors::AdtDefinedHere::new(&cx, scrut_ty, &witnesses), }); let is_variant_list_non_exhaustive = match scrut_ty.kind() { ty::Adt(def, _) if def.is_variant_list_non_exhaustive() && !def.did().is_local() => true, _ => false, }; - - adt_defined_here(cx, &mut err, scrut_ty, &witnesses); err.note(&format!( "the matched value is of type `{}`{}", scrut_ty, @@ -762,64 +749,6 @@ fn non_exhaustive_match<'p, 'tcx>( err.emit(); } -/// Point at the definition of non-covered `enum` variants. -fn adt_defined_here<'p, 'tcx>( - cx: &MatchCheckCtxt<'p, 'tcx>, - err: &mut Diagnostic, - ty: Ty<'tcx>, - witnesses: &[DeconstructedPat<'p, 'tcx>], -) { - let ty = ty.peel_refs(); - if let ty::Adt(def, _) = ty.kind() { - let mut spans = vec![]; - if witnesses.len() < 5 { - for sp in maybe_point_at_variant(cx, *def, witnesses.iter()) { - 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, ""); - for pat in spans { - span.push_span_label(pat, "not covered"); - } - err.span_note(span, &format!("`{}` defined here", ty)); - } -} - -fn maybe_point_at_variant<'a, 'p: 'a, 'tcx: 'a>( - cx: &MatchCheckCtxt<'p, 'tcx>, - def: AdtDef<'tcx>, - patterns: impl Iterator>, -) -> Vec { - use Constructor::*; - let mut covered = vec![]; - for pattern in patterns { - if let Variant(variant_index) = pattern.ctor() { - if let ty::Adt(this_def, _) = pattern.ty().kind() && this_def.did() != def.did() { - continue; - } - let sp = def.variant(*variant_index).ident(cx.tcx).span; - if covered.contains(&sp) { - // Don't point at variants that have already been covered due to other patterns to avoid - // visual clutter. - continue; - } - covered.push(sp); - } - covered.extend(maybe_point_at_variant(cx, def, pattern.iter_fields())); - } - covered -} - /// Check if a by-value binding is by-value. That is, check if the binding's type is not `Copy`. fn is_binding_by_move(cx: &MatchVisitor<'_, '_, '_>, hir_id: HirId) -> bool { !cx.typeck_results.node_type(hir_id).is_copy_modulo_regions(cx.tcx, cx.param_env) diff --git a/compiler/rustc_mir_build/src/thir/pattern/deconstruct_pat.rs b/compiler/rustc_mir_build/src/thir/pattern/deconstruct_pat.rs index e5b7d685c499b..1bfcc447e3a48 100644 --- a/compiler/rustc_mir_build/src/thir/pattern/deconstruct_pat.rs +++ b/compiler/rustc_mir_build/src/thir/pattern/deconstruct_pat.rs @@ -449,7 +449,7 @@ impl SliceKind { /// A constructor for array and slice patterns. #[derive(Copy, Clone, Debug, PartialEq, Eq)] -pub(super) struct Slice { +pub(crate) struct Slice { /// `None` if the matched value is a slice, `Some(n)` if it is an array of size `n`. array_len: Option, /// The kind of pattern it is: fixed-length `[x, y]` or variable length `[x, .., y]`. @@ -621,7 +621,7 @@ impl SplitVarLenSlice { /// constructor. `Constructor::apply` reconstructs the pattern from a pair of `Constructor` and /// `Fields`. #[derive(Clone, Debug, PartialEq)] -pub(super) enum Constructor<'tcx> { +pub(crate) enum Constructor<'tcx> { /// The constructor for patterns that have a single constructor, like tuples, struct patterns /// and fixed-length arrays. Single, @@ -1522,17 +1522,17 @@ impl<'p, 'tcx> DeconstructedPat<'p, 'tcx> { matches!(self.ctor, Or) } - pub(super) fn ctor(&self) -> &Constructor<'tcx> { + pub(crate) fn ctor(&self) -> &Constructor<'tcx> { &self.ctor } - pub(super) fn ty(&self) -> Ty<'tcx> { + pub(crate) fn ty(&self) -> Ty<'tcx> { self.ty } pub(super) fn span(&self) -> Span { self.span } - pub(super) fn iter_fields<'a>( + pub(crate) fn iter_fields<'a>( &'a self, ) -> impl Iterator> + Captures<'a> { self.fields.iter_patterns() diff --git a/tests/ui/closures/2229_closure_analysis/match/non-exhaustive-match.stderr b/tests/ui/closures/2229_closure_analysis/match/non-exhaustive-match.stderr index 09307d74dd629..ecee501e34c52 100644 --- a/tests/ui/closures/2229_closure_analysis/match/non-exhaustive-match.stderr +++ b/tests/ui/closures/2229_closure_analysis/match/non-exhaustive-match.stderr @@ -5,10 +5,10 @@ LL | let _b = || { match l1 { L1::A => () } }; | ^^ pattern `L1::B` not covered | note: `L1` defined here - --> $DIR/non-exhaustive-match.rs:12:14 + --> $DIR/non-exhaustive-match.rs:12:6 | LL | enum L1 { A, B } - | -- ^ not covered + | ^^ - not covered = note: the matched value is of type `L1` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | @@ -40,11 +40,6 @@ error[E0004]: match is non-exhaustive 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 by adding a match arm with a wildcard pattern or an explicit pattern as shown | diff --git a/tests/ui/error-codes/E0004-2.stderr b/tests/ui/error-codes/E0004-2.stderr index f0a2666962bc2..74dfd08c5d204 100644 --- a/tests/ui/error-codes/E0004-2.stderr +++ b/tests/ui/error-codes/E0004-2.stderr @@ -4,14 +4,6 @@ error[E0004]: match is non-exhaustive LL | match x { } | ^ patterns `None` and `Some(_)` not covered | -note: `Option` defined here - --> $SRC_DIR/core/src/option.rs:LL:COL - ::: $SRC_DIR/core/src/option.rs:LL:COL - | - = note: not covered - ::: $SRC_DIR/core/src/option.rs:LL:COL - | - = note: not covered = note: the matched value is of type `Option` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms | diff --git a/tests/ui/error-codes/E0004.stderr b/tests/ui/error-codes/E0004.stderr index 21d23744106cd..fd45ce0f7d08d 100644 --- a/tests/ui/error-codes/E0004.stderr +++ b/tests/ui/error-codes/E0004.stderr @@ -5,12 +5,12 @@ LL | match x { | ^ pattern `Terminator::HastaLaVistaBaby` not covered | note: `Terminator` defined here - --> $DIR/E0004.rs:2:5 + --> $DIR/E0004.rs:1:6 | LL | enum Terminator { - | ---------- + | ^^^^^^^^^^ LL | HastaLaVistaBaby, - | ^^^^^^^^^^^^^^^^ not covered + | ---------------- not covered = note: the matched value is of type `Terminator` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | diff --git a/tests/ui/feature-gates/feature-gate-non_exhaustive_omitted_patterns_lint.stderr b/tests/ui/feature-gates/feature-gate-non_exhaustive_omitted_patterns_lint.stderr index 61619ad8b4953..961d2deae79a7 100644 --- a/tests/ui/feature-gates/feature-gate-non_exhaustive_omitted_patterns_lint.stderr +++ b/tests/ui/feature-gates/feature-gate-non_exhaustive_omitted_patterns_lint.stderr @@ -106,12 +106,12 @@ LL | match Foo::A { | ^^^^^^ pattern `Foo::C` not covered | note: `Foo` defined here - --> $DIR/feature-gate-non_exhaustive_omitted_patterns_lint.rs:12:15 + --> $DIR/feature-gate-non_exhaustive_omitted_patterns_lint.rs:11:10 | LL | enum Foo { - | --- + | ^^^ LL | A, B, C, - | ^ not covered + | - not covered = note: the matched value is of type `Foo` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | diff --git a/tests/ui/issue-94866.stderr b/tests/ui/issue-94866.stderr index 82517b2f53ff2..e9aad00269d1b 100644 --- a/tests/ui/issue-94866.stderr +++ b/tests/ui/issue-94866.stderr @@ -5,10 +5,10 @@ LL | match Enum::A { | ^^^^^^^ pattern `Enum::B` not covered | note: `Enum` defined here - --> $DIR/issue-94866.rs:7:16 + --> $DIR/issue-94866.rs:7:6 | LL | enum Enum { A, B } - | ---- ^ not covered + | ^^^^ - not covered = note: the matched value is of type `Enum` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | diff --git a/tests/ui/match/match_non_exhaustive.stderr b/tests/ui/match/match_non_exhaustive.stderr index 8d9d0aff7acc6..6478058e57ee0 100644 --- a/tests/ui/match/match_non_exhaustive.stderr +++ b/tests/ui/match/match_non_exhaustive.stderr @@ -5,10 +5,10 @@ LL | match l { L::A => () }; | ^ pattern `L::B` not covered | note: `L` defined here - --> $DIR/match_non_exhaustive.rs:10:13 + --> $DIR/match_non_exhaustive.rs:10:6 | LL | enum L { A, B } - | - ^ not covered + | ^ - not covered = note: the matched value is of type `L` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | @@ -40,11 +40,6 @@ error[E0004]: match is non-exhaustive 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 by adding a match arm with a wildcard pattern or an explicit pattern as shown | diff --git a/tests/ui/pattern/suggest-adding-appropriate-missing-pattern-excluding-comments.stderr b/tests/ui/pattern/suggest-adding-appropriate-missing-pattern-excluding-comments.stderr index 40062661c2aac..6ee65a248deb6 100644 --- a/tests/ui/pattern/suggest-adding-appropriate-missing-pattern-excluding-comments.stderr +++ b/tests/ui/pattern/suggest-adding-appropriate-missing-pattern-excluding-comments.stderr @@ -4,11 +4,6 @@ error[E0004]: match is non-exhaustive LL | match Some(1) { | ^^^^^^^ pattern `None` not covered | -note: `Option` defined here - --> $SRC_DIR/core/src/option.rs:LL:COL - ::: $SRC_DIR/core/src/option.rs:LL:COL - | - = note: not covered = note: the matched value is of type `Option` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | diff --git a/tests/ui/pattern/usefulness/doc-hidden-non-exhaustive.stderr b/tests/ui/pattern/usefulness/doc-hidden-non-exhaustive.stderr index 8a6d0b7161cba..64299dc9e90f9 100644 --- a/tests/ui/pattern/usefulness/doc-hidden-non-exhaustive.stderr +++ b/tests/ui/pattern/usefulness/doc-hidden-non-exhaustive.stderr @@ -4,11 +4,6 @@ error[E0004]: match is non-exhaustive LL | match HiddenEnum::A { | ^^^^^^^^^^^^^ pattern `_` not covered | -note: `HiddenEnum` defined here - --> $DIR/auxiliary/hidden.rs:1:1 - | -LL | pub enum HiddenEnum { - | ^^^^^^^^^^^^^^^^^^^ = note: the matched value is of type `HiddenEnum` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | @@ -22,14 +17,6 @@ error[E0004]: match is non-exhaustive LL | match HiddenEnum::A { | ^^^^^^^^^^^^^ pattern `HiddenEnum::B` not covered | -note: `HiddenEnum` defined here - --> $DIR/auxiliary/hidden.rs:3:5 - | -LL | pub enum HiddenEnum { - | ------------------- -LL | A, -LL | B, - | ^ not covered = note: the matched value is of type `HiddenEnum` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | @@ -43,14 +30,6 @@ error[E0004]: match is non-exhaustive LL | match HiddenEnum::A { | ^^^^^^^^^^^^^ patterns `HiddenEnum::B` and `_` not covered | -note: `HiddenEnum` defined here - --> $DIR/auxiliary/hidden.rs:3:5 - | -LL | pub enum HiddenEnum { - | ------------------- -LL | A, -LL | B, - | ^ not covered = note: the matched value is of type `HiddenEnum` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms | @@ -64,11 +43,6 @@ error[E0004]: match is non-exhaustive LL | match None { | ^^^^ patterns `Some(HiddenEnum::B)` and `Some(_)` not covered | -note: `Option` defined here - --> $SRC_DIR/core/src/option.rs:LL:COL - ::: $SRC_DIR/core/src/option.rs:LL:COL - | - = note: not covered = note: the matched value is of type `Option` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms | @@ -83,13 +57,13 @@ LL | match InCrate::A { | ^^^^^^^^^^ pattern `InCrate::C` not covered | note: `InCrate` defined here - --> $DIR/doc-hidden-non-exhaustive.rs:11:5 + --> $DIR/doc-hidden-non-exhaustive.rs:7:6 | LL | enum InCrate { - | ------- + | ^^^^^^^ ... LL | C, - | ^ not covered + | - not covered = note: the matched value is of type `InCrate` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | diff --git a/tests/ui/pattern/usefulness/empty-match.exhaustive_patterns.stderr b/tests/ui/pattern/usefulness/empty-match.exhaustive_patterns.stderr index 3ae6b67f60ed1..86015839054ef 100644 --- a/tests/ui/pattern/usefulness/empty-match.exhaustive_patterns.stderr +++ b/tests/ui/pattern/usefulness/empty-match.exhaustive_patterns.stderr @@ -112,12 +112,12 @@ LL | match_no_arms!(NonEmptyEnum1::Foo(true)); | ^^^^^^^^^^^^^^^^^^^^^^^^ pattern `NonEmptyEnum1::Foo(_)` not covered | note: `NonEmptyEnum1` defined here - --> $DIR/empty-match.rs:24:5 + --> $DIR/empty-match.rs:23:6 | LL | enum NonEmptyEnum1 { - | ------------- + | ^^^^^^^^^^^^^ LL | Foo(bool), - | ^^^ not covered + | --- not covered = note: the matched value is of type `NonEmptyEnum1` = help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern @@ -128,14 +128,14 @@ LL | match_no_arms!(NonEmptyEnum2::Foo(true)); | ^^^^^^^^^^^^^^^^^^^^^^^^ patterns `NonEmptyEnum2::Foo(_)` and `NonEmptyEnum2::Bar` not covered | note: `NonEmptyEnum2` defined here - --> $DIR/empty-match.rs:27:5 + --> $DIR/empty-match.rs:26:6 | LL | enum NonEmptyEnum2 { - | ------------- + | ^^^^^^^^^^^^^ LL | Foo(bool), - | ^^^ not covered + | --- not covered LL | Bar, - | ^^^ not covered + | --- not covered = note: the matched value is of type `NonEmptyEnum2` = help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or multiple match arms @@ -150,6 +150,13 @@ note: `NonEmptyEnum5` defined here | LL | enum NonEmptyEnum5 { | ^^^^^^^^^^^^^ +LL | V1, V2, V3, V4, V5, + | -- -- -- -- -- not covered + | | | | | + | | | | not covered + | | | not covered + | | not covered + | not covered = note: the matched value is of type `NonEmptyEnum5` = help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or multiple match arms @@ -245,12 +252,12 @@ LL | match_guarded_arm!(NonEmptyEnum1::Foo(true)); | ^^^^^^^^^^^^^^^^^^^^^^^^ pattern `NonEmptyEnum1::Foo(_)` not covered | note: `NonEmptyEnum1` defined here - --> $DIR/empty-match.rs:24:5 + --> $DIR/empty-match.rs:23:6 | LL | enum NonEmptyEnum1 { - | ------------- + | ^^^^^^^^^^^^^ LL | Foo(bool), - | ^^^ not covered + | --- not covered = note: the matched value is of type `NonEmptyEnum1` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | @@ -265,14 +272,14 @@ LL | match_guarded_arm!(NonEmptyEnum2::Foo(true)); | ^^^^^^^^^^^^^^^^^^^^^^^^ patterns `NonEmptyEnum2::Foo(_)` and `NonEmptyEnum2::Bar` not covered | note: `NonEmptyEnum2` defined here - --> $DIR/empty-match.rs:27:5 + --> $DIR/empty-match.rs:26:6 | LL | enum NonEmptyEnum2 { - | ------------- + | ^^^^^^^^^^^^^ LL | Foo(bool), - | ^^^ not covered + | --- not covered LL | Bar, - | ^^^ not covered + | --- not covered = note: the matched value is of type `NonEmptyEnum2` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms | @@ -291,6 +298,13 @@ note: `NonEmptyEnum5` defined here | LL | enum NonEmptyEnum5 { | ^^^^^^^^^^^^^ +LL | V1, V2, V3, V4, V5, + | -- -- -- -- -- not covered + | | | | | + | | | | not covered + | | | not covered + | | not covered + | not covered = note: the matched value is of type `NonEmptyEnum5` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown, or multiple match arms | diff --git a/tests/ui/pattern/usefulness/empty-match.normal.stderr b/tests/ui/pattern/usefulness/empty-match.normal.stderr index 3ae6b67f60ed1..86015839054ef 100644 --- a/tests/ui/pattern/usefulness/empty-match.normal.stderr +++ b/tests/ui/pattern/usefulness/empty-match.normal.stderr @@ -112,12 +112,12 @@ LL | match_no_arms!(NonEmptyEnum1::Foo(true)); | ^^^^^^^^^^^^^^^^^^^^^^^^ pattern `NonEmptyEnum1::Foo(_)` not covered | note: `NonEmptyEnum1` defined here - --> $DIR/empty-match.rs:24:5 + --> $DIR/empty-match.rs:23:6 | LL | enum NonEmptyEnum1 { - | ------------- + | ^^^^^^^^^^^^^ LL | Foo(bool), - | ^^^ not covered + | --- not covered = note: the matched value is of type `NonEmptyEnum1` = help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern @@ -128,14 +128,14 @@ LL | match_no_arms!(NonEmptyEnum2::Foo(true)); | ^^^^^^^^^^^^^^^^^^^^^^^^ patterns `NonEmptyEnum2::Foo(_)` and `NonEmptyEnum2::Bar` not covered | note: `NonEmptyEnum2` defined here - --> $DIR/empty-match.rs:27:5 + --> $DIR/empty-match.rs:26:6 | LL | enum NonEmptyEnum2 { - | ------------- + | ^^^^^^^^^^^^^ LL | Foo(bool), - | ^^^ not covered + | --- not covered LL | Bar, - | ^^^ not covered + | --- not covered = note: the matched value is of type `NonEmptyEnum2` = help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or multiple match arms @@ -150,6 +150,13 @@ note: `NonEmptyEnum5` defined here | LL | enum NonEmptyEnum5 { | ^^^^^^^^^^^^^ +LL | V1, V2, V3, V4, V5, + | -- -- -- -- -- not covered + | | | | | + | | | | not covered + | | | not covered + | | not covered + | not covered = note: the matched value is of type `NonEmptyEnum5` = help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or multiple match arms @@ -245,12 +252,12 @@ LL | match_guarded_arm!(NonEmptyEnum1::Foo(true)); | ^^^^^^^^^^^^^^^^^^^^^^^^ pattern `NonEmptyEnum1::Foo(_)` not covered | note: `NonEmptyEnum1` defined here - --> $DIR/empty-match.rs:24:5 + --> $DIR/empty-match.rs:23:6 | LL | enum NonEmptyEnum1 { - | ------------- + | ^^^^^^^^^^^^^ LL | Foo(bool), - | ^^^ not covered + | --- not covered = note: the matched value is of type `NonEmptyEnum1` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | @@ -265,14 +272,14 @@ LL | match_guarded_arm!(NonEmptyEnum2::Foo(true)); | ^^^^^^^^^^^^^^^^^^^^^^^^ patterns `NonEmptyEnum2::Foo(_)` and `NonEmptyEnum2::Bar` not covered | note: `NonEmptyEnum2` defined here - --> $DIR/empty-match.rs:27:5 + --> $DIR/empty-match.rs:26:6 | LL | enum NonEmptyEnum2 { - | ------------- + | ^^^^^^^^^^^^^ LL | Foo(bool), - | ^^^ not covered + | --- not covered LL | Bar, - | ^^^ not covered + | --- not covered = note: the matched value is of type `NonEmptyEnum2` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms | @@ -291,6 +298,13 @@ note: `NonEmptyEnum5` defined here | LL | enum NonEmptyEnum5 { | ^^^^^^^^^^^^^ +LL | V1, V2, V3, V4, V5, + | -- -- -- -- -- not covered + | | | | | + | | | | not covered + | | | not covered + | | not covered + | not covered = note: the matched value is of type `NonEmptyEnum5` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown, or multiple match arms | diff --git a/tests/ui/pattern/usefulness/issue-35609.stderr b/tests/ui/pattern/usefulness/issue-35609.stderr index 61c4b4963e22b..16e2bd73cb91e 100644 --- a/tests/ui/pattern/usefulness/issue-35609.stderr +++ b/tests/ui/pattern/usefulness/issue-35609.stderr @@ -105,8 +105,6 @@ error[E0004]: match is non-exhaustive LL | match Some(A) { | ^^^^^^^ patterns `Some(Enum::B)`, `Some(Enum::C)`, `Some(Enum::D)` and 2 more not covered | -note: `Option` defined here - --> $SRC_DIR/core/src/option.rs:LL:COL = note: the matched value is of type `Option` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown, or multiple match arms | diff --git a/tests/ui/pattern/usefulness/issue-3601.stderr b/tests/ui/pattern/usefulness/issue-3601.stderr index 139c31b97a75b..ba661e7a45a64 100644 --- a/tests/ui/pattern/usefulness/issue-3601.stderr +++ b/tests/ui/pattern/usefulness/issue-3601.stderr @@ -4,8 +4,6 @@ error[E0004]: match is non-exhaustive LL | box NodeKind::Element(ed) => match ed.kind { | ^^^^^^^ pattern `box _` not covered | -note: `Box` defined here - --> $SRC_DIR/alloc/src/boxed.rs:LL:COL = note: the matched value is of type `Box` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | diff --git a/tests/ui/pattern/usefulness/issue-39362.stderr b/tests/ui/pattern/usefulness/issue-39362.stderr index 39d951181d5b6..b450a54f91052 100644 --- a/tests/ui/pattern/usefulness/issue-39362.stderr +++ b/tests/ui/pattern/usefulness/issue-39362.stderr @@ -5,12 +5,12 @@ LL | match f { | ^ patterns `Foo::Bar { bar: Bar::C, .. }`, `Foo::Bar { bar: Bar::D, .. }`, `Foo::Bar { bar: Bar::E, .. }` and 1 more not covered | note: `Foo` defined here - --> $DIR/issue-39362.rs:2:5 + --> $DIR/issue-39362.rs:1:6 | LL | enum Foo { - | --- + | ^^^ LL | Bar { bar: Bar, id: usize } - | ^^^ not covered + | --- not covered = note: the matched value is of type `Foo` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown, or multiple match arms | diff --git a/tests/ui/pattern/usefulness/issue-40221.stderr b/tests/ui/pattern/usefulness/issue-40221.stderr index e8a8f974ee089..5a228ffd1d59a 100644 --- a/tests/ui/pattern/usefulness/issue-40221.stderr +++ b/tests/ui/pattern/usefulness/issue-40221.stderr @@ -5,12 +5,12 @@ LL | match proto { | ^^^^^ pattern `P::C(PC::QA)` not covered | note: `P` defined here - --> $DIR/issue-40221.rs:2:5 + --> $DIR/issue-40221.rs:1:6 | LL | enum P { - | - + | ^ LL | C(PC), - | ^ not covered + | - not covered = note: the matched value is of type `P` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | diff --git a/tests/ui/pattern/usefulness/issue-56379.stderr b/tests/ui/pattern/usefulness/issue-56379.stderr index 390300fd99e0f..0385f4f310b4e 100644 --- a/tests/ui/pattern/usefulness/issue-56379.stderr +++ b/tests/ui/pattern/usefulness/issue-56379.stderr @@ -5,16 +5,16 @@ LL | match Foo::A(true) { | ^^^^^^^^^^^^ patterns `Foo::A(false)`, `Foo::B(false)` and `Foo::C(false)` not covered | note: `Foo` defined here - --> $DIR/issue-56379.rs:2:5 + --> $DIR/issue-56379.rs:1:6 | LL | enum Foo { - | --- + | ^^^ LL | A(bool), - | ^ not covered + | - not covered LL | B(bool), - | ^ not covered + | - not covered LL | C(bool), - | ^ not covered + | - not covered = note: the matched value is of type `Foo` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms | diff --git a/tests/ui/pattern/usefulness/match-arm-statics-2.stderr b/tests/ui/pattern/usefulness/match-arm-statics-2.stderr index a16a23469504b..4affd9c49ecf6 100644 --- a/tests/ui/pattern/usefulness/match-arm-statics-2.stderr +++ b/tests/ui/pattern/usefulness/match-arm-statics-2.stderr @@ -17,13 +17,6 @@ error[E0004]: match is non-exhaustive LL | match Some(Some(North)) { | ^^^^^^^^^^^^^^^^^ pattern `Some(Some(Direction::West))` not covered | -note: `Option>` defined here - --> $SRC_DIR/core/src/option.rs:LL:COL - ::: $SRC_DIR/core/src/option.rs:LL:COL - | - = note: not covered - | - = note: not covered = note: the matched value is of type `Option>` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | diff --git a/tests/ui/pattern/usefulness/match-privately-empty.stderr b/tests/ui/pattern/usefulness/match-privately-empty.stderr index 6d241b343bc1e..7c71b83c8ed10 100644 --- a/tests/ui/pattern/usefulness/match-privately-empty.stderr +++ b/tests/ui/pattern/usefulness/match-privately-empty.stderr @@ -4,11 +4,6 @@ error[E0004]: match is non-exhaustive LL | match private::DATA { | ^^^^^^^^^^^^^ pattern `Some(Private { misc: true, .. })` not covered | -note: `Option` defined here - --> $SRC_DIR/core/src/option.rs:LL:COL - ::: $SRC_DIR/core/src/option.rs:LL:COL - | - = note: not covered = note: the matched value is of type `Option` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | diff --git a/tests/ui/pattern/usefulness/non-exhaustive-defined-here.rs b/tests/ui/pattern/usefulness/non-exhaustive-defined-here.rs index f8a8c4a2c0de6..353b559286d3e 100644 --- a/tests/ui/pattern/usefulness/non-exhaustive-defined-here.rs +++ b/tests/ui/pattern/usefulness/non-exhaustive-defined-here.rs @@ -4,18 +4,15 @@ #[derive(Clone)] enum E { - //~^ NOTE - //~| NOTE - //~| NOTE + //~^ NOTE `E` defined here + //~| NOTE `E` defined here + //~| NOTE `E` defined here //~| NOTE //~| NOTE //~| NOTE A, B, - //~^ 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 @@ -79,12 +76,11 @@ fn by_ref_thrice(e: & &mut &E) { } enum Opt { - //~^ NOTE + //~^ NOTE `Opt` defined here //~| NOTE Some(u8), None, - //~^ NOTE `Opt` defined here - //~| NOTE not covered + //~^ NOTE not covered //~| NOTE not covered } diff --git a/tests/ui/pattern/usefulness/non-exhaustive-defined-here.stderr b/tests/ui/pattern/usefulness/non-exhaustive-defined-here.stderr index cf08d57d91ba1..0785d98bc900d 100644 --- a/tests/ui/pattern/usefulness/non-exhaustive-defined-here.stderr +++ b/tests/ui/pattern/usefulness/non-exhaustive-defined-here.stderr @@ -1,20 +1,20 @@ error[E0004]: match is non-exhaustive - --> $DIR/non-exhaustive-defined-here.rs:35:11 + --> $DIR/non-exhaustive-defined-here.rs:32:11 | LL | match e1 { | ^^ patterns `E::B` and `E::C` not covered | note: `E` defined here - --> $DIR/non-exhaustive-defined-here.rs:14:5 + --> $DIR/non-exhaustive-defined-here.rs:6:6 | LL | enum E { - | - + | ^ ... LL | B, - | ^ not covered + | - not covered ... LL | C - | ^ not covered + | - not covered = note: the matched value is of type `E` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms | @@ -23,7 +23,7 @@ LL + E::B | E::C => todo!() | error[E0005]: refutable pattern in local binding - --> $DIR/non-exhaustive-defined-here.rs:41:9 + --> $DIR/non-exhaustive-defined-here.rs:38:9 | LL | let E::A = e; | ^^^^ patterns `E::B` and `E::C` not covered @@ -48,22 +48,22 @@ LL | if let E::A = e { todo!() } | ++ ~~~~~~~~~~~ error[E0004]: match is non-exhaustive - --> $DIR/non-exhaustive-defined-here.rs:50:11 + --> $DIR/non-exhaustive-defined-here.rs:47:11 | LL | match e { | ^ patterns `&E::B` and `&E::C` not covered | note: `E` defined here - --> $DIR/non-exhaustive-defined-here.rs:14:5 + --> $DIR/non-exhaustive-defined-here.rs:6:6 | LL | enum E { - | - + | ^ ... LL | B, - | ^ not covered + | - not covered ... LL | C - | ^ not covered + | - not covered = note: the matched value is of type `&E` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms | @@ -72,7 +72,7 @@ LL + &E::B | &E::C => todo!() | error[E0005]: refutable pattern in local binding - --> $DIR/non-exhaustive-defined-here.rs:57:9 + --> $DIR/non-exhaustive-defined-here.rs:54:9 | LL | let E::A = e; | ^^^^ patterns `&E::B` and `&E::C` not covered @@ -97,22 +97,22 @@ LL | if let E::A = e { todo!() } | ++ ~~~~~~~~~~~ error[E0004]: match is non-exhaustive - --> $DIR/non-exhaustive-defined-here.rs:66:11 + --> $DIR/non-exhaustive-defined-here.rs:63:11 | LL | match e { | ^ patterns `&&mut &E::B` and `&&mut &E::C` not covered | note: `E` defined here - --> $DIR/non-exhaustive-defined-here.rs:14:5 + --> $DIR/non-exhaustive-defined-here.rs:6:6 | LL | enum E { - | - + | ^ ... LL | B, - | ^ not covered + | - not covered ... LL | C - | ^ not covered + | - not covered = note: the matched value is of type `&&mut &E` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms | @@ -121,7 +121,7 @@ LL + &&mut &E::B | &&mut &E::C => todo!() | error[E0005]: refutable pattern in local binding - --> $DIR/non-exhaustive-defined-here.rs:73:9 + --> $DIR/non-exhaustive-defined-here.rs:70:9 | LL | let E::A = e; | ^^^^ patterns `&&mut &E::B` and `&&mut &E::C` not covered @@ -146,19 +146,19 @@ LL | if let E::A = e { todo!() } | ++ ~~~~~~~~~~~ error[E0004]: match is non-exhaustive - --> $DIR/non-exhaustive-defined-here.rs:92:11 + --> $DIR/non-exhaustive-defined-here.rs:88:11 | LL | match e { | ^ pattern `Opt::None` not covered | note: `Opt` defined here - --> $DIR/non-exhaustive-defined-here.rs:85:5 + --> $DIR/non-exhaustive-defined-here.rs:78:6 | LL | enum Opt { - | --- + | ^^^ ... LL | None, - | ^^^^ not covered + | ---- not covered = note: the matched value is of type `Opt` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | @@ -167,7 +167,7 @@ LL + Opt::None => todo!() | error[E0005]: refutable pattern in local binding - --> $DIR/non-exhaustive-defined-here.rs:99:9 + --> $DIR/non-exhaustive-defined-here.rs:95:9 | LL | let Opt::Some(ref _x) = e; | ^^^^^^^^^^^^^^^^^ pattern `Opt::None` not covered @@ -175,7 +175,7 @@ LL | let Opt::Some(ref _x) = e; = 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:81:6 + --> $DIR/non-exhaustive-defined-here.rs:78:6 | LL | enum Opt { | ^^^ diff --git a/tests/ui/pattern/usefulness/non-exhaustive-match-nested.stderr b/tests/ui/pattern/usefulness/non-exhaustive-match-nested.stderr index 5ce7dbce832cd..0ed436b301aa7 100644 --- a/tests/ui/pattern/usefulness/non-exhaustive-match-nested.stderr +++ b/tests/ui/pattern/usefulness/non-exhaustive-match-nested.stderr @@ -18,10 +18,10 @@ LL | match x { | ^ pattern `T::A(U::C)` not covered | note: `T` defined here - --> $DIR/non-exhaustive-match-nested.rs:1:10 + --> $DIR/non-exhaustive-match-nested.rs:1:6 | LL | enum T { A(U), B } - | - ^ not covered + | ^ - not covered = note: the matched value is of type `T` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | diff --git a/tests/ui/pattern/usefulness/non-exhaustive-match.stderr b/tests/ui/pattern/usefulness/non-exhaustive-match.stderr index bdbaa02c0b5a3..78f2918acdb2b 100644 --- a/tests/ui/pattern/usefulness/non-exhaustive-match.stderr +++ b/tests/ui/pattern/usefulness/non-exhaustive-match.stderr @@ -5,10 +5,10 @@ LL | match x { T::B => { } } | ^ pattern `T::A` not covered | note: `T` defined here - --> $DIR/non-exhaustive-match.rs:3:10 + --> $DIR/non-exhaustive-match.rs:3:6 | LL | enum T { A, B } - | - ^ not covered + | ^ - not covered = note: the matched value is of type `T` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | @@ -34,11 +34,6 @@ error[E0004]: match is non-exhaustive LL | match Some(10) { | ^^^^^^^^ pattern `Some(_)` not covered | -note: `Option` defined here - --> $SRC_DIR/core/src/option.rs:LL:COL - ::: $SRC_DIR/core/src/option.rs:LL:COL - | - = note: not covered = note: the matched value is of type `Option` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | @@ -79,10 +74,10 @@ LL | match T::A { | ^^^^ pattern `T::B` not covered | note: `T` defined here - --> $DIR/non-exhaustive-match.rs:3:13 + --> $DIR/non-exhaustive-match.rs:3:6 | LL | enum T { A, B } - | - ^ not covered + | ^ - not covered = note: the matched value is of type `T` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | diff --git a/tests/ui/pattern/usefulness/non-exhaustive-pattern-witness.stderr b/tests/ui/pattern/usefulness/non-exhaustive-pattern-witness.stderr index 7ee8869d5ab55..ec06c010df11b 100644 --- a/tests/ui/pattern/usefulness/non-exhaustive-pattern-witness.stderr +++ b/tests/ui/pattern/usefulness/non-exhaustive-pattern-witness.stderr @@ -23,12 +23,12 @@ LL | match Color::Red { | ^^^^^^^^^^ pattern `Color::Red` not covered | note: `Color` defined here - --> $DIR/non-exhaustive-pattern-witness.rs:17:5 + --> $DIR/non-exhaustive-pattern-witness.rs:16:6 | LL | enum Color { - | ----- + | ^^^^^ LL | Red, - | ^^^ not covered + | --- not covered = note: the matched value is of type `Color` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | @@ -43,12 +43,12 @@ LL | match Direction::North { | ^^^^^^^^^^^^^^^^ patterns `Direction::East`, `Direction::South` and `Direction::West` not covered | note: `Direction` defined here - --> $DIR/non-exhaustive-pattern-witness.rs:31:12 + --> $DIR/non-exhaustive-pattern-witness.rs:30:6 | LL | enum Direction { - | --------- + | ^^^^^^^^^ LL | North, East, South, West - | ^^^^ ^^^^^ ^^^^ not covered + | ---- ----- ---- not covered | | | | | not covered | not covered @@ -70,6 +70,13 @@ note: `ExcessiveEnum` defined here | LL | enum ExcessiveEnum { | ^^^^^^^^^^^^^ +LL | First, Second, Third, Fourth, Fifth, Sixth, Seventh, Eighth, Ninth, Tenth, Eleventh, Twelfth + | ------ ----- ------ ----- ----- not covered + | | | | | + | | | | not covered + | | | not covered + | | not covered + | not covered = note: the matched value is of type `ExcessiveEnum` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown, or multiple match arms | @@ -84,13 +91,13 @@ LL | match Color::Red { | ^^^^^^^^^^ pattern `Color::CustomRGBA { a: true, .. }` not covered | note: `Color` defined here - --> $DIR/non-exhaustive-pattern-witness.rs:19:5 + --> $DIR/non-exhaustive-pattern-witness.rs:16:6 | LL | enum Color { - | ----- + | ^^^^^ ... LL | CustomRGBA { a: bool, r: u8, g: u8, b: u8 } - | ^^^^^^^^^^ not covered + | ---------- not covered = note: the matched value is of type `Color` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | diff --git a/tests/ui/pattern/usefulness/stable-gated-patterns.stderr b/tests/ui/pattern/usefulness/stable-gated-patterns.stderr index 281e69d57159b..ae1a8f7fe3eea 100644 --- a/tests/ui/pattern/usefulness/stable-gated-patterns.stderr +++ b/tests/ui/pattern/usefulness/stable-gated-patterns.stderr @@ -4,14 +4,6 @@ error[E0004]: match is non-exhaustive LL | match UnstableEnum::Stable { | ^^^^^^^^^^^^^^^^^^^^ patterns `UnstableEnum::Stable2` and `_` not covered | -note: `UnstableEnum` defined here - --> $DIR/auxiliary/unstable.rs:9:5 - | -LL | pub enum UnstableEnum { - | --------------------- -... -LL | Stable2, - | ^^^^^^^ not covered = note: the matched value is of type `UnstableEnum` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms | @@ -25,11 +17,6 @@ error[E0004]: match is non-exhaustive LL | match UnstableEnum::Stable { | ^^^^^^^^^^^^^^^^^^^^ pattern `_` not covered | -note: `UnstableEnum` defined here - --> $DIR/auxiliary/unstable.rs:5:1 - | -LL | pub enum UnstableEnum { - | ^^^^^^^^^^^^^^^^^^^^^ = note: the matched value is of type `UnstableEnum` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | diff --git a/tests/ui/pattern/usefulness/struct-like-enum-nonexhaustive.stderr b/tests/ui/pattern/usefulness/struct-like-enum-nonexhaustive.stderr index 993357a2829a4..0e0d89c210093 100644 --- a/tests/ui/pattern/usefulness/struct-like-enum-nonexhaustive.stderr +++ b/tests/ui/pattern/usefulness/struct-like-enum-nonexhaustive.stderr @@ -5,12 +5,12 @@ LL | match x { | ^ pattern `A::B { x: Some(_) }` not covered | note: `A` defined here - --> $DIR/struct-like-enum-nonexhaustive.rs:2:5 + --> $DIR/struct-like-enum-nonexhaustive.rs:1:6 | LL | enum A { - | - + | ^ LL | B { x: Option }, - | ^ not covered + | - not covered = note: the matched value is of type `A` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | diff --git a/tests/ui/pattern/usefulness/unstable-gated-patterns.stderr b/tests/ui/pattern/usefulness/unstable-gated-patterns.stderr index 2dd5bfc07ab68..5a4a6265d74b1 100644 --- a/tests/ui/pattern/usefulness/unstable-gated-patterns.stderr +++ b/tests/ui/pattern/usefulness/unstable-gated-patterns.stderr @@ -4,14 +4,6 @@ error[E0004]: match is non-exhaustive LL | match UnstableEnum::Stable { | ^^^^^^^^^^^^^^^^^^^^ pattern `UnstableEnum::Unstable` not covered | -note: `UnstableEnum` defined here - --> $DIR/auxiliary/unstable.rs:11:5 - | -LL | pub enum UnstableEnum { - | --------------------- -... -LL | Unstable, - | ^^^^^^^^ not covered = note: the matched value is of type `UnstableEnum` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | diff --git a/tests/ui/rfc-2008-non-exhaustive/enum.stderr b/tests/ui/rfc-2008-non-exhaustive/enum.stderr index b4622274f317b..f78803bcfe5ef 100644 --- a/tests/ui/rfc-2008-non-exhaustive/enum.stderr +++ b/tests/ui/rfc-2008-non-exhaustive/enum.stderr @@ -23,11 +23,6 @@ error[E0004]: match is non-exhaustive LL | match enum_unit { | ^^^^^^^^^ pattern `_` not covered | -note: `NonExhaustiveEnum` defined here - --> $DIR/auxiliary/enums.rs:4:1 - | -LL | pub enum NonExhaustiveEnum { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: the matched value is of type `NonExhaustiveEnum`, which is marked as non-exhaustive help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | @@ -41,11 +36,6 @@ error[E0004]: match is non-exhaustive LL | match enum_unit {}; | ^^^^^^^^^ pattern `_` not covered | -note: `NonExhaustiveEnum` defined here - --> $DIR/auxiliary/enums.rs:4:1 - | -LL | pub enum NonExhaustiveEnum { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: the matched value is of type `NonExhaustiveEnum`, which is marked as non-exhaustive help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | diff --git a/tests/ui/rfc-2008-non-exhaustive/enum_same_crate_empty_match.stderr b/tests/ui/rfc-2008-non-exhaustive/enum_same_crate_empty_match.stderr index 7aea4f97cf657..02985fbc3664e 100644 --- a/tests/ui/rfc-2008-non-exhaustive/enum_same_crate_empty_match.stderr +++ b/tests/ui/rfc-2008-non-exhaustive/enum_same_crate_empty_match.stderr @@ -17,18 +17,18 @@ LL | match NonExhaustiveEnum::Unit {} | ^^^^^^^^^^^^^^^^^^^^^^^ patterns `NonExhaustiveEnum::Unit`, `NonExhaustiveEnum::Tuple(_)` and `NonExhaustiveEnum::Struct { .. }` not covered | note: `NonExhaustiveEnum` defined here - --> $DIR/enum_same_crate_empty_match.rs:5:5 + --> $DIR/enum_same_crate_empty_match.rs:4:10 | LL | pub enum NonExhaustiveEnum { - | ----------------- + | ^^^^^^^^^^^^^^^^^ LL | Unit, - | ^^^^ not covered + | ---- not covered LL | LL | Tuple(u32), - | ^^^^^ not covered + | ----- not covered LL | LL | Struct { field: u32 } - | ^^^^^^ not covered + | ------ not covered = note: the matched value is of type `NonExhaustiveEnum` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms | @@ -44,18 +44,18 @@ LL | match NormalEnum::Unit {} | ^^^^^^^^^^^^^^^^ patterns `NormalEnum::Unit`, `NormalEnum::Tuple(_)` and `NormalEnum::Struct { .. }` not covered | note: `NormalEnum` defined here - --> $DIR/enum_same_crate_empty_match.rs:14:5 + --> $DIR/enum_same_crate_empty_match.rs:13:10 | LL | pub enum NormalEnum { - | ---------- + | ^^^^^^^^^^ LL | Unit, - | ^^^^ not covered + | ---- not covered LL | LL | Tuple(u32), - | ^^^^^ not covered + | ----- not covered LL | LL | Struct { field: u32 } - | ^^^^^^ not covered + | ------ not covered = note: the matched value is of type `NormalEnum` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms | diff --git a/tests/ui/rfc-2008-non-exhaustive/uninhabited/match.stderr b/tests/ui/rfc-2008-non-exhaustive/uninhabited/match.stderr index 35881918eb1c0..6fbef340beed5 100644 --- a/tests/ui/rfc-2008-non-exhaustive/uninhabited/match.stderr +++ b/tests/ui/rfc-2008-non-exhaustive/uninhabited/match.stderr @@ -61,15 +61,6 @@ error[E0004]: match is non-exhaustive LL | match x {} | ^ patterns `UninhabitedVariants::Tuple(_)` and `UninhabitedVariants::Struct { .. }` 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 = note: the matched value is of type `UninhabitedVariants` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms | diff --git a/tests/ui/rfc-2008-non-exhaustive/uninhabited/match_same_crate.stderr b/tests/ui/rfc-2008-non-exhaustive/uninhabited/match_same_crate.stderr index 628adb9f4978e..7b6150b6ddc6e 100644 --- a/tests/ui/rfc-2008-non-exhaustive/uninhabited/match_same_crate.stderr +++ b/tests/ui/rfc-2008-non-exhaustive/uninhabited/match_same_crate.stderr @@ -43,14 +43,14 @@ LL | match x {} | ^ patterns `UninhabitedVariants::Tuple(_)` and `UninhabitedVariants::Struct { .. }` not covered | note: `UninhabitedVariants` defined here - --> $DIR/match_same_crate.rs:16:23 + --> $DIR/match_same_crate.rs:15:10 | LL | pub enum UninhabitedVariants { - | ------------------- + | ^^^^^^^^^^^^^^^^^^^ LL | #[non_exhaustive] Tuple(!), - | ^^^^^ not covered + | ----- not covered LL | #[non_exhaustive] Struct { x: ! } - | ^^^^^^ not covered + | ------ not covered = note: the matched value is of type `UninhabitedVariants` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms | diff --git a/tests/ui/rfc-2008-non-exhaustive/uninhabited/match_with_exhaustive_patterns.stderr b/tests/ui/rfc-2008-non-exhaustive/uninhabited/match_with_exhaustive_patterns.stderr index dd7dec5320e8f..b9e86f56f28ff 100644 --- a/tests/ui/rfc-2008-non-exhaustive/uninhabited/match_with_exhaustive_patterns.stderr +++ b/tests/ui/rfc-2008-non-exhaustive/uninhabited/match_with_exhaustive_patterns.stderr @@ -61,15 +61,6 @@ error[E0004]: match is non-exhaustive LL | match x {} | ^ patterns `UninhabitedVariants::Tuple(_)` and `UninhabitedVariants::Struct { .. }` 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 = note: the matched value is of type `UninhabitedVariants` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms | diff --git a/tests/ui/uninhabited/uninhabited-matches-feature-gated.stderr b/tests/ui/uninhabited/uninhabited-matches-feature-gated.stderr index 39b80da2c8f61..6f921706333bf 100644 --- a/tests/ui/uninhabited/uninhabited-matches-feature-gated.stderr +++ b/tests/ui/uninhabited/uninhabited-matches-feature-gated.stderr @@ -4,11 +4,6 @@ error[E0004]: match is non-exhaustive LL | let _ = match x { | ^ pattern `Err(_)` not covered | -note: `Result` defined here - --> $SRC_DIR/core/src/result.rs:LL:COL - ::: $SRC_DIR/core/src/result.rs:LL:COL - | - = note: not covered = note: the matched value is of type `Result` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | @@ -83,11 +78,6 @@ error[E0004]: match is non-exhaustive LL | let _ = match x { | ^ pattern `Err(_)` not covered | -note: `Result` defined here - --> $SRC_DIR/core/src/result.rs:LL:COL - ::: $SRC_DIR/core/src/result.rs:LL:COL - | - = note: not covered = note: the matched value is of type `Result` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | From a001fb229dbb8dac4443ca8b7b556fbf827f45d9 Mon Sep 17 00:00:00 2001 From: mejrs <59372212+mejrs@users.noreply.github.com> Date: Sun, 19 Feb 2023 14:50:26 +0100 Subject: [PATCH 04/11] migrate is_variant_list_non_exhaustive --- compiler/rustc_mir_build/messages.ftl | 4 +++ compiler/rustc_mir_build/src/errors.rs | 36 +++++++++++++------ .../src/thir/pattern/check_match.rs | 11 ++---- 3 files changed, 32 insertions(+), 19 deletions(-) diff --git a/compiler/rustc_mir_build/messages.ftl b/compiler/rustc_mir_build/messages.ftl index e202e432bd56e..8649521ea3abd 100644 --- a/compiler/rustc_mir_build/messages.ftl +++ b/compiler/rustc_mir_build/messages.ftl @@ -381,3 +381,7 @@ mir_build_rustc_box_attribute_error = `#[rustc_box]` attribute used incorrectly .missing_box = `#[rustc_box]` requires the `owned_box` lang item mir_build_non_exhaustive_pattern = match is non-exhaustive + +mir_build_type_note = the matched value is of type `{$scrut_ty}` + +mir_build_type_note_non_exhaustive = the matched value is of type `{$scrut_ty}`, which is marked as non-exhaustive diff --git a/compiler/rustc_mir_build/src/errors.rs b/compiler/rustc_mir_build/src/errors.rs index 52d33e638ec8b..cb0a181dbd923 100644 --- a/compiler/rustc_mir_build/src/errors.rs +++ b/compiler/rustc_mir_build/src/errors.rs @@ -354,6 +354,7 @@ pub(crate) struct NonExhaustivePatternsTypeNotEmpty<'p, 'tcx, 'm> { pub expr_span: Span, pub span: Span, pub scrut_ty: Ty<'tcx>, + pub type_note: TypeNote<'tcx>, } impl<'a> IntoDiagnostic<'a> for NonExhaustivePatternsTypeNotEmpty<'_, '_, '_> { @@ -385,19 +386,13 @@ impl<'a> IntoDiagnostic<'a> for NonExhaustivePatternsTypeNotEmpty<'_, '_, '_> { diag.span_note(span, fluent::mir_build_def_note); } - let is_variant_list_non_exhaustive = match self.scrut_ty.kind() { - ty::Adt(def, _) if def.is_variant_list_non_exhaustive() && !def.did().is_local() => { - true + match self.type_note { + TypeNote::MarkedExhaustive { .. } => { + diag.note(fluent::non_exhaustive_type_note) } - _ => false, + TypeNote::NotMarkedExhaustive { .. } => diag.note(fluent::type_note), }; - if is_variant_list_non_exhaustive { - diag.note(fluent::mir_build_non_exhaustive_type_note); - } else { - diag.note(fluent::mir_build_type_note); - } - if let ty::Ref(_, sub_ty, _) = self.scrut_ty.kind() { if !sub_ty.is_inhabited_from(self.cx.tcx, self.cx.module, self.cx.param_env) { diag.note(fluent::mir_build_reference_note); @@ -953,4 +948,25 @@ pub(crate) struct NonExhaustivePatterns<'tcx> { pub uncovered: Uncovered<'tcx>, #[subdiagnostic] pub adt_defined_here: Option>, + #[subdiagnostic] + pub type_note: TypeNote<'tcx>, +} + +#[derive(Subdiagnostic)] +pub enum TypeNote<'tcx> { + #[note(mir_build_type_note)] + NotMarkedExhaustive { scrut_ty: Ty<'tcx> }, + #[note(mir_build_type_note_non_exhaustive)] + MarkedExhaustive { scrut_ty: Ty<'tcx> }, +} + +impl<'tcx> TypeNote<'tcx> { + pub fn new(scrut_ty: Ty<'tcx>) -> Self { + match scrut_ty.kind() { + ty::Adt(def, _) if def.is_variant_list_non_exhaustive() && !def.did().is_local() => { + TypeNote::MarkedExhaustive { scrut_ty } + } + _ => TypeNote::NotMarkedExhaustive { scrut_ty }, + } + } } 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 feae2f0b834b9..ab134040c1dda 100644 --- a/compiler/rustc_mir_build/src/thir/pattern/check_match.rs +++ b/compiler/rustc_mir_build/src/thir/pattern/check_match.rs @@ -603,6 +603,7 @@ fn non_exhaustive_match<'p, 'tcx>( expr_span, span, scrut_ty, + type_note: errors::TypeNote::new(scrut_ty), }); return; } @@ -622,17 +623,9 @@ fn non_exhaustive_match<'p, 'tcx>( span, uncovered: errors::Uncovered::new(span, &cx, &witnesses), adt_defined_here: errors::AdtDefinedHere::new(&cx, scrut_ty, &witnesses), + type_note: errors::TypeNote::new(scrut_ty), }); - let is_variant_list_non_exhaustive = match scrut_ty.kind() { - ty::Adt(def, _) if def.is_variant_list_non_exhaustive() && !def.did().is_local() => true, - _ => false, - }; - err.note(&format!( - "the matched value is of type `{}`{}", - scrut_ty, - if is_variant_list_non_exhaustive { ", which is marked as non-exhaustive" } else { "" } - )); if (scrut_ty == cx.tcx.types.usize || scrut_ty == cx.tcx.types.isize) && !is_empty_match && witnesses.len() == 1 From 35fa0e9fe227ae2d6249a2609b6038f9a8e484dd Mon Sep 17 00:00:00 2001 From: mejrs <59372212+mejrs@users.noreply.github.com> Date: Sun, 19 Feb 2023 15:41:39 +0100 Subject: [PATCH 05/11] migrate ptrsized notes --- compiler/rustc_mir_build/messages.ftl | 6 +++-- compiler/rustc_mir_build/src/errors.rs | 20 ++++++++++++++-- .../src/thir/pattern/check_match.rs | 24 +++++++++---------- 3 files changed, 33 insertions(+), 17 deletions(-) diff --git a/compiler/rustc_mir_build/messages.ftl b/compiler/rustc_mir_build/messages.ftl index 8649521ea3abd..e6ea448d6a2f9 100644 --- a/compiler/rustc_mir_build/messages.ftl +++ b/compiler/rustc_mir_build/messages.ftl @@ -178,8 +178,6 @@ mir_build_unused_unsafe_enclosing_fn_label = because it's nested under this `uns mir_build_non_exhaustive_patterns_type_not_empty = non-exhaustive patterns: type `{$scrut_ty}` is non-empty .def_note = `{$peeled_ty}` defined here - .type_note = the matched value is of type `{$scrut_ty}` - .non_exhaustive_type_note = the matched value is of type `{$scrut_ty}`, which is marked as non-exhaustive .reference_note = references are always considered inhabited .suggestion = ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown .help = ensure that all possible cases are being handled by adding a match arm with a wildcard pattern @@ -385,3 +383,7 @@ mir_build_non_exhaustive_pattern = match is non-exhaustive mir_build_type_note = the matched value is of type `{$scrut_ty}` mir_build_type_note_non_exhaustive = the matched value is of type `{$scrut_ty}`, which is marked as non-exhaustive + +mir_build_no_fixed_maximum_value = `{$scrut_ty}` does not have a fixed maximum value, so a wildcard `_` is necessary to match exhaustively + +mir_build_suggest_precise_pointer_size_matching = add `#![feature(precise_pointer_size_matching)]` to the crate attributes to enable precise `{$scrut_ty}` matching diff --git a/compiler/rustc_mir_build/src/errors.rs b/compiler/rustc_mir_build/src/errors.rs index cb0a181dbd923..f90a36ab9251e 100644 --- a/compiler/rustc_mir_build/src/errors.rs +++ b/compiler/rustc_mir_build/src/errors.rs @@ -388,9 +388,9 @@ impl<'a> IntoDiagnostic<'a> for NonExhaustivePatternsTypeNotEmpty<'_, '_, '_> { match self.type_note { TypeNote::MarkedExhaustive { .. } => { - diag.note(fluent::non_exhaustive_type_note) + diag.note(fluent::mir_build_type_note_non_exhaustive) } - TypeNote::NotMarkedExhaustive { .. } => diag.note(fluent::type_note), + TypeNote::NotMarkedExhaustive { .. } => diag.note(fluent::mir_build_type_note), }; if let ty::Ref(_, sub_ty, _) = self.scrut_ty.kind() { @@ -950,6 +950,10 @@ pub(crate) struct NonExhaustivePatterns<'tcx> { pub adt_defined_here: Option>, #[subdiagnostic] pub type_note: TypeNote<'tcx>, + #[subdiagnostic] + pub no_fixed_max_value: Option>, + #[subdiagnostic] + pub ppsm: Option>, } #[derive(Subdiagnostic)] @@ -970,3 +974,15 @@ impl<'tcx> TypeNote<'tcx> { } } } + +#[derive(Subdiagnostic)] +#[note(mir_build_no_fixed_maximum_value)] +pub struct NoFixedMaxValue<'tcx> { + pub scrut_ty: Ty<'tcx>, +} + +#[derive(Subdiagnostic)] +#[help(mir_build_suggest_precise_pointer_size_matching)] +pub struct SuggestPrecisePointerSizeMatching<'tcx> { + pub scrut_ty: Ty<'tcx>, +} 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 ab134040c1dda..de0b31def6e30 100644 --- a/compiler/rustc_mir_build/src/thir/pattern/check_match.rs +++ b/compiler/rustc_mir_build/src/thir/pattern/check_match.rs @@ -604,6 +604,7 @@ fn non_exhaustive_match<'p, 'tcx>( span, scrut_ty, type_note: errors::TypeNote::new(scrut_ty), + ref_note, }); return; } @@ -618,32 +619,29 @@ fn non_exhaustive_match<'p, 'tcx>( } else { "_".to_string() }; - - let mut err = cx.tcx.sess.create_err(errors::NonExhaustivePatterns { + let mut err = errors::NonExhaustivePatterns { span, uncovered: errors::Uncovered::new(span, &cx, &witnesses), adt_defined_here: errors::AdtDefinedHere::new(&cx, scrut_ty, &witnesses), type_note: errors::TypeNote::new(scrut_ty), - }); + no_fixed_max_value: None, + ppsm: None, + }; if (scrut_ty == cx.tcx.types.usize || scrut_ty == cx.tcx.types.isize) && !is_empty_match && witnesses.len() == 1 && matches!(witnesses[0].ctor(), Constructor::NonExhaustive) { - err.note(&format!( - "`{}` does not have a fixed maximum value, so a wildcard `_` is necessary to match \ - exhaustively", - scrut_ty, - )); + err.no_fixed_max_value = Some(errors::NoFixedMaxValue { scrut_ty }); + if cx.tcx.sess.is_nightly_build() { - err.help(&format!( - "add `#![feature(precise_pointer_size_matching)]` to the crate attributes to \ - enable precise `{}` matching", - scrut_ty, - )); + err.ppsm = Some(errors::SuggestPrecisePointerSizeMatching { scrut_ty }); } } + + let mut err = cx.tcx.sess.create_err(err); + if let ty::Ref(_, sub_ty, _) = scrut_ty.kind() { if !sub_ty.is_inhabited_from(cx.tcx, cx.module, cx.param_env) { err.note("references are always considered inhabited"); From 6f013669b05bf2bac210311b3a49d8c9beb3d0b6 Mon Sep 17 00:00:00 2001 From: mejrs <59372212+mejrs@users.noreply.github.com> Date: Sun, 19 Feb 2023 16:01:23 +0100 Subject: [PATCH 06/11] migrate refnote --- compiler/rustc_mir_build/messages.ftl | 3 ++- compiler/rustc_mir_build/src/errors.rs | 17 ++++++++++++----- .../src/thir/pattern/check_match.rs | 13 +++++++------ 3 files changed, 21 insertions(+), 12 deletions(-) diff --git a/compiler/rustc_mir_build/messages.ftl b/compiler/rustc_mir_build/messages.ftl index e6ea448d6a2f9..0a80f5cb8245b 100644 --- a/compiler/rustc_mir_build/messages.ftl +++ b/compiler/rustc_mir_build/messages.ftl @@ -178,7 +178,6 @@ mir_build_unused_unsafe_enclosing_fn_label = because it's nested under this `uns mir_build_non_exhaustive_patterns_type_not_empty = non-exhaustive patterns: type `{$scrut_ty}` is non-empty .def_note = `{$peeled_ty}` defined here - .reference_note = references are always considered inhabited .suggestion = ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown .help = ensure that all possible cases are being handled by adding a match arm with a wildcard pattern @@ -387,3 +386,5 @@ mir_build_type_note_non_exhaustive = the matched value is of type `{$scrut_ty}`, mir_build_no_fixed_maximum_value = `{$scrut_ty}` does not have a fixed maximum value, so a wildcard `_` is necessary to match exhaustively mir_build_suggest_precise_pointer_size_matching = add `#![feature(precise_pointer_size_matching)]` to the crate attributes to enable precise `{$scrut_ty}` matching + +mir_build_ref_note = references are always considered inhabited diff --git a/compiler/rustc_mir_build/src/errors.rs b/compiler/rustc_mir_build/src/errors.rs index f90a36ab9251e..1f81784e07f82 100644 --- a/compiler/rustc_mir_build/src/errors.rs +++ b/compiler/rustc_mir_build/src/errors.rs @@ -355,6 +355,7 @@ pub(crate) struct NonExhaustivePatternsTypeNotEmpty<'p, 'tcx, 'm> { pub span: Span, pub scrut_ty: Ty<'tcx>, pub type_note: TypeNote<'tcx>, + pub ref_note: Option, } impl<'a> IntoDiagnostic<'a> for NonExhaustivePatternsTypeNotEmpty<'_, '_, '_> { @@ -390,13 +391,13 @@ impl<'a> IntoDiagnostic<'a> for NonExhaustivePatternsTypeNotEmpty<'_, '_, '_> { TypeNote::MarkedExhaustive { .. } => { diag.note(fluent::mir_build_type_note_non_exhaustive) } - TypeNote::NotMarkedExhaustive { .. } => diag.note(fluent::mir_build_type_note), + TypeNote::NotMarkedExhaustive { .. } => { + diag.note(fluent::mir_build_type_note) + } }; - if let ty::Ref(_, sub_ty, _) = self.scrut_ty.kind() { - if !sub_ty.is_inhabited_from(self.cx.tcx, self.cx.module, self.cx.param_env) { - diag.note(fluent::mir_build_reference_note); - } + if self.ref_note.is_some() { + diag.note(fluent::mir_build_ref_note); } let mut suggestion = None; @@ -954,6 +955,8 @@ pub(crate) struct NonExhaustivePatterns<'tcx> { pub no_fixed_max_value: Option>, #[subdiagnostic] pub ppsm: Option>, + #[subdiagnostic] + pub ref_note: Option, } #[derive(Subdiagnostic)] @@ -986,3 +989,7 @@ pub struct NoFixedMaxValue<'tcx> { pub struct SuggestPrecisePointerSizeMatching<'tcx> { pub scrut_ty: Ty<'tcx>, } + +#[derive(Subdiagnostic)] +#[note(mir_build_ref_note)] +pub struct RefNote; 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 de0b31def6e30..bf82c03347841 100644 --- a/compiler/rustc_mir_build/src/thir/pattern/check_match.rs +++ b/compiler/rustc_mir_build/src/thir/pattern/check_match.rs @@ -595,6 +595,12 @@ fn non_exhaustive_match<'p, 'tcx>( ty::Adt(def, _) => def.is_enum() && !def.variants().is_empty(), _ => false, }; + let ref_note = if let ty::Ref(_, sub_ty, _) = scrut_ty.kind() && !sub_ty.is_inhabited_from(cx.tcx, cx.module, cx.param_env) { + Some(errors::RefNote) + } else { + None + }; + // In the case of an empty match, replace the '`_` not covered' diagnostic with something more // informative. if is_empty_match && !non_empty_enum { @@ -626,6 +632,7 @@ fn non_exhaustive_match<'p, 'tcx>( type_note: errors::TypeNote::new(scrut_ty), no_fixed_max_value: None, ppsm: None, + ref_note, }; if (scrut_ty == cx.tcx.types.usize || scrut_ty == cx.tcx.types.isize) @@ -642,12 +649,6 @@ fn non_exhaustive_match<'p, 'tcx>( let mut err = cx.tcx.sess.create_err(err); - if let ty::Ref(_, sub_ty, _) = scrut_ty.kind() { - if !sub_ty.is_inhabited_from(cx.tcx, cx.module, cx.param_env) { - err.note("references are always considered inhabited"); - } - } - let mut suggestion = None; let sm = cx.tcx.sess.source_map(); match arms { From 0494112a516aa15209885dcc526499b84bdf0526 Mon Sep 17 00:00:00 2001 From: mejrs <59372212+mejrs@users.noreply.github.com> Date: Mon, 20 Feb 2023 19:18:28 +0100 Subject: [PATCH 07/11] Migrate arm suggestions --- compiler/rustc_mir_build/messages.ftl | 6 + compiler/rustc_mir_build/src/errors.rs | 106 +++++ .../src/thir/pattern/check_match.rs | 183 ++++---- .../match/issue-88331.stderr | 10 +- .../match/non-exhaustive-match.stderr | 12 +- .../const_in_pattern/incomplete-slice.stderr | 6 +- tests/ui/error-codes/E0004-2.stderr | 5 +- tests/ui/error-codes/E0004.stderr | 6 +- ...on_exhaustive_omitted_patterns_lint.stderr | 4 +- ...-gate-precise_pointer_size_matching.stderr | 12 +- ...alf-open-range-pats-exhaustive-fail.stderr | 408 +++++++++--------- tests/ui/issue-94866.stderr | 4 +- tests/ui/match/match_non_exhaustive.stderr | 12 +- .../exhaustiveness-non-exhaustive.stderr | 18 +- ...een-expanded-earlier-non-exhaustive.stderr | 7 +- ...e-missing-pattern-excluding-comments.fixed | 3 +- ...-missing-pattern-excluding-comments.stderr | 4 +- .../doc-hidden-non-exhaustive.stderr | 24 +- .../empty-match.exhaustive_patterns.stderr | 58 +-- .../usefulness/empty-match.normal.stderr | 58 +-- tests/ui/pattern/usefulness/floats.stderr | 6 +- tests/ui/pattern/usefulness/guards.stderr | 4 +- .../integer-ranges/exhaustiveness.stderr | 68 +-- .../pointer-sized-int.deny.stderr | 64 +-- .../precise_pointer_matching-message.stderr | 12 +- .../ui/pattern/usefulness/issue-15129.stderr | 5 +- tests/ui/pattern/usefulness/issue-2111.stderr | 5 +- .../ui/pattern/usefulness/issue-30240.stderr | 10 +- .../ui/pattern/usefulness/issue-35609.stderr | 70 ++- tests/ui/pattern/usefulness/issue-3601.stderr | 6 +- .../ui/pattern/usefulness/issue-39362.stderr | 7 +- .../ui/pattern/usefulness/issue-40221.stderr | 4 +- tests/ui/pattern/usefulness/issue-4321.stderr | 4 +- .../ui/pattern/usefulness/issue-50900.stderr | 6 +- .../ui/pattern/usefulness/issue-56379.stderr | 6 +- .../ui/pattern/usefulness/issue-72377.stderr | 7 +- .../usefulness/match-arm-statics-2.stderr | 12 +- .../match-byte-array-patterns-2.stderr | 16 +- .../usefulness/match-non-exhaustive.stderr | 12 +- .../usefulness/match-privately-empty.stderr | 4 +- .../usefulness/match-slice-patterns.stderr | 4 +- .../non-exhaustive-defined-here.stderr | 27 +- .../non-exhaustive-match-nested.stderr | 8 +- .../usefulness/non-exhaustive-match.stderr | 44 +- .../non-exhaustive-pattern-witness.stderr | 33 +- .../slice-patterns-exhaustiveness.stderr | 98 +++-- .../usefulness/stable-gated-patterns.stderr | 11 +- .../struct-like-enum-nonexhaustive.stderr | 4 +- .../tuple-struct-nonexhaustive.stderr | 4 +- .../type_polymorphic_byte_str_literals.stderr | 11 +- .../usefulness/unstable-gated-patterns.stderr | 4 +- .../slice.stderr | 6 +- tests/ui/rfc-2008-non-exhaustive/enum.stderr | 8 +- .../enum_same_crate_empty_match.stderr | 12 +- .../uninhabited/match.stderr | 5 +- .../uninhabited/match_same_crate.stderr | 5 +- .../match_with_exhaustive_patterns.stderr | 5 +- .../uninhabited-matches-feature-gated.stderr | 12 +- 58 files changed, 872 insertions(+), 703 deletions(-) diff --git a/compiler/rustc_mir_build/messages.ftl b/compiler/rustc_mir_build/messages.ftl index 0a80f5cb8245b..c55ac6c54af52 100644 --- a/compiler/rustc_mir_build/messages.ftl +++ b/compiler/rustc_mir_build/messages.ftl @@ -388,3 +388,9 @@ mir_build_no_fixed_maximum_value = `{$scrut_ty}` does not have a fixed maximum v mir_build_suggest_precise_pointer_size_matching = add `#![feature(precise_pointer_size_matching)]` to the crate attributes to enable precise `{$scrut_ty}` matching mir_build_ref_note = references are always considered inhabited + +mir_build_suggest_wildcard_arm = ensure that all possible cases are being handled by adding a wildcard arm + +mir_build_suggest_single_arm = ensure that all possible cases are being handled by adding an arm to handle the `{$pat}` case + +mir_build_suggest_multiple_arms = ensure that all possible cases are being handled by adding more match arms diff --git a/compiler/rustc_mir_build/src/errors.rs b/compiler/rustc_mir_build/src/errors.rs index 1f81784e07f82..d2254b25aaad4 100644 --- a/compiler/rustc_mir_build/src/errors.rs +++ b/compiler/rustc_mir_build/src/errors.rs @@ -957,6 +957,8 @@ pub(crate) struct NonExhaustivePatterns<'tcx> { pub ppsm: Option>, #[subdiagnostic] pub ref_note: Option, + #[subdiagnostic] + pub suggest_arms: ArmSuggestions<'tcx>, } #[derive(Subdiagnostic)] @@ -978,6 +980,16 @@ impl<'tcx> TypeNote<'tcx> { } } +#[derive(Subdiagnostic)] +pub enum AddArmKind<'tcx> { + #[help(mir_build_suggest_wildcard_arm)] + Wildcard, + #[help(mir_build_suggest_single_arm)] + Single { pat: Pat<'tcx> }, + #[help(mir_build_suggest_multiple_arms)] + Multiple, +} + #[derive(Subdiagnostic)] #[note(mir_build_no_fixed_maximum_value)] pub struct NoFixedMaxValue<'tcx> { @@ -993,3 +1005,97 @@ pub struct SuggestPrecisePointerSizeMatching<'tcx> { #[derive(Subdiagnostic)] #[note(mir_build_ref_note)] pub struct RefNote; + +pub enum ArmSuggestions<'tcx> { + OneLiner { + suggest_msg: AddArmKind<'tcx>, + pattern: Pat<'tcx>, + span: Span, + }, + MultipleLines { + span: Span, + prefix: String, + indentation: String, + postfix: String, + arm_suggestions: Vec>, + suggest_msg: AddArmKind<'tcx>, + }, + Help { + suggest_msg: AddArmKind<'tcx>, + }, +} + +impl<'tcx> AddToDiagnostic for ArmSuggestions<'tcx> { + fn add_to_diagnostic_with(self, diag: &mut Diagnostic, f: F) + where + F: Fn(&mut Diagnostic, SubdiagnosticMessage) -> SubdiagnosticMessage, + { + use std::fmt::Write; + + match self { + ArmSuggestions::OneLiner { suggest_msg, span, pattern } => { + let suggestion = format!(", {pattern} => {{ todo!() }}"); + let suggest_msg = match suggest_msg { + AddArmKind::Wildcard => rustc_errors::fluent::mir_build_suggest_wildcard_arm, + AddArmKind::Single { pat } => { + diag.set_arg("pat", pat); + rustc_errors::fluent::mir_build_suggest_single_arm + } + AddArmKind::Multiple => rustc_errors::fluent::mir_build_suggest_multiple_arms, + }; + diag.span_suggestion_verbose( + span, + suggest_msg, + suggestion, + Applicability::HasPlaceholders, + ); + } + ArmSuggestions::MultipleLines { + suggest_msg, + span, + prefix, + indentation, + postfix, + arm_suggestions, + } => { + let suggest_msg = match suggest_msg { + AddArmKind::Wildcard => rustc_errors::fluent::mir_build_suggest_wildcard_arm, + AddArmKind::Single { pat } => { + diag.set_arg("pat", pat); + rustc_errors::fluent::mir_build_suggest_single_arm + } + AddArmKind::Multiple => rustc_errors::fluent::mir_build_suggest_multiple_arms, + }; + + let mut suggestion = String::new(); + + // Set the correct position to start writing arms + suggestion.push_str(&prefix); + + let (truncate_at, need_wildcard) = match arm_suggestions.len() { + // Avoid writing a wildcard for one remaining arm + 4 => (4, false), + // Otherwise, limit it at 3 arms + wildcard + n @ 0..=3 => (n, false), + _ => (3, true), + }; + + for pattern in arm_suggestions.iter().take(truncate_at) { + writeln!(&mut suggestion, "{indentation}{pattern} => {{ todo!() }},").unwrap(); + } + if need_wildcard { + writeln!(&mut suggestion, "{indentation}_ => {{ todo!() }},").unwrap(); + } + suggestion.push_str(&postfix); + + diag.span_suggestion_verbose( + span, + suggest_msg, + suggestion, + Applicability::HasPlaceholders, + ); + } + ArmSuggestions::Help { suggest_msg } => suggest_msg.add_to_diagnostic_with(diag, f), + } + } +} 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 bf82c03347841..250105267583e 100644 --- a/compiler/rustc_mir_build/src/thir/pattern/check_match.rs +++ b/compiler/rustc_mir_build/src/thir/pattern/check_match.rs @@ -9,15 +9,14 @@ use crate::errors; use hir::{ExprKind, PatKind}; use rustc_arena::TypedArena; use rustc_ast::{LitKind, Mutability}; -use rustc_errors::Applicability; use rustc_hir as hir; use rustc_hir::def::*; use rustc_hir::def_id::DefId; use rustc_hir::intravisit::{self, Visitor}; use rustc_hir::{HirId, Pat}; +use rustc_middle::thir; use rustc_middle::ty::print::with_no_trimmed_paths; use rustc_middle::ty::{self, Ty, TyCtxt}; - use rustc_session::lint::builtin::{ BINDINGS_WITH_VARIANT_NAME, IRREFUTABLE_LET_PATTERNS, UNREACHABLE_PATTERNS, }; @@ -615,16 +614,86 @@ fn non_exhaustive_match<'p, 'tcx>( return; } - let patterns_len = witnesses.len(); - let pattern = if witnesses.len() < 4 { - witnesses - .iter() - .map(|witness| witness.to_pat(cx).to_string()) - .collect::>() - .join(" | ") + let arm_suggestions: Vec<_> = witnesses.iter().map(|witness| witness.to_pat(cx)).collect(); + + let suggest_msg = match &*arm_suggestions { + [thir::Pat { kind: thir::PatKind::Wild, .. }] => errors::AddArmKind::Wildcard, + [pat] => errors::AddArmKind::Single { pat: pat.clone() }, + _ => errors::AddArmKind::Multiple, + }; + + let mut prefix = String::new(); + let mut postfix = String::new(); + let mut indentation = String::new(); + let mut suggestion_span = None; + + // If the user wrote something like `match x { 1 => 2 }`, we suggest something that stays a one-liner + let mut do_oneliner = false; + + let sm = cx.tcx.sess.source_map(); + match arms { + // The user wrote `<-- indentation -->match {}` + [] if span.eq_ctxt(expr_span) && let Some(indent) = sm.indentation_before(span) => { + prefix.push_str(" {\n"); + + indentation.push_str(&indent); + indentation.push_str(" "); + + postfix.push_str(&indent); + postfix.push_str("}"); + suggestion_span = Some(span.shrink_to_hi().with_hi(expr_span.hi())); + } + [hir::Arm {span, ..}] => { + if let Some(indent) = sm.indentation_before(*span) + && let Ok(with_trailing) = sm.span_extend_while(*span, |c| c.is_whitespace() || c == ',') + && sm.is_multiline(with_trailing) { + prefix.push_str(",\n"); + indentation.push_str(&indent); + } else { + do_oneliner = true; + }; + suggestion_span = Some(span.shrink_to_hi()); + } + [.., prev, last] if prev.span.eq_ctxt(last.span) => { + if !(matches!(last.body.kind, hir::ExprKind::Block(..)) && last.span.eq_ctxt(last.body.span)){ + prefix.push_str(","); + } + if sm.is_multiline(prev.span.between(last.span)) && let Some(indent) = sm.indentation_before(last.span) { + prefix.push_str("\n"); + indentation.push_str(&indent); + } else { + do_oneliner = true; + }; + suggestion_span = Some(last.span.shrink_to_hi()); + } + _ => {} + } + + let suggest_arms = if let Some(span) = suggestion_span { + if do_oneliner { + errors::ArmSuggestions::OneLiner { + span, + pattern: if let [pat] = &*arm_suggestions { + pat.clone() + } else { + thir::Pat::wildcard_from_ty(scrut_ty) + }, + suggest_msg, + } + } else { + errors::ArmSuggestions::MultipleLines { + span, + prefix, + indentation, + postfix, + arm_suggestions, + suggest_msg, + } + } } else { - "_".to_string() + errors::ArmSuggestions::Help { suggest_msg } }; + let mut err = errors::NonExhaustivePatterns { span, uncovered: errors::Uncovered::new(span, &cx, &witnesses), @@ -633,6 +702,7 @@ fn non_exhaustive_match<'p, 'tcx>( no_fixed_max_value: None, ppsm: None, ref_note, + suggest_arms, }; if (scrut_ty == cx.tcx.types.usize || scrut_ty == cx.tcx.types.isize) @@ -647,98 +717,7 @@ fn non_exhaustive_match<'p, 'tcx>( } } - let mut err = cx.tcx.sess.create_err(err); - - let mut suggestion = None; - let sm = cx.tcx.sess.source_map(); - match arms { - [] if span.eq_ctxt(expr_span) => { - // Get the span for the empty match body `{}`. - let (indentation, more) = if let Some(snippet) = sm.indentation_before(span) { - (format!("\n{}", snippet), " ") - } else { - (" ".to_string(), "") - }; - suggestion = Some(( - span.shrink_to_hi().with_hi(expr_span.hi()), - format!( - " {{{indentation}{more}{pattern} => todo!(),{indentation}}}", - indentation = indentation, - more = more, - pattern = pattern, - ), - )); - } - [only] => { - let (pre_indentation, is_multiline) = if let Some(snippet) = sm.indentation_before(only.span) - && let Ok(with_trailing) = sm.span_extend_while(only.span, |c| c.is_whitespace() || c == ',') - && sm.is_multiline(with_trailing) - { - (format!("\n{}", snippet), true) - } else { - (" ".to_string(), false) - }; - let comma = if matches!(only.body.kind, hir::ExprKind::Block(..)) - && only.span.eq_ctxt(only.body.span) - && is_multiline - { - "" - } else { - "," - }; - suggestion = Some(( - only.span.shrink_to_hi(), - format!("{}{}{} => todo!()", comma, pre_indentation, pattern), - )); - } - [.., prev, last] if prev.span.eq_ctxt(last.span) => { - let comma = if matches!(last.body.kind, hir::ExprKind::Block(..)) - && last.span.eq_ctxt(last.body.span) - { - "" - } else { - "," - }; - let spacing = if sm.is_multiline(prev.span.between(last.span)) { - sm.indentation_before(last.span).map(|indent| format!("\n{indent}")) - } else { - Some(" ".to_string()) - }; - if let Some(spacing) = spacing { - suggestion = Some(( - last.span.shrink_to_hi(), - format!("{}{}{} => todo!()", comma, spacing, pattern), - )); - } - } - _ => {} - } - - let msg = format!( - "ensure that all possible cases are being handled by adding a match arm with a wildcard \ - pattern{}{}", - if patterns_len > 1 && patterns_len < 4 && suggestion.is_some() { - ", a match arm with multiple or-patterns" - } else { - // we are either not suggesting anything, or suggesting `_` - "" - }, - match patterns_len { - // non-exhaustive enum case - 0 if suggestion.is_some() => " as shown", - 0 => "", - 1 if suggestion.is_some() => " or an explicit pattern as shown", - 1 => " or an explicit pattern", - _ if suggestion.is_some() => " as shown, or multiple match arms", - _ => " or multiple match arms", - }, - ); - if let Some((span, sugg)) = suggestion { - err.span_suggestion_verbose(span, &msg, sugg, Applicability::HasPlaceholders); - } else { - err.help(&msg); - } - err.emit(); + cx.tcx.sess.emit_err(err); } /// Check if a by-value binding is by-value. That is, check if the binding's type is not `Copy`. diff --git a/tests/ui/closures/2229_closure_analysis/match/issue-88331.stderr b/tests/ui/closures/2229_closure_analysis/match/issue-88331.stderr index 475045f8621b2..118b8fa4d3d63 100644 --- a/tests/ui/closures/2229_closure_analysis/match/issue-88331.stderr +++ b/tests/ui/closures/2229_closure_analysis/match/issue-88331.stderr @@ -10,10 +10,11 @@ note: `Opcode` defined here LL | pub struct Opcode(pub u8); | ^^^^^^ = note: the matched value is of type `Opcode` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms +help: ensure that all possible cases are being handled by adding more match arms | LL ~ Opcode::OP1 => unimplemented!(), -LL ~ Opcode(0_u8) | Opcode(2_u8..=u8::MAX) => todo!(), +LL + Opcode(0_u8) => { todo!() }, +LL + Opcode(2_u8..=u8::MAX) => { todo!() }, | error[E0004]: match is non-exhaustive @@ -28,10 +29,11 @@ note: `Opcode2` defined here LL | pub struct Opcode2(Opcode); | ^^^^^^^ = note: the matched value is of type `Opcode2` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms +help: ensure that all possible cases are being handled by adding more match arms | LL ~ Opcode2::OP2=> unimplemented!(), -LL ~ Opcode2(Opcode(0_u8)) | Opcode2(Opcode(2_u8..=u8::MAX)) => todo!(), +LL + Opcode2(Opcode(0_u8)) => { todo!() }, +LL + Opcode2(Opcode(2_u8..=u8::MAX)) => { todo!() }, | error: aborting due to 2 previous errors diff --git a/tests/ui/closures/2229_closure_analysis/match/non-exhaustive-match.stderr b/tests/ui/closures/2229_closure_analysis/match/non-exhaustive-match.stderr index ecee501e34c52..5e102862e8d3d 100644 --- a/tests/ui/closures/2229_closure_analysis/match/non-exhaustive-match.stderr +++ b/tests/ui/closures/2229_closure_analysis/match/non-exhaustive-match.stderr @@ -10,10 +10,10 @@ note: `L1` defined here LL | enum L1 { A, B } | ^^ - not covered = note: the matched value is of type `L1` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding an arm to handle the `L1::B` case | -LL | let _b = || { match l1 { L1::A => (), L1::B => todo!() } }; - | ++++++++++++++++++ +LL | let _b = || { match l1 { L1::A => (), L1::B => { todo!() } } }; + | ++++++++++++++++++++++ error[E0004]: non-exhaustive patterns: type `E1` is non-empty --> $DIR/non-exhaustive-match.rs:37:25 @@ -41,10 +41,10 @@ LL | let _e = || { match e2 { E2::A => (), E2::B => () } }; | ^^ pattern `_` not covered | = note: the matched value is of type `E2`, which is marked as non-exhaustive -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding a wildcard arm | -LL | let _e = || { match e2 { E2::A => (), E2::B => (), _ => todo!() } }; - | ++++++++++++++ +LL | let _e = || { match e2 { E2::A => (), E2::B => (), _ => { todo!() } } }; + | ++++++++++++++++++ error[E0505]: cannot move out of `e3` because it is borrowed --> $DIR/non-exhaustive-match.rs:46:22 diff --git a/tests/ui/consts/const_in_pattern/incomplete-slice.stderr b/tests/ui/consts/const_in_pattern/incomplete-slice.stderr index d8c3b95392a17..46b3cc8a5ca68 100644 --- a/tests/ui/consts/const_in_pattern/incomplete-slice.stderr +++ b/tests/ui/consts/const_in_pattern/incomplete-slice.stderr @@ -15,10 +15,10 @@ LL | match &[][..] { | ^^^^^^^ pattern `&_` not covered | = note: the matched value is of type `&[E]` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding an arm to handle the `&_` case | -LL ~ E_SL => {} -LL + &_ => todo!() +LL ~ E_SL => {}, +LL + &_ => { todo!() }, | error: aborting due to previous error; 1 warning emitted diff --git a/tests/ui/error-codes/E0004-2.stderr b/tests/ui/error-codes/E0004-2.stderr index 74dfd08c5d204..f91bef1f635e2 100644 --- a/tests/ui/error-codes/E0004-2.stderr +++ b/tests/ui/error-codes/E0004-2.stderr @@ -5,10 +5,11 @@ LL | match x { } | ^ patterns `None` and `Some(_)` not covered | = note: the matched value is of type `Option` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms +help: ensure that all possible cases are being handled by adding more match arms | LL ~ match x { -LL + None | Some(_) => todo!(), +LL + None => { todo!() }, +LL + Some(_) => { todo!() }, LL ~ } | diff --git a/tests/ui/error-codes/E0004.stderr b/tests/ui/error-codes/E0004.stderr index fd45ce0f7d08d..85e9a61050235 100644 --- a/tests/ui/error-codes/E0004.stderr +++ b/tests/ui/error-codes/E0004.stderr @@ -12,10 +12,10 @@ LL | enum Terminator { LL | HastaLaVistaBaby, | ---------------- not covered = note: the matched value is of type `Terminator` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding an arm to handle the `Terminator::HastaLaVistaBaby` case | -LL ~ Terminator::TalkToMyHand => {} -LL + Terminator::HastaLaVistaBaby => todo!() +LL ~ Terminator::TalkToMyHand => {}, +LL + Terminator::HastaLaVistaBaby => { todo!() }, | error: aborting due to previous error diff --git a/tests/ui/feature-gates/feature-gate-non_exhaustive_omitted_patterns_lint.stderr b/tests/ui/feature-gates/feature-gate-non_exhaustive_omitted_patterns_lint.stderr index 961d2deae79a7..2dfe2ad7f1f6c 100644 --- a/tests/ui/feature-gates/feature-gate-non_exhaustive_omitted_patterns_lint.stderr +++ b/tests/ui/feature-gates/feature-gate-non_exhaustive_omitted_patterns_lint.stderr @@ -113,10 +113,10 @@ LL | enum Foo { LL | A, B, C, | - not covered = note: the matched value is of type `Foo` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding an arm to handle the `Foo::C` case | LL ~ Foo::B => {} -LL + Foo::C => todo!() +LL + Foo::C => { todo!() }, | error: aborting due to previous error; 10 warnings emitted diff --git a/tests/ui/feature-gates/feature-gate-precise_pointer_size_matching.stderr b/tests/ui/feature-gates/feature-gate-precise_pointer_size_matching.stderr index 6ac51cb4f2af7..aeec10ec53263 100644 --- a/tests/ui/feature-gates/feature-gate-precise_pointer_size_matching.stderr +++ b/tests/ui/feature-gates/feature-gate-precise_pointer_size_matching.stderr @@ -7,10 +7,10 @@ LL | match 0usize { = note: the matched value is of type `usize` = note: `usize` does not have a fixed maximum value, so a wildcard `_` is necessary to match exhaustively = help: add `#![feature(precise_pointer_size_matching)]` to the crate attributes to enable precise `usize` matching -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding a wildcard arm | -LL ~ 0..=usize::MAX => {} -LL + _ => todo!() +LL ~ 0..=usize::MAX => {}, +LL + _ => { todo!() }, | error[E0004]: match is non-exhaustive @@ -22,10 +22,10 @@ LL | match 0isize { = note: the matched value is of type `isize` = note: `isize` does not have a fixed maximum value, so a wildcard `_` is necessary to match exhaustively = help: add `#![feature(precise_pointer_size_matching)]` to the crate attributes to enable precise `isize` matching -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding a wildcard arm | -LL ~ isize::MIN..=isize::MAX => {} -LL + _ => todo!() +LL ~ isize::MIN..=isize::MAX => {}, +LL + _ => { todo!() }, | error: aborting due to 2 previous errors diff --git a/tests/ui/half-open-range-patterns/half-open-range-pats-exhaustive-fail.stderr b/tests/ui/half-open-range-patterns/half-open-range-pats-exhaustive-fail.stderr index 09c61bd416a68..993e27c3489e1 100644 --- a/tests/ui/half-open-range-patterns/half-open-range-pats-exhaustive-fail.stderr +++ b/tests/ui/half-open-range-patterns/half-open-range-pats-exhaustive-fail.stderr @@ -5,10 +5,10 @@ LL | m!(0f32, f32::NEG_INFINITY..); | ^^^^ pattern `_` not covered | = note: the matched value is of type `f32` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding a wildcard arm | -LL | match $s { $($t)+ => {}, _ => todo!() } - | ++++++++++++++ +LL | match $s { $($t)+ => {}, _ => { todo!() } } + | ++++++++++++++++++ error[E0004]: match is non-exhaustive --> $DIR/half-open-range-pats-exhaustive-fail.rs:16:8 @@ -17,10 +17,10 @@ LL | m!(0f32, ..f32::INFINITY); | ^^^^ pattern `_` not covered | = note: the matched value is of type `f32` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding a wildcard arm | -LL | match $s { $($t)+ => {}, _ => todo!() } - | ++++++++++++++ +LL | match $s { $($t)+ => {}, _ => { todo!() } } + | ++++++++++++++++++ error[E0004]: match is non-exhaustive --> $DIR/half-open-range-pats-exhaustive-fail.rs:25:8 @@ -29,10 +29,10 @@ LL | m!('a', ..core::char::MAX); | ^^^ pattern `'\u{10ffff}'` not covered | = note: the matched value is of type `char` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding an arm to handle the `'\u{10ffff}'` case | -LL | match $s { $($t)+ => {}, '\u{10ffff}' => todo!() } - | +++++++++++++++++++++++++ +LL | match $s { $($t)+ => {}, '\u{10ffff}' => { todo!() } } + | +++++++++++++++++++++++++++++ error[E0004]: match is non-exhaustive --> $DIR/half-open-range-pats-exhaustive-fail.rs:26:8 @@ -41,10 +41,10 @@ LL | m!('a', ..ALMOST_MAX); | ^^^ pattern `'\u{10fffe}'..='\u{10ffff}'` not covered | = note: the matched value is of type `char` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding an arm to handle the `'\u{10fffe}'..='\u{10ffff}'` case | -LL | match $s { $($t)+ => {}, '\u{10fffe}'..='\u{10ffff}' => todo!() } - | ++++++++++++++++++++++++++++++++++++++++ +LL | match $s { $($t)+ => {}, '\u{10fffe}'..='\u{10ffff}' => { todo!() } } + | ++++++++++++++++++++++++++++++++++++++++++++ error[E0004]: match is non-exhaustive --> $DIR/half-open-range-pats-exhaustive-fail.rs:27:8 @@ -53,10 +53,10 @@ LL | m!('a', ALMOST_MIN..); | ^^^ pattern `'\0'` not covered | = note: the matched value is of type `char` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding an arm to handle the `'\0'` case | -LL | match $s { $($t)+ => {}, '\0' => todo!() } - | +++++++++++++++++ +LL | match $s { $($t)+ => {}, '\0' => { todo!() } } + | +++++++++++++++++++++ error[E0004]: match is non-exhaustive --> $DIR/half-open-range-pats-exhaustive-fail.rs:28:8 @@ -65,10 +65,10 @@ LL | m!('a', ..=ALMOST_MAX); | ^^^ pattern `'\u{10ffff}'` not covered | = note: the matched value is of type `char` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding an arm to handle the `'\u{10ffff}'` case | -LL | match $s { $($t)+ => {}, '\u{10ffff}' => todo!() } - | +++++++++++++++++++++++++ +LL | match $s { $($t)+ => {}, '\u{10ffff}' => { todo!() } } + | +++++++++++++++++++++++++++++ error[E0004]: match is non-exhaustive --> $DIR/half-open-range-pats-exhaustive-fail.rs:29:8 @@ -77,10 +77,10 @@ LL | m!('a', ..=VAL | VAL_2..); | ^^^ pattern `'b'` not covered | = note: the matched value is of type `char` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding an arm to handle the `'b'` case | -LL | match $s { $($t)+ => {}, 'b' => todo!() } - | ++++++++++++++++ +LL | match $s { $($t)+ => {}, 'b' => { todo!() } } + | ++++++++++++++++++++ error[E0004]: match is non-exhaustive --> $DIR/half-open-range-pats-exhaustive-fail.rs:30:8 @@ -89,10 +89,10 @@ LL | m!('a', ..VAL_1 | VAL_2..); | ^^^ pattern `'b'` not covered | = note: the matched value is of type `char` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding an arm to handle the `'b'` case | -LL | match $s { $($t)+ => {}, 'b' => todo!() } - | ++++++++++++++++ +LL | match $s { $($t)+ => {}, 'b' => { todo!() } } + | ++++++++++++++++++++ error[E0004]: match is non-exhaustive --> $DIR/half-open-range-pats-exhaustive-fail.rs:40:12 @@ -101,10 +101,10 @@ LL | m!(0, ..u8::MAX); | ^ pattern `u8::MAX` not covered | = note: the matched value is of type `u8` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding an arm to handle the `u8::MAX` case | -LL | match $s { $($t)+ => {}, u8::MAX => todo!() } - | ++++++++++++++++++++ +LL | match $s { $($t)+ => {}, u8::MAX => { todo!() } } + | ++++++++++++++++++++++++ error[E0004]: match is non-exhaustive --> $DIR/half-open-range-pats-exhaustive-fail.rs:41:12 @@ -113,10 +113,10 @@ LL | m!(0, ..ALMOST_MAX); | ^ pattern `254_u8..=u8::MAX` not covered | = note: the matched value is of type `u8` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding an arm to handle the `254_u8..=u8::MAX` case | -LL | match $s { $($t)+ => {}, 254_u8..=u8::MAX => todo!() } - | +++++++++++++++++++++++++++++ +LL | match $s { $($t)+ => {}, 254_u8..=u8::MAX => { todo!() } } + | +++++++++++++++++++++++++++++++++ error[E0004]: match is non-exhaustive --> $DIR/half-open-range-pats-exhaustive-fail.rs:42:12 @@ -125,10 +125,10 @@ LL | m!(0, ALMOST_MIN..); | ^ pattern `0_u8` not covered | = note: the matched value is of type `u8` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding an arm to handle the `0_u8` case | -LL | match $s { $($t)+ => {}, 0_u8 => todo!() } - | +++++++++++++++++ +LL | match $s { $($t)+ => {}, 0_u8 => { todo!() } } + | +++++++++++++++++++++ error[E0004]: match is non-exhaustive --> $DIR/half-open-range-pats-exhaustive-fail.rs:43:12 @@ -137,10 +137,10 @@ LL | m!(0, ..=ALMOST_MAX); | ^ pattern `u8::MAX` not covered | = note: the matched value is of type `u8` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding an arm to handle the `u8::MAX` case | -LL | match $s { $($t)+ => {}, u8::MAX => todo!() } - | ++++++++++++++++++++ +LL | match $s { $($t)+ => {}, u8::MAX => { todo!() } } + | ++++++++++++++++++++++++ error[E0004]: match is non-exhaustive --> $DIR/half-open-range-pats-exhaustive-fail.rs:44:12 @@ -149,10 +149,10 @@ LL | m!(0, ..=VAL | VAL_2..); | ^ pattern `43_u8` not covered | = note: the matched value is of type `u8` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding an arm to handle the `43_u8` case | -LL | match $s { $($t)+ => {}, 43_u8 => todo!() } - | ++++++++++++++++++ +LL | match $s { $($t)+ => {}, 43_u8 => { todo!() } } + | ++++++++++++++++++++++ error[E0004]: match is non-exhaustive --> $DIR/half-open-range-pats-exhaustive-fail.rs:45:12 @@ -161,10 +161,10 @@ LL | m!(0, ..VAL_1 | VAL_2..); | ^ pattern `43_u8` not covered | = note: the matched value is of type `u8` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding an arm to handle the `43_u8` case | -LL | match $s { $($t)+ => {}, 43_u8 => todo!() } - | ++++++++++++++++++ +LL | match $s { $($t)+ => {}, 43_u8 => { todo!() } } + | ++++++++++++++++++++++ error[E0004]: match is non-exhaustive --> $DIR/half-open-range-pats-exhaustive-fail.rs:53:12 @@ -173,10 +173,10 @@ LL | m!(0, ..u16::MAX); | ^ pattern `u16::MAX` not covered | = note: the matched value is of type `u16` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding an arm to handle the `u16::MAX` case | -LL | match $s { $($t)+ => {}, u16::MAX => todo!() } - | +++++++++++++++++++++ +LL | match $s { $($t)+ => {}, u16::MAX => { todo!() } } + | +++++++++++++++++++++++++ error[E0004]: match is non-exhaustive --> $DIR/half-open-range-pats-exhaustive-fail.rs:54:12 @@ -185,10 +185,10 @@ LL | m!(0, ..ALMOST_MAX); | ^ pattern `65534_u16..=u16::MAX` not covered | = note: the matched value is of type `u16` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding an arm to handle the `65534_u16..=u16::MAX` case | -LL | match $s { $($t)+ => {}, 65534_u16..=u16::MAX => todo!() } - | +++++++++++++++++++++++++++++++++ +LL | match $s { $($t)+ => {}, 65534_u16..=u16::MAX => { todo!() } } + | +++++++++++++++++++++++++++++++++++++ error[E0004]: match is non-exhaustive --> $DIR/half-open-range-pats-exhaustive-fail.rs:55:12 @@ -197,10 +197,10 @@ LL | m!(0, ALMOST_MIN..); | ^ pattern `0_u16` not covered | = note: the matched value is of type `u16` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding an arm to handle the `0_u16` case | -LL | match $s { $($t)+ => {}, 0_u16 => todo!() } - | ++++++++++++++++++ +LL | match $s { $($t)+ => {}, 0_u16 => { todo!() } } + | ++++++++++++++++++++++ error[E0004]: match is non-exhaustive --> $DIR/half-open-range-pats-exhaustive-fail.rs:56:12 @@ -209,10 +209,10 @@ LL | m!(0, ..=ALMOST_MAX); | ^ pattern `u16::MAX` not covered | = note: the matched value is of type `u16` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding an arm to handle the `u16::MAX` case | -LL | match $s { $($t)+ => {}, u16::MAX => todo!() } - | +++++++++++++++++++++ +LL | match $s { $($t)+ => {}, u16::MAX => { todo!() } } + | +++++++++++++++++++++++++ error[E0004]: match is non-exhaustive --> $DIR/half-open-range-pats-exhaustive-fail.rs:57:12 @@ -221,10 +221,10 @@ LL | m!(0, ..=VAL | VAL_2..); | ^ pattern `43_u16` not covered | = note: the matched value is of type `u16` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding an arm to handle the `43_u16` case | -LL | match $s { $($t)+ => {}, 43_u16 => todo!() } - | +++++++++++++++++++ +LL | match $s { $($t)+ => {}, 43_u16 => { todo!() } } + | +++++++++++++++++++++++ error[E0004]: match is non-exhaustive --> $DIR/half-open-range-pats-exhaustive-fail.rs:58:12 @@ -233,10 +233,10 @@ LL | m!(0, ..VAL_1 | VAL_2..); | ^ pattern `43_u16` not covered | = note: the matched value is of type `u16` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding an arm to handle the `43_u16` case | -LL | match $s { $($t)+ => {}, 43_u16 => todo!() } - | +++++++++++++++++++ +LL | match $s { $($t)+ => {}, 43_u16 => { todo!() } } + | +++++++++++++++++++++++ error[E0004]: match is non-exhaustive --> $DIR/half-open-range-pats-exhaustive-fail.rs:66:12 @@ -245,10 +245,10 @@ LL | m!(0, ..u32::MAX); | ^ pattern `u32::MAX` not covered | = note: the matched value is of type `u32` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding an arm to handle the `u32::MAX` case | -LL | match $s { $($t)+ => {}, u32::MAX => todo!() } - | +++++++++++++++++++++ +LL | match $s { $($t)+ => {}, u32::MAX => { todo!() } } + | +++++++++++++++++++++++++ error[E0004]: match is non-exhaustive --> $DIR/half-open-range-pats-exhaustive-fail.rs:67:12 @@ -257,10 +257,10 @@ LL | m!(0, ..ALMOST_MAX); | ^ pattern `4294967294_u32..=u32::MAX` not covered | = note: the matched value is of type `u32` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding an arm to handle the `4294967294_u32..=u32::MAX` case | -LL | match $s { $($t)+ => {}, 4294967294_u32..=u32::MAX => todo!() } - | ++++++++++++++++++++++++++++++++++++++ +LL | match $s { $($t)+ => {}, 4294967294_u32..=u32::MAX => { todo!() } } + | ++++++++++++++++++++++++++++++++++++++++++ error[E0004]: match is non-exhaustive --> $DIR/half-open-range-pats-exhaustive-fail.rs:68:12 @@ -269,10 +269,10 @@ LL | m!(0, ALMOST_MIN..); | ^ pattern `0_u32` not covered | = note: the matched value is of type `u32` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding an arm to handle the `0_u32` case | -LL | match $s { $($t)+ => {}, 0_u32 => todo!() } - | ++++++++++++++++++ +LL | match $s { $($t)+ => {}, 0_u32 => { todo!() } } + | ++++++++++++++++++++++ error[E0004]: match is non-exhaustive --> $DIR/half-open-range-pats-exhaustive-fail.rs:69:12 @@ -281,10 +281,10 @@ LL | m!(0, ..=ALMOST_MAX); | ^ pattern `u32::MAX` not covered | = note: the matched value is of type `u32` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding an arm to handle the `u32::MAX` case | -LL | match $s { $($t)+ => {}, u32::MAX => todo!() } - | +++++++++++++++++++++ +LL | match $s { $($t)+ => {}, u32::MAX => { todo!() } } + | +++++++++++++++++++++++++ error[E0004]: match is non-exhaustive --> $DIR/half-open-range-pats-exhaustive-fail.rs:70:12 @@ -293,10 +293,10 @@ LL | m!(0, ..=VAL | VAL_2..); | ^ pattern `43_u32` not covered | = note: the matched value is of type `u32` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding an arm to handle the `43_u32` case | -LL | match $s { $($t)+ => {}, 43_u32 => todo!() } - | +++++++++++++++++++ +LL | match $s { $($t)+ => {}, 43_u32 => { todo!() } } + | +++++++++++++++++++++++ error[E0004]: match is non-exhaustive --> $DIR/half-open-range-pats-exhaustive-fail.rs:71:12 @@ -305,10 +305,10 @@ LL | m!(0, ..VAL_1 | VAL_2..); | ^ pattern `43_u32` not covered | = note: the matched value is of type `u32` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding an arm to handle the `43_u32` case | -LL | match $s { $($t)+ => {}, 43_u32 => todo!() } - | +++++++++++++++++++ +LL | match $s { $($t)+ => {}, 43_u32 => { todo!() } } + | +++++++++++++++++++++++ error[E0004]: match is non-exhaustive --> $DIR/half-open-range-pats-exhaustive-fail.rs:79:12 @@ -317,10 +317,10 @@ LL | m!(0, ..u64::MAX); | ^ pattern `u64::MAX` not covered | = note: the matched value is of type `u64` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding an arm to handle the `u64::MAX` case | -LL | match $s { $($t)+ => {}, u64::MAX => todo!() } - | +++++++++++++++++++++ +LL | match $s { $($t)+ => {}, u64::MAX => { todo!() } } + | +++++++++++++++++++++++++ error[E0004]: match is non-exhaustive --> $DIR/half-open-range-pats-exhaustive-fail.rs:80:12 @@ -329,10 +329,10 @@ LL | m!(0, ..ALMOST_MAX); | ^ pattern `18446744073709551614_u64..=u64::MAX` not covered | = note: the matched value is of type `u64` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding an arm to handle the `18446744073709551614_u64..=u64::MAX` case | -LL | match $s { $($t)+ => {}, 18446744073709551614_u64..=u64::MAX => todo!() } - | ++++++++++++++++++++++++++++++++++++++++++++++++ +LL | match $s { $($t)+ => {}, 18446744073709551614_u64..=u64::MAX => { todo!() } } + | ++++++++++++++++++++++++++++++++++++++++++++++++++++ error[E0004]: match is non-exhaustive --> $DIR/half-open-range-pats-exhaustive-fail.rs:81:12 @@ -341,10 +341,10 @@ LL | m!(0, ALMOST_MIN..); | ^ pattern `0_u64` not covered | = note: the matched value is of type `u64` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding an arm to handle the `0_u64` case | -LL | match $s { $($t)+ => {}, 0_u64 => todo!() } - | ++++++++++++++++++ +LL | match $s { $($t)+ => {}, 0_u64 => { todo!() } } + | ++++++++++++++++++++++ error[E0004]: match is non-exhaustive --> $DIR/half-open-range-pats-exhaustive-fail.rs:82:12 @@ -353,10 +353,10 @@ LL | m!(0, ..=ALMOST_MAX); | ^ pattern `u64::MAX` not covered | = note: the matched value is of type `u64` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding an arm to handle the `u64::MAX` case | -LL | match $s { $($t)+ => {}, u64::MAX => todo!() } - | +++++++++++++++++++++ +LL | match $s { $($t)+ => {}, u64::MAX => { todo!() } } + | +++++++++++++++++++++++++ error[E0004]: match is non-exhaustive --> $DIR/half-open-range-pats-exhaustive-fail.rs:83:12 @@ -365,10 +365,10 @@ LL | m!(0, ..=VAL | VAL_2..); | ^ pattern `43_u64` not covered | = note: the matched value is of type `u64` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding an arm to handle the `43_u64` case | -LL | match $s { $($t)+ => {}, 43_u64 => todo!() } - | +++++++++++++++++++ +LL | match $s { $($t)+ => {}, 43_u64 => { todo!() } } + | +++++++++++++++++++++++ error[E0004]: match is non-exhaustive --> $DIR/half-open-range-pats-exhaustive-fail.rs:84:12 @@ -377,10 +377,10 @@ LL | m!(0, ..VAL_1 | VAL_2..); | ^ pattern `43_u64` not covered | = note: the matched value is of type `u64` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding an arm to handle the `43_u64` case | -LL | match $s { $($t)+ => {}, 43_u64 => todo!() } - | +++++++++++++++++++ +LL | match $s { $($t)+ => {}, 43_u64 => { todo!() } } + | +++++++++++++++++++++++ error[E0004]: match is non-exhaustive --> $DIR/half-open-range-pats-exhaustive-fail.rs:92:12 @@ -389,10 +389,10 @@ LL | m!(0, ..u128::MAX); | ^ pattern `u128::MAX` not covered | = note: the matched value is of type `u128` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding an arm to handle the `u128::MAX` case | -LL | match $s { $($t)+ => {}, u128::MAX => todo!() } - | ++++++++++++++++++++++ +LL | match $s { $($t)+ => {}, u128::MAX => { todo!() } } + | ++++++++++++++++++++++++++ error[E0004]: match is non-exhaustive --> $DIR/half-open-range-pats-exhaustive-fail.rs:93:12 @@ -401,10 +401,10 @@ LL | m!(0, ..ALMOST_MAX); | ^ pattern `340282366920938463463374607431768211454_u128..=u128::MAX` not covered | = note: the matched value is of type `u128` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding an arm to handle the `340282366920938463463374607431768211454_u128..=u128::MAX` case | -LL | match $s { $($t)+ => {}, 340282366920938463463374607431768211454_u128..=u128::MAX => todo!() } - | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +LL | match $s { $($t)+ => {}, 340282366920938463463374607431768211454_u128..=u128::MAX => { todo!() } } + | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ error[E0004]: match is non-exhaustive --> $DIR/half-open-range-pats-exhaustive-fail.rs:94:12 @@ -413,10 +413,10 @@ LL | m!(0, ALMOST_MIN..); | ^ pattern `0_u128` not covered | = note: the matched value is of type `u128` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding an arm to handle the `0_u128` case | -LL | match $s { $($t)+ => {}, 0_u128 => todo!() } - | +++++++++++++++++++ +LL | match $s { $($t)+ => {}, 0_u128 => { todo!() } } + | +++++++++++++++++++++++ error[E0004]: match is non-exhaustive --> $DIR/half-open-range-pats-exhaustive-fail.rs:95:12 @@ -425,10 +425,10 @@ LL | m!(0, ..=ALMOST_MAX); | ^ pattern `u128::MAX` not covered | = note: the matched value is of type `u128` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding an arm to handle the `u128::MAX` case | -LL | match $s { $($t)+ => {}, u128::MAX => todo!() } - | ++++++++++++++++++++++ +LL | match $s { $($t)+ => {}, u128::MAX => { todo!() } } + | ++++++++++++++++++++++++++ error[E0004]: match is non-exhaustive --> $DIR/half-open-range-pats-exhaustive-fail.rs:96:12 @@ -437,10 +437,10 @@ LL | m!(0, ..=VAL | VAL_2..); | ^ pattern `43_u128` not covered | = note: the matched value is of type `u128` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding an arm to handle the `43_u128` case | -LL | match $s { $($t)+ => {}, 43_u128 => todo!() } - | ++++++++++++++++++++ +LL | match $s { $($t)+ => {}, 43_u128 => { todo!() } } + | ++++++++++++++++++++++++ error[E0004]: match is non-exhaustive --> $DIR/half-open-range-pats-exhaustive-fail.rs:97:12 @@ -449,10 +449,10 @@ LL | m!(0, ..VAL_1 | VAL_2..); | ^ pattern `43_u128` not covered | = note: the matched value is of type `u128` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding an arm to handle the `43_u128` case | -LL | match $s { $($t)+ => {}, 43_u128 => todo!() } - | ++++++++++++++++++++ +LL | match $s { $($t)+ => {}, 43_u128 => { todo!() } } + | ++++++++++++++++++++++++ error[E0004]: match is non-exhaustive --> $DIR/half-open-range-pats-exhaustive-fail.rs:108:12 @@ -461,10 +461,10 @@ LL | m!(0, ..i8::MAX); | ^ pattern `i8::MAX` not covered | = note: the matched value is of type `i8` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding an arm to handle the `i8::MAX` case | -LL | match $s { $($t)+ => {}, i8::MAX => todo!() } - | ++++++++++++++++++++ +LL | match $s { $($t)+ => {}, i8::MAX => { todo!() } } + | ++++++++++++++++++++++++ error[E0004]: match is non-exhaustive --> $DIR/half-open-range-pats-exhaustive-fail.rs:109:12 @@ -473,10 +473,10 @@ LL | m!(0, ..ALMOST_MAX); | ^ pattern `126_i8..=i8::MAX` not covered | = note: the matched value is of type `i8` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding an arm to handle the `126_i8..=i8::MAX` case | -LL | match $s { $($t)+ => {}, 126_i8..=i8::MAX => todo!() } - | +++++++++++++++++++++++++++++ +LL | match $s { $($t)+ => {}, 126_i8..=i8::MAX => { todo!() } } + | +++++++++++++++++++++++++++++++++ error[E0004]: match is non-exhaustive --> $DIR/half-open-range-pats-exhaustive-fail.rs:110:12 @@ -485,10 +485,10 @@ LL | m!(0, ALMOST_MIN..); | ^ pattern `i8::MIN` not covered | = note: the matched value is of type `i8` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding an arm to handle the `i8::MIN` case | -LL | match $s { $($t)+ => {}, i8::MIN => todo!() } - | ++++++++++++++++++++ +LL | match $s { $($t)+ => {}, i8::MIN => { todo!() } } + | ++++++++++++++++++++++++ error[E0004]: match is non-exhaustive --> $DIR/half-open-range-pats-exhaustive-fail.rs:111:12 @@ -497,10 +497,10 @@ LL | m!(0, ..=ALMOST_MAX); | ^ pattern `i8::MAX` not covered | = note: the matched value is of type `i8` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding an arm to handle the `i8::MAX` case | -LL | match $s { $($t)+ => {}, i8::MAX => todo!() } - | ++++++++++++++++++++ +LL | match $s { $($t)+ => {}, i8::MAX => { todo!() } } + | ++++++++++++++++++++++++ error[E0004]: match is non-exhaustive --> $DIR/half-open-range-pats-exhaustive-fail.rs:112:12 @@ -509,10 +509,10 @@ LL | m!(0, ..=VAL | VAL_2..); | ^ pattern `43_i8` not covered | = note: the matched value is of type `i8` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding an arm to handle the `43_i8` case | -LL | match $s { $($t)+ => {}, 43_i8 => todo!() } - | ++++++++++++++++++ +LL | match $s { $($t)+ => {}, 43_i8 => { todo!() } } + | ++++++++++++++++++++++ error[E0004]: match is non-exhaustive --> $DIR/half-open-range-pats-exhaustive-fail.rs:113:12 @@ -521,10 +521,10 @@ LL | m!(0, ..VAL_1 | VAL_2..); | ^ pattern `43_i8` not covered | = note: the matched value is of type `i8` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding an arm to handle the `43_i8` case | -LL | match $s { $($t)+ => {}, 43_i8 => todo!() } - | ++++++++++++++++++ +LL | match $s { $($t)+ => {}, 43_i8 => { todo!() } } + | ++++++++++++++++++++++ error[E0004]: match is non-exhaustive --> $DIR/half-open-range-pats-exhaustive-fail.rs:121:12 @@ -533,10 +533,10 @@ LL | m!(0, ..i16::MAX); | ^ pattern `i16::MAX` not covered | = note: the matched value is of type `i16` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding an arm to handle the `i16::MAX` case | -LL | match $s { $($t)+ => {}, i16::MAX => todo!() } - | +++++++++++++++++++++ +LL | match $s { $($t)+ => {}, i16::MAX => { todo!() } } + | +++++++++++++++++++++++++ error[E0004]: match is non-exhaustive --> $DIR/half-open-range-pats-exhaustive-fail.rs:122:12 @@ -545,10 +545,10 @@ LL | m!(0, ..ALMOST_MAX); | ^ pattern `32766_i16..=i16::MAX` not covered | = note: the matched value is of type `i16` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding an arm to handle the `32766_i16..=i16::MAX` case | -LL | match $s { $($t)+ => {}, 32766_i16..=i16::MAX => todo!() } - | +++++++++++++++++++++++++++++++++ +LL | match $s { $($t)+ => {}, 32766_i16..=i16::MAX => { todo!() } } + | +++++++++++++++++++++++++++++++++++++ error[E0004]: match is non-exhaustive --> $DIR/half-open-range-pats-exhaustive-fail.rs:123:12 @@ -557,10 +557,10 @@ LL | m!(0, ALMOST_MIN..); | ^ pattern `i16::MIN` not covered | = note: the matched value is of type `i16` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding an arm to handle the `i16::MIN` case | -LL | match $s { $($t)+ => {}, i16::MIN => todo!() } - | +++++++++++++++++++++ +LL | match $s { $($t)+ => {}, i16::MIN => { todo!() } } + | +++++++++++++++++++++++++ error[E0004]: match is non-exhaustive --> $DIR/half-open-range-pats-exhaustive-fail.rs:124:12 @@ -569,10 +569,10 @@ LL | m!(0, ..=ALMOST_MAX); | ^ pattern `i16::MAX` not covered | = note: the matched value is of type `i16` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding an arm to handle the `i16::MAX` case | -LL | match $s { $($t)+ => {}, i16::MAX => todo!() } - | +++++++++++++++++++++ +LL | match $s { $($t)+ => {}, i16::MAX => { todo!() } } + | +++++++++++++++++++++++++ error[E0004]: match is non-exhaustive --> $DIR/half-open-range-pats-exhaustive-fail.rs:125:12 @@ -581,10 +581,10 @@ LL | m!(0, ..=VAL | VAL_2..); | ^ pattern `43_i16` not covered | = note: the matched value is of type `i16` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding an arm to handle the `43_i16` case | -LL | match $s { $($t)+ => {}, 43_i16 => todo!() } - | +++++++++++++++++++ +LL | match $s { $($t)+ => {}, 43_i16 => { todo!() } } + | +++++++++++++++++++++++ error[E0004]: match is non-exhaustive --> $DIR/half-open-range-pats-exhaustive-fail.rs:126:12 @@ -593,10 +593,10 @@ LL | m!(0, ..VAL_1 | VAL_2..); | ^ pattern `43_i16` not covered | = note: the matched value is of type `i16` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding an arm to handle the `43_i16` case | -LL | match $s { $($t)+ => {}, 43_i16 => todo!() } - | +++++++++++++++++++ +LL | match $s { $($t)+ => {}, 43_i16 => { todo!() } } + | +++++++++++++++++++++++ error[E0004]: match is non-exhaustive --> $DIR/half-open-range-pats-exhaustive-fail.rs:134:12 @@ -605,10 +605,10 @@ LL | m!(0, ..i32::MAX); | ^ pattern `i32::MAX` not covered | = note: the matched value is of type `i32` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding an arm to handle the `i32::MAX` case | -LL | match $s { $($t)+ => {}, i32::MAX => todo!() } - | +++++++++++++++++++++ +LL | match $s { $($t)+ => {}, i32::MAX => { todo!() } } + | +++++++++++++++++++++++++ error[E0004]: match is non-exhaustive --> $DIR/half-open-range-pats-exhaustive-fail.rs:135:12 @@ -617,10 +617,10 @@ LL | m!(0, ..ALMOST_MAX); | ^ pattern `2147483646_i32..=i32::MAX` not covered | = note: the matched value is of type `i32` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding an arm to handle the `2147483646_i32..=i32::MAX` case | -LL | match $s { $($t)+ => {}, 2147483646_i32..=i32::MAX => todo!() } - | ++++++++++++++++++++++++++++++++++++++ +LL | match $s { $($t)+ => {}, 2147483646_i32..=i32::MAX => { todo!() } } + | ++++++++++++++++++++++++++++++++++++++++++ error[E0004]: match is non-exhaustive --> $DIR/half-open-range-pats-exhaustive-fail.rs:136:12 @@ -629,10 +629,10 @@ LL | m!(0, ALMOST_MIN..); | ^ pattern `i32::MIN` not covered | = note: the matched value is of type `i32` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding an arm to handle the `i32::MIN` case | -LL | match $s { $($t)+ => {}, i32::MIN => todo!() } - | +++++++++++++++++++++ +LL | match $s { $($t)+ => {}, i32::MIN => { todo!() } } + | +++++++++++++++++++++++++ error[E0004]: match is non-exhaustive --> $DIR/half-open-range-pats-exhaustive-fail.rs:137:12 @@ -641,10 +641,10 @@ LL | m!(0, ..=ALMOST_MAX); | ^ pattern `i32::MAX` not covered | = note: the matched value is of type `i32` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding an arm to handle the `i32::MAX` case | -LL | match $s { $($t)+ => {}, i32::MAX => todo!() } - | +++++++++++++++++++++ +LL | match $s { $($t)+ => {}, i32::MAX => { todo!() } } + | +++++++++++++++++++++++++ error[E0004]: match is non-exhaustive --> $DIR/half-open-range-pats-exhaustive-fail.rs:138:12 @@ -653,10 +653,10 @@ LL | m!(0, ..=VAL | VAL_2..); | ^ pattern `43_i32` not covered | = note: the matched value is of type `i32` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding an arm to handle the `43_i32` case | -LL | match $s { $($t)+ => {}, 43_i32 => todo!() } - | +++++++++++++++++++ +LL | match $s { $($t)+ => {}, 43_i32 => { todo!() } } + | +++++++++++++++++++++++ error[E0004]: match is non-exhaustive --> $DIR/half-open-range-pats-exhaustive-fail.rs:139:12 @@ -665,10 +665,10 @@ LL | m!(0, ..VAL_1 | VAL_2..); | ^ pattern `43_i32` not covered | = note: the matched value is of type `i32` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding an arm to handle the `43_i32` case | -LL | match $s { $($t)+ => {}, 43_i32 => todo!() } - | +++++++++++++++++++ +LL | match $s { $($t)+ => {}, 43_i32 => { todo!() } } + | +++++++++++++++++++++++ error[E0004]: match is non-exhaustive --> $DIR/half-open-range-pats-exhaustive-fail.rs:147:12 @@ -677,10 +677,10 @@ LL | m!(0, ..i64::MAX); | ^ pattern `i64::MAX` not covered | = note: the matched value is of type `i64` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding an arm to handle the `i64::MAX` case | -LL | match $s { $($t)+ => {}, i64::MAX => todo!() } - | +++++++++++++++++++++ +LL | match $s { $($t)+ => {}, i64::MAX => { todo!() } } + | +++++++++++++++++++++++++ error[E0004]: match is non-exhaustive --> $DIR/half-open-range-pats-exhaustive-fail.rs:148:12 @@ -689,10 +689,10 @@ LL | m!(0, ..ALMOST_MAX); | ^ pattern `9223372036854775806_i64..=i64::MAX` not covered | = note: the matched value is of type `i64` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding an arm to handle the `9223372036854775806_i64..=i64::MAX` case | -LL | match $s { $($t)+ => {}, 9223372036854775806_i64..=i64::MAX => todo!() } - | +++++++++++++++++++++++++++++++++++++++++++++++ +LL | match $s { $($t)+ => {}, 9223372036854775806_i64..=i64::MAX => { todo!() } } + | +++++++++++++++++++++++++++++++++++++++++++++++++++ error[E0004]: match is non-exhaustive --> $DIR/half-open-range-pats-exhaustive-fail.rs:149:12 @@ -701,10 +701,10 @@ LL | m!(0, ALMOST_MIN..); | ^ pattern `i64::MIN` not covered | = note: the matched value is of type `i64` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding an arm to handle the `i64::MIN` case | -LL | match $s { $($t)+ => {}, i64::MIN => todo!() } - | +++++++++++++++++++++ +LL | match $s { $($t)+ => {}, i64::MIN => { todo!() } } + | +++++++++++++++++++++++++ error[E0004]: match is non-exhaustive --> $DIR/half-open-range-pats-exhaustive-fail.rs:150:12 @@ -713,10 +713,10 @@ LL | m!(0, ..=ALMOST_MAX); | ^ pattern `i64::MAX` not covered | = note: the matched value is of type `i64` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding an arm to handle the `i64::MAX` case | -LL | match $s { $($t)+ => {}, i64::MAX => todo!() } - | +++++++++++++++++++++ +LL | match $s { $($t)+ => {}, i64::MAX => { todo!() } } + | +++++++++++++++++++++++++ error[E0004]: match is non-exhaustive --> $DIR/half-open-range-pats-exhaustive-fail.rs:151:12 @@ -725,10 +725,10 @@ LL | m!(0, ..=VAL | VAL_2..); | ^ pattern `43_i64` not covered | = note: the matched value is of type `i64` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding an arm to handle the `43_i64` case | -LL | match $s { $($t)+ => {}, 43_i64 => todo!() } - | +++++++++++++++++++ +LL | match $s { $($t)+ => {}, 43_i64 => { todo!() } } + | +++++++++++++++++++++++ error[E0004]: match is non-exhaustive --> $DIR/half-open-range-pats-exhaustive-fail.rs:152:12 @@ -737,10 +737,10 @@ LL | m!(0, ..VAL_1 | VAL_2..); | ^ pattern `43_i64` not covered | = note: the matched value is of type `i64` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding an arm to handle the `43_i64` case | -LL | match $s { $($t)+ => {}, 43_i64 => todo!() } - | +++++++++++++++++++ +LL | match $s { $($t)+ => {}, 43_i64 => { todo!() } } + | +++++++++++++++++++++++ error[E0004]: match is non-exhaustive --> $DIR/half-open-range-pats-exhaustive-fail.rs:160:12 @@ -749,10 +749,10 @@ LL | m!(0, ..i128::MAX); | ^ pattern `i128::MAX` not covered | = note: the matched value is of type `i128` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding an arm to handle the `i128::MAX` case | -LL | match $s { $($t)+ => {}, i128::MAX => todo!() } - | ++++++++++++++++++++++ +LL | match $s { $($t)+ => {}, i128::MAX => { todo!() } } + | ++++++++++++++++++++++++++ error[E0004]: match is non-exhaustive --> $DIR/half-open-range-pats-exhaustive-fail.rs:161:12 @@ -761,10 +761,10 @@ LL | m!(0, ..ALMOST_MAX); | ^ pattern `170141183460469231731687303715884105726_i128..=i128::MAX` not covered | = note: the matched value is of type `i128` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding an arm to handle the `170141183460469231731687303715884105726_i128..=i128::MAX` case | -LL | match $s { $($t)+ => {}, 170141183460469231731687303715884105726_i128..=i128::MAX => todo!() } - | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +LL | match $s { $($t)+ => {}, 170141183460469231731687303715884105726_i128..=i128::MAX => { todo!() } } + | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ error[E0004]: match is non-exhaustive --> $DIR/half-open-range-pats-exhaustive-fail.rs:162:12 @@ -773,10 +773,10 @@ LL | m!(0, ALMOST_MIN..); | ^ pattern `i128::MIN` not covered | = note: the matched value is of type `i128` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding an arm to handle the `i128::MIN` case | -LL | match $s { $($t)+ => {}, i128::MIN => todo!() } - | ++++++++++++++++++++++ +LL | match $s { $($t)+ => {}, i128::MIN => { todo!() } } + | ++++++++++++++++++++++++++ error[E0004]: match is non-exhaustive --> $DIR/half-open-range-pats-exhaustive-fail.rs:163:12 @@ -785,10 +785,10 @@ LL | m!(0, ..=ALMOST_MAX); | ^ pattern `i128::MAX` not covered | = note: the matched value is of type `i128` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding an arm to handle the `i128::MAX` case | -LL | match $s { $($t)+ => {}, i128::MAX => todo!() } - | ++++++++++++++++++++++ +LL | match $s { $($t)+ => {}, i128::MAX => { todo!() } } + | ++++++++++++++++++++++++++ error[E0004]: match is non-exhaustive --> $DIR/half-open-range-pats-exhaustive-fail.rs:164:12 @@ -797,10 +797,10 @@ LL | m!(0, ..=VAL | VAL_2..); | ^ pattern `43_i128` not covered | = note: the matched value is of type `i128` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding an arm to handle the `43_i128` case | -LL | match $s { $($t)+ => {}, 43_i128 => todo!() } - | ++++++++++++++++++++ +LL | match $s { $($t)+ => {}, 43_i128 => { todo!() } } + | ++++++++++++++++++++++++ error[E0004]: match is non-exhaustive --> $DIR/half-open-range-pats-exhaustive-fail.rs:165:12 @@ -809,10 +809,10 @@ LL | m!(0, ..VAL_1 | VAL_2..); | ^ pattern `43_i128` not covered | = note: the matched value is of type `i128` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding an arm to handle the `43_i128` case | -LL | match $s { $($t)+ => {}, 43_i128 => todo!() } - | ++++++++++++++++++++ +LL | match $s { $($t)+ => {}, 43_i128 => { todo!() } } + | ++++++++++++++++++++++++ error: aborting due to 68 previous errors diff --git a/tests/ui/issue-94866.stderr b/tests/ui/issue-94866.stderr index e9aad00269d1b..748d5d9f1a48f 100644 --- a/tests/ui/issue-94866.stderr +++ b/tests/ui/issue-94866.stderr @@ -10,10 +10,10 @@ note: `Enum` defined here LL | enum Enum { A, B } | ^^^^ - not covered = note: the matched value is of type `Enum` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding an arm to handle the `Enum::B` case | LL ~ Enum::A => m!(), -LL + Enum::B => todo!() +LL + Enum::B => { todo!() }, | error: aborting due to previous error diff --git a/tests/ui/match/match_non_exhaustive.stderr b/tests/ui/match/match_non_exhaustive.stderr index 6478058e57ee0..efba07957c000 100644 --- a/tests/ui/match/match_non_exhaustive.stderr +++ b/tests/ui/match/match_non_exhaustive.stderr @@ -10,10 +10,10 @@ note: `L` defined here LL | enum L { A, B } | ^ - not covered = note: the matched value is of type `L` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding an arm to handle the `L::B` case | -LL | match l { L::A => (), L::B => todo!() }; - | +++++++++++++++++ +LL | match l { L::A => (), L::B => { todo!() } }; + | +++++++++++++++++++++ error[E0004]: non-exhaustive patterns: type `E1` is non-empty --> $DIR/match_non_exhaustive.rs:28:11 @@ -41,10 +41,10 @@ LL | match e2 { E2::A => (), E2::B => () }; | ^^ pattern `_` not covered | = note: the matched value is of type `E2`, which is marked as non-exhaustive -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding a wildcard arm | -LL | match e2 { E2::A => (), E2::B => (), _ => todo!() }; - | ++++++++++++++ +LL | match e2 { E2::A => (), E2::B => (), _ => { todo!() } }; + | ++++++++++++++++++ error: aborting due to 3 previous errors diff --git a/tests/ui/or-patterns/exhaustiveness-non-exhaustive.stderr b/tests/ui/or-patterns/exhaustiveness-non-exhaustive.stderr index bfdb4009577d5..f93336a31fa53 100644 --- a/tests/ui/or-patterns/exhaustiveness-non-exhaustive.stderr +++ b/tests/ui/or-patterns/exhaustiveness-non-exhaustive.stderr @@ -5,10 +5,10 @@ LL | match (0u8, 0u8) { | ^^^^^^^^^^ pattern `(2_u8..=u8::MAX, _)` not covered | = note: the matched value is of type `(u8, u8)` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding an arm to handle the `(2_u8..=u8::MAX, _)` case | -LL ~ (0 | 1, 2 | 3) => {} -LL + (2_u8..=u8::MAX, _) => todo!() +LL ~ (0 | 1, 2 | 3) => {}, +LL + (2_u8..=u8::MAX, _) => { todo!() }, | error[E0004]: match is non-exhaustive @@ -18,10 +18,10 @@ LL | match ((0u8,),) { | ^^^^^^^^^ pattern `((4_u8..=u8::MAX))` not covered | = note: the matched value is of type `((u8,),)` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding an arm to handle the `((4_u8..=u8::MAX))` case | -LL ~ ((0 | 1,) | (2 | 3,),) => {} -LL + ((4_u8..=u8::MAX)) => todo!() +LL ~ ((0 | 1,) | (2 | 3,),) => {}, +LL + ((4_u8..=u8::MAX)) => { todo!() }, | error[E0004]: match is non-exhaustive @@ -31,10 +31,10 @@ LL | match (Some(0u8),) { | ^^^^^^^^^^^^ pattern `(Some(2_u8..=u8::MAX))` not covered | = note: the matched value is of type `(Option,)` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding an arm to handle the `(Some(2_u8..=u8::MAX))` case | -LL ~ (None | Some(0 | 1),) => {} -LL + (Some(2_u8..=u8::MAX)) => todo!() +LL ~ (None | Some(0 | 1),) => {}, +LL + (Some(2_u8..=u8::MAX)) => { todo!() }, | error: aborting due to 3 previous errors diff --git a/tests/ui/or-patterns/issue-69875-should-have-been-expanded-earlier-non-exhaustive.stderr b/tests/ui/or-patterns/issue-69875-should-have-been-expanded-earlier-non-exhaustive.stderr index 4472773d95569..40a993d3320e0 100644 --- a/tests/ui/or-patterns/issue-69875-should-have-been-expanded-earlier-non-exhaustive.stderr +++ b/tests/ui/or-patterns/issue-69875-should-have-been-expanded-earlier-non-exhaustive.stderr @@ -19,10 +19,11 @@ LL | match 0 { | ^ patterns `i32::MIN..=-1_i32` and `3_i32..=i32::MAX` not covered | = note: the matched value is of type `i32` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms +help: ensure that all possible cases are being handled by adding more match arms | -LL ~ 0 | (1 | 2) => {} -LL + i32::MIN..=-1_i32 | 3_i32..=i32::MAX => todo!() +LL ~ 0 | (1 | 2) => {}, +LL + i32::MIN..=-1_i32 => { todo!() }, +LL + 3_i32..=i32::MAX => { todo!() }, | error: aborting due to 2 previous errors diff --git a/tests/ui/pattern/suggest-adding-appropriate-missing-pattern-excluding-comments.fixed b/tests/ui/pattern/suggest-adding-appropriate-missing-pattern-excluding-comments.fixed index e1f27310cfe5c..3446d78eae3e3 100644 --- a/tests/ui/pattern/suggest-adding-appropriate-missing-pattern-excluding-comments.fixed +++ b/tests/ui/pattern/suggest-adding-appropriate-missing-pattern-excluding-comments.fixed @@ -5,6 +5,7 @@ fn main() { Some(1) => {} // hello Some(_) => {} - None => todo!() + None => { todo!() }, + } } diff --git a/tests/ui/pattern/suggest-adding-appropriate-missing-pattern-excluding-comments.stderr b/tests/ui/pattern/suggest-adding-appropriate-missing-pattern-excluding-comments.stderr index 6ee65a248deb6..00988e7752a3f 100644 --- a/tests/ui/pattern/suggest-adding-appropriate-missing-pattern-excluding-comments.stderr +++ b/tests/ui/pattern/suggest-adding-appropriate-missing-pattern-excluding-comments.stderr @@ -5,10 +5,10 @@ LL | match Some(1) { | ^^^^^^^ pattern `None` not covered | = note: the matched value is of type `Option` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding an arm to handle the `None` case | LL ~ Some(_) => {} -LL + None => todo!() +LL + None => { todo!() }, | error: aborting due to previous error diff --git a/tests/ui/pattern/usefulness/doc-hidden-non-exhaustive.stderr b/tests/ui/pattern/usefulness/doc-hidden-non-exhaustive.stderr index 64299dc9e90f9..52d5f452bd508 100644 --- a/tests/ui/pattern/usefulness/doc-hidden-non-exhaustive.stderr +++ b/tests/ui/pattern/usefulness/doc-hidden-non-exhaustive.stderr @@ -5,10 +5,10 @@ LL | match HiddenEnum::A { | ^^^^^^^^^^^^^ pattern `_` not covered | = note: the matched value is of type `HiddenEnum` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding a wildcard arm | LL ~ HiddenEnum::B => {} -LL + _ => todo!() +LL + _ => { todo!() }, | error[E0004]: match is non-exhaustive @@ -18,10 +18,10 @@ LL | match HiddenEnum::A { | ^^^^^^^^^^^^^ pattern `HiddenEnum::B` not covered | = note: the matched value is of type `HiddenEnum` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding an arm to handle the `HiddenEnum::B` case | LL ~ HiddenEnum::C => {} -LL + HiddenEnum::B => todo!() +LL + HiddenEnum::B => { todo!() }, | error[E0004]: match is non-exhaustive @@ -31,10 +31,11 @@ LL | match HiddenEnum::A { | ^^^^^^^^^^^^^ patterns `HiddenEnum::B` and `_` not covered | = note: the matched value is of type `HiddenEnum` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms +help: ensure that all possible cases are being handled by adding more match arms | -LL ~ HiddenEnum::A => {} -LL + HiddenEnum::B | _ => todo!() +LL ~ HiddenEnum::A => {}, +LL + HiddenEnum::B => { todo!() }, +LL + _ => { todo!() }, | error[E0004]: match is non-exhaustive @@ -44,10 +45,11 @@ LL | match None { | ^^^^ patterns `Some(HiddenEnum::B)` and `Some(_)` not covered | = note: the matched value is of type `Option` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms +help: ensure that all possible cases are being handled by adding more match arms | LL ~ Some(HiddenEnum::A) => {} -LL + Some(HiddenEnum::B) | Some(_) => todo!() +LL + Some(HiddenEnum::B) => { todo!() }, +LL + Some(_) => { todo!() }, | error[E0004]: match is non-exhaustive @@ -65,10 +67,10 @@ LL | enum InCrate { LL | C, | - not covered = note: the matched value is of type `InCrate` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding an arm to handle the `InCrate::C` case | LL ~ InCrate::B => {} -LL + InCrate::C => todo!() +LL + InCrate::C => { todo!() }, | error: aborting due to 5 previous errors diff --git a/tests/ui/pattern/usefulness/empty-match.exhaustive_patterns.stderr b/tests/ui/pattern/usefulness/empty-match.exhaustive_patterns.stderr index 86015839054ef..ea319def40422 100644 --- a/tests/ui/pattern/usefulness/empty-match.exhaustive_patterns.stderr +++ b/tests/ui/pattern/usefulness/empty-match.exhaustive_patterns.stderr @@ -119,7 +119,7 @@ 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 by adding a match arm with a wildcard pattern or an explicit pattern + = help: ensure that all possible cases are being handled by adding an arm to handle the `NonEmptyEnum1::Foo(_)` case error[E0004]: match is non-exhaustive --> $DIR/empty-match.rs:84:20 @@ -137,7 +137,7 @@ LL | Foo(bool), LL | Bar, | --- not covered = note: the matched value is of type `NonEmptyEnum2` - = help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or multiple match arms + = help: ensure that all possible cases are being handled by adding more match arms error[E0004]: match is non-exhaustive --> $DIR/empty-match.rs:85:20 @@ -158,7 +158,7 @@ LL | V1, V2, V3, V4, V5, | | not covered | not covered = note: the matched value is of type `NonEmptyEnum5` - = help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or multiple match arms + = help: ensure that all possible cases are being handled by adding more match arms error[E0004]: match is non-exhaustive --> $DIR/empty-match.rs:87:24 @@ -167,10 +167,10 @@ LL | match_guarded_arm!(0u8); | ^^^ pattern `_` not covered | = note: the matched value is of type `u8` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding a wildcard arm | -LL ~ _ if false => {} -LL + _ => todo!() +LL ~ _ if false => {}, +LL + _ => { todo!() }, | error[E0004]: match is non-exhaustive @@ -185,10 +185,10 @@ note: `NonEmptyStruct1` defined here LL | struct NonEmptyStruct1; | ^^^^^^^^^^^^^^^ = note: the matched value is of type `NonEmptyStruct1` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding an arm to handle the `NonEmptyStruct1` case | -LL ~ _ if false => {} -LL + NonEmptyStruct1 => todo!() +LL ~ _ if false => {}, +LL + NonEmptyStruct1 => { todo!() }, | error[E0004]: match is non-exhaustive @@ -203,10 +203,10 @@ note: `NonEmptyStruct2` defined here LL | struct NonEmptyStruct2(bool); | ^^^^^^^^^^^^^^^ = note: the matched value is of type `NonEmptyStruct2` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding an arm to handle the `NonEmptyStruct2(_)` case | -LL ~ _ if false => {} -LL + NonEmptyStruct2(_) => todo!() +LL ~ _ if false => {}, +LL + NonEmptyStruct2(_) => { todo!() }, | error[E0004]: match is non-exhaustive @@ -221,10 +221,10 @@ note: `NonEmptyUnion1` defined here LL | union NonEmptyUnion1 { | ^^^^^^^^^^^^^^ = note: the matched value is of type `NonEmptyUnion1` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding an arm to handle the `NonEmptyUnion1 { .. }` case | -LL ~ _ if false => {} -LL + NonEmptyUnion1 { .. } => todo!() +LL ~ _ if false => {}, +LL + NonEmptyUnion1 { .. } => { todo!() }, | error[E0004]: match is non-exhaustive @@ -239,10 +239,10 @@ note: `NonEmptyUnion2` defined here LL | union NonEmptyUnion2 { | ^^^^^^^^^^^^^^ = note: the matched value is of type `NonEmptyUnion2` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding an arm to handle the `NonEmptyUnion2 { .. }` case | -LL ~ _ if false => {} -LL + NonEmptyUnion2 { .. } => todo!() +LL ~ _ if false => {}, +LL + NonEmptyUnion2 { .. } => { todo!() }, | error[E0004]: match is non-exhaustive @@ -259,10 +259,10 @@ 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 by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding an arm to handle the `NonEmptyEnum1::Foo(_)` case | -LL ~ _ if false => {} -LL + NonEmptyEnum1::Foo(_) => todo!() +LL ~ _ if false => {}, +LL + NonEmptyEnum1::Foo(_) => { todo!() }, | error[E0004]: match is non-exhaustive @@ -281,10 +281,11 @@ LL | Foo(bool), LL | Bar, | --- not covered = note: the matched value is of type `NonEmptyEnum2` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms +help: ensure that all possible cases are being handled by adding more match arms | -LL ~ _ if false => {} -LL + NonEmptyEnum2::Foo(_) | NonEmptyEnum2::Bar => todo!() +LL ~ _ if false => {}, +LL + NonEmptyEnum2::Foo(_) => { todo!() }, +LL + NonEmptyEnum2::Bar => { todo!() }, | error[E0004]: match is non-exhaustive @@ -306,10 +307,13 @@ LL | V1, V2, V3, V4, V5, | | not covered | not covered = note: the matched value is of type `NonEmptyEnum5` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown, or multiple match arms +help: ensure that all possible cases are being handled by adding more match arms | -LL ~ _ if false => {} -LL + _ => todo!() +LL ~ _ if false => {}, +LL + NonEmptyEnum5::V1 => { todo!() }, +LL + NonEmptyEnum5::V2 => { todo!() }, +LL + NonEmptyEnum5::V3 => { todo!() }, +LL + _ => { todo!() }, | error: aborting due to 22 previous errors diff --git a/tests/ui/pattern/usefulness/empty-match.normal.stderr b/tests/ui/pattern/usefulness/empty-match.normal.stderr index 86015839054ef..ea319def40422 100644 --- a/tests/ui/pattern/usefulness/empty-match.normal.stderr +++ b/tests/ui/pattern/usefulness/empty-match.normal.stderr @@ -119,7 +119,7 @@ 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 by adding a match arm with a wildcard pattern or an explicit pattern + = help: ensure that all possible cases are being handled by adding an arm to handle the `NonEmptyEnum1::Foo(_)` case error[E0004]: match is non-exhaustive --> $DIR/empty-match.rs:84:20 @@ -137,7 +137,7 @@ LL | Foo(bool), LL | Bar, | --- not covered = note: the matched value is of type `NonEmptyEnum2` - = help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or multiple match arms + = help: ensure that all possible cases are being handled by adding more match arms error[E0004]: match is non-exhaustive --> $DIR/empty-match.rs:85:20 @@ -158,7 +158,7 @@ LL | V1, V2, V3, V4, V5, | | not covered | not covered = note: the matched value is of type `NonEmptyEnum5` - = help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or multiple match arms + = help: ensure that all possible cases are being handled by adding more match arms error[E0004]: match is non-exhaustive --> $DIR/empty-match.rs:87:24 @@ -167,10 +167,10 @@ LL | match_guarded_arm!(0u8); | ^^^ pattern `_` not covered | = note: the matched value is of type `u8` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding a wildcard arm | -LL ~ _ if false => {} -LL + _ => todo!() +LL ~ _ if false => {}, +LL + _ => { todo!() }, | error[E0004]: match is non-exhaustive @@ -185,10 +185,10 @@ note: `NonEmptyStruct1` defined here LL | struct NonEmptyStruct1; | ^^^^^^^^^^^^^^^ = note: the matched value is of type `NonEmptyStruct1` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding an arm to handle the `NonEmptyStruct1` case | -LL ~ _ if false => {} -LL + NonEmptyStruct1 => todo!() +LL ~ _ if false => {}, +LL + NonEmptyStruct1 => { todo!() }, | error[E0004]: match is non-exhaustive @@ -203,10 +203,10 @@ note: `NonEmptyStruct2` defined here LL | struct NonEmptyStruct2(bool); | ^^^^^^^^^^^^^^^ = note: the matched value is of type `NonEmptyStruct2` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding an arm to handle the `NonEmptyStruct2(_)` case | -LL ~ _ if false => {} -LL + NonEmptyStruct2(_) => todo!() +LL ~ _ if false => {}, +LL + NonEmptyStruct2(_) => { todo!() }, | error[E0004]: match is non-exhaustive @@ -221,10 +221,10 @@ note: `NonEmptyUnion1` defined here LL | union NonEmptyUnion1 { | ^^^^^^^^^^^^^^ = note: the matched value is of type `NonEmptyUnion1` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding an arm to handle the `NonEmptyUnion1 { .. }` case | -LL ~ _ if false => {} -LL + NonEmptyUnion1 { .. } => todo!() +LL ~ _ if false => {}, +LL + NonEmptyUnion1 { .. } => { todo!() }, | error[E0004]: match is non-exhaustive @@ -239,10 +239,10 @@ note: `NonEmptyUnion2` defined here LL | union NonEmptyUnion2 { | ^^^^^^^^^^^^^^ = note: the matched value is of type `NonEmptyUnion2` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding an arm to handle the `NonEmptyUnion2 { .. }` case | -LL ~ _ if false => {} -LL + NonEmptyUnion2 { .. } => todo!() +LL ~ _ if false => {}, +LL + NonEmptyUnion2 { .. } => { todo!() }, | error[E0004]: match is non-exhaustive @@ -259,10 +259,10 @@ 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 by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding an arm to handle the `NonEmptyEnum1::Foo(_)` case | -LL ~ _ if false => {} -LL + NonEmptyEnum1::Foo(_) => todo!() +LL ~ _ if false => {}, +LL + NonEmptyEnum1::Foo(_) => { todo!() }, | error[E0004]: match is non-exhaustive @@ -281,10 +281,11 @@ LL | Foo(bool), LL | Bar, | --- not covered = note: the matched value is of type `NonEmptyEnum2` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms +help: ensure that all possible cases are being handled by adding more match arms | -LL ~ _ if false => {} -LL + NonEmptyEnum2::Foo(_) | NonEmptyEnum2::Bar => todo!() +LL ~ _ if false => {}, +LL + NonEmptyEnum2::Foo(_) => { todo!() }, +LL + NonEmptyEnum2::Bar => { todo!() }, | error[E0004]: match is non-exhaustive @@ -306,10 +307,13 @@ LL | V1, V2, V3, V4, V5, | | not covered | not covered = note: the matched value is of type `NonEmptyEnum5` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown, or multiple match arms +help: ensure that all possible cases are being handled by adding more match arms | -LL ~ _ if false => {} -LL + _ => todo!() +LL ~ _ if false => {}, +LL + NonEmptyEnum5::V1 => { todo!() }, +LL + NonEmptyEnum5::V2 => { todo!() }, +LL + NonEmptyEnum5::V3 => { todo!() }, +LL + _ => { todo!() }, | error: aborting due to 22 previous errors diff --git a/tests/ui/pattern/usefulness/floats.stderr b/tests/ui/pattern/usefulness/floats.stderr index 983767e45f09b..ce731d4250c63 100644 --- a/tests/ui/pattern/usefulness/floats.stderr +++ b/tests/ui/pattern/usefulness/floats.stderr @@ -5,10 +5,10 @@ LL | match 0.0 { | ^^^ pattern `_` not covered | = note: the matched value is of type `f64` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding a wildcard arm | -LL ~ 0.0..=1.0 => {} -LL + _ => todo!() +LL ~ 0.0..=1.0 => {}, +LL + _ => { todo!() }, | error: unreachable pattern diff --git a/tests/ui/pattern/usefulness/guards.stderr b/tests/ui/pattern/usefulness/guards.stderr index c1af6837861f6..6dc5b29f3e8b8 100644 --- a/tests/ui/pattern/usefulness/guards.stderr +++ b/tests/ui/pattern/usefulness/guards.stderr @@ -5,10 +5,10 @@ LL | match 0u8 { | ^^^ pattern `128_u8..=u8::MAX` not covered | = note: the matched value is of type `u8` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding an arm to handle the `128_u8..=u8::MAX` case | LL ~ 128 ..= 255 if true => {} -LL + 128_u8..=u8::MAX => todo!() +LL + 128_u8..=u8::MAX => { todo!() }, | error: aborting due to previous error diff --git a/tests/ui/pattern/usefulness/integer-ranges/exhaustiveness.stderr b/tests/ui/pattern/usefulness/integer-ranges/exhaustiveness.stderr index a41f03b857cc7..6723087e41e4a 100644 --- a/tests/ui/pattern/usefulness/integer-ranges/exhaustiveness.stderr +++ b/tests/ui/pattern/usefulness/integer-ranges/exhaustiveness.stderr @@ -5,10 +5,10 @@ LL | m!(0u8, 0..255); | ^^^ pattern `u8::MAX` not covered | = note: the matched value is of type `u8` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding an arm to handle the `u8::MAX` case | -LL | match $s { $($t)+ => {}, u8::MAX => todo!() } - | ++++++++++++++++++++ +LL | match $s { $($t)+ => {}, u8::MAX => { todo!() } } + | ++++++++++++++++++++++++ error[E0004]: match is non-exhaustive --> $DIR/exhaustiveness.rs:48:8 @@ -17,10 +17,10 @@ LL | m!(0u8, 0..=254); | ^^^ pattern `u8::MAX` not covered | = note: the matched value is of type `u8` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding an arm to handle the `u8::MAX` case | -LL | match $s { $($t)+ => {}, u8::MAX => todo!() } - | ++++++++++++++++++++ +LL | match $s { $($t)+ => {}, u8::MAX => { todo!() } } + | ++++++++++++++++++++++++ error[E0004]: match is non-exhaustive --> $DIR/exhaustiveness.rs:49:8 @@ -29,10 +29,10 @@ LL | m!(0u8, 1..=255); | ^^^ pattern `0_u8` not covered | = note: the matched value is of type `u8` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding an arm to handle the `0_u8` case | -LL | match $s { $($t)+ => {}, 0_u8 => todo!() } - | +++++++++++++++++ +LL | match $s { $($t)+ => {}, 0_u8 => { todo!() } } + | +++++++++++++++++++++ error[E0004]: match is non-exhaustive --> $DIR/exhaustiveness.rs:50:8 @@ -41,10 +41,10 @@ LL | m!(0u8, 0..42 | 43..=255); | ^^^ pattern `42_u8` not covered | = note: the matched value is of type `u8` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding an arm to handle the `42_u8` case | -LL | match $s { $($t)+ => {}, 42_u8 => todo!() } - | ++++++++++++++++++ +LL | match $s { $($t)+ => {}, 42_u8 => { todo!() } } + | ++++++++++++++++++++++ error[E0004]: match is non-exhaustive --> $DIR/exhaustiveness.rs:51:8 @@ -53,10 +53,10 @@ LL | m!(0i8, -128..127); | ^^^ pattern `i8::MAX` not covered | = note: the matched value is of type `i8` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding an arm to handle the `i8::MAX` case | -LL | match $s { $($t)+ => {}, i8::MAX => todo!() } - | ++++++++++++++++++++ +LL | match $s { $($t)+ => {}, i8::MAX => { todo!() } } + | ++++++++++++++++++++++++ error[E0004]: match is non-exhaustive --> $DIR/exhaustiveness.rs:52:8 @@ -65,10 +65,10 @@ LL | m!(0i8, -128..=126); | ^^^ pattern `i8::MAX` not covered | = note: the matched value is of type `i8` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding an arm to handle the `i8::MAX` case | -LL | match $s { $($t)+ => {}, i8::MAX => todo!() } - | ++++++++++++++++++++ +LL | match $s { $($t)+ => {}, i8::MAX => { todo!() } } + | ++++++++++++++++++++++++ error[E0004]: match is non-exhaustive --> $DIR/exhaustiveness.rs:53:8 @@ -77,10 +77,10 @@ LL | m!(0i8, -127..=127); | ^^^ pattern `i8::MIN` not covered | = note: the matched value is of type `i8` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding an arm to handle the `i8::MIN` case | -LL | match $s { $($t)+ => {}, i8::MIN => todo!() } - | ++++++++++++++++++++ +LL | match $s { $($t)+ => {}, i8::MIN => { todo!() } } + | ++++++++++++++++++++++++ error[E0004]: match is non-exhaustive --> $DIR/exhaustiveness.rs:54:11 @@ -89,10 +89,10 @@ LL | match 0i8 { | ^^^ pattern `0_i8` not covered | = note: the matched value is of type `i8` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding an arm to handle the `0_i8` case | LL ~ 1 ..= i8::MAX => {} -LL + 0_i8 => todo!() +LL + 0_i8 => { todo!() }, | error[E0004]: match is non-exhaustive @@ -102,10 +102,10 @@ LL | m!(0u128, 0..=ALMOST_MAX); | ^^^^^ pattern `u128::MAX` not covered | = note: the matched value is of type `u128` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding an arm to handle the `u128::MAX` case | -LL | match $s { $($t)+ => {}, u128::MAX => todo!() } - | ++++++++++++++++++++++ +LL | match $s { $($t)+ => {}, u128::MAX => { todo!() } } + | ++++++++++++++++++++++++++ error[E0004]: match is non-exhaustive --> $DIR/exhaustiveness.rs:60:8 @@ -114,10 +114,10 @@ LL | m!(0u128, 0..=4); | ^^^^^ pattern `5_u128..=u128::MAX` not covered | = note: the matched value is of type `u128` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding an arm to handle the `5_u128..=u128::MAX` case | -LL | match $s { $($t)+ => {}, 5_u128..=u128::MAX => todo!() } - | +++++++++++++++++++++++++++++++ +LL | match $s { $($t)+ => {}, 5_u128..=u128::MAX => { todo!() } } + | +++++++++++++++++++++++++++++++++++ error[E0004]: match is non-exhaustive --> $DIR/exhaustiveness.rs:61:8 @@ -126,10 +126,10 @@ LL | m!(0u128, 1..=u128::MAX); | ^^^^^ pattern `0_u128` not covered | = note: the matched value is of type `u128` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding an arm to handle the `0_u128` case | -LL | match $s { $($t)+ => {}, 0_u128 => todo!() } - | +++++++++++++++++++ +LL | match $s { $($t)+ => {}, 0_u128 => { todo!() } } + | +++++++++++++++++++++++ error[E0004]: match is non-exhaustive --> $DIR/exhaustiveness.rs:69:11 @@ -138,10 +138,10 @@ LL | match (0u8, true) { | ^^^^^^^^^^^ pattern `(126_u8..=127_u8, false)` not covered | = note: the matched value is of type `(u8, bool)` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding an arm to handle the `(126_u8..=127_u8, false)` case | LL ~ (0 ..= 255, true) => {} -LL + (126_u8..=127_u8, false) => todo!() +LL + (126_u8..=127_u8, false) => { todo!() }, | error: aborting due to 12 previous errors diff --git a/tests/ui/pattern/usefulness/integer-ranges/pointer-sized-int.deny.stderr b/tests/ui/pattern/usefulness/integer-ranges/pointer-sized-int.deny.stderr index 15e30df356cbf..a6385a1c0b902 100644 --- a/tests/ui/pattern/usefulness/integer-ranges/pointer-sized-int.deny.stderr +++ b/tests/ui/pattern/usefulness/integer-ranges/pointer-sized-int.deny.stderr @@ -7,10 +7,10 @@ LL | match 0usize { = note: the matched value is of type `usize` = note: `usize` does not have a fixed maximum value, so a wildcard `_` is necessary to match exhaustively = help: add `#![feature(precise_pointer_size_matching)]` to the crate attributes to enable precise `usize` matching -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding a wildcard arm | -LL ~ 0 ..= usize::MAX => {} -LL + _ => todo!() +LL ~ 0 ..= usize::MAX => {}, +LL + _ => { todo!() }, | error[E0004]: match is non-exhaustive @@ -22,10 +22,10 @@ LL | match 0isize { = note: the matched value is of type `isize` = note: `isize` does not have a fixed maximum value, so a wildcard `_` is necessary to match exhaustively = help: add `#![feature(precise_pointer_size_matching)]` to the crate attributes to enable precise `isize` matching -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding a wildcard arm | -LL ~ isize::MIN ..= isize::MAX => {} -LL + _ => todo!() +LL ~ isize::MIN ..= isize::MAX => {}, +LL + _ => { todo!() }, | error[E0004]: match is non-exhaustive @@ -37,10 +37,10 @@ LL | m!(0usize, 0..=usize::MAX); = note: the matched value is of type `usize` = note: `usize` does not have a fixed maximum value, so a wildcard `_` is necessary to match exhaustively = help: add `#![feature(precise_pointer_size_matching)]` to the crate attributes to enable precise `usize` matching -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding a wildcard arm | -LL | match $s { $($t)+ => {}, _ => todo!() } - | ++++++++++++++ +LL | match $s { $($t)+ => {}, _ => { todo!() } } + | ++++++++++++++++++ error[E0004]: match is non-exhaustive --> $DIR/pointer-sized-int.rs:24:8 @@ -51,10 +51,10 @@ LL | m!(0usize, 0..5 | 5..=usize::MAX); = note: the matched value is of type `usize` = note: `usize` does not have a fixed maximum value, so a wildcard `_` is necessary to match exhaustively = help: add `#![feature(precise_pointer_size_matching)]` to the crate attributes to enable precise `usize` matching -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding a wildcard arm | -LL | match $s { $($t)+ => {}, _ => todo!() } - | ++++++++++++++ +LL | match $s { $($t)+ => {}, _ => { todo!() } } + | ++++++++++++++++++ error[E0004]: match is non-exhaustive --> $DIR/pointer-sized-int.rs:26:8 @@ -65,10 +65,10 @@ LL | m!(0usize, 0..usize::MAX | usize::MAX); = note: the matched value is of type `usize` = note: `usize` does not have a fixed maximum value, so a wildcard `_` is necessary to match exhaustively = help: add `#![feature(precise_pointer_size_matching)]` to the crate attributes to enable precise `usize` matching -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding a wildcard arm | -LL | match $s { $($t)+ => {}, _ => todo!() } - | ++++++++++++++ +LL | match $s { $($t)+ => {}, _ => { todo!() } } + | ++++++++++++++++++ error[E0004]: match is non-exhaustive --> $DIR/pointer-sized-int.rs:28:8 @@ -77,10 +77,10 @@ LL | m!((0usize, true), (0..5, true) | (5..=usize::MAX, true) | (0..=usize:: | ^^^^^^^^^^^^^^ pattern `(_, _)` not covered | = note: the matched value is of type `(usize, bool)` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding an arm to handle the `(_, _)` case | -LL | match $s { $($t)+ => {}, (_, _) => todo!() } - | +++++++++++++++++++ +LL | match $s { $($t)+ => {}, (_, _) => { todo!() } } + | +++++++++++++++++++++++ error[E0004]: match is non-exhaustive --> $DIR/pointer-sized-int.rs:31:8 @@ -91,10 +91,10 @@ LL | m!(0isize, isize::MIN..=isize::MAX); = note: the matched value is of type `isize` = note: `isize` does not have a fixed maximum value, so a wildcard `_` is necessary to match exhaustively = help: add `#![feature(precise_pointer_size_matching)]` to the crate attributes to enable precise `isize` matching -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding a wildcard arm | -LL | match $s { $($t)+ => {}, _ => todo!() } - | ++++++++++++++ +LL | match $s { $($t)+ => {}, _ => { todo!() } } + | ++++++++++++++++++ error[E0004]: match is non-exhaustive --> $DIR/pointer-sized-int.rs:33:8 @@ -105,10 +105,10 @@ LL | m!(0isize, isize::MIN..5 | 5..=isize::MAX); = note: the matched value is of type `isize` = note: `isize` does not have a fixed maximum value, so a wildcard `_` is necessary to match exhaustively = help: add `#![feature(precise_pointer_size_matching)]` to the crate attributes to enable precise `isize` matching -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding a wildcard arm | -LL | match $s { $($t)+ => {}, _ => todo!() } - | ++++++++++++++ +LL | match $s { $($t)+ => {}, _ => { todo!() } } + | ++++++++++++++++++ error[E0004]: match is non-exhaustive --> $DIR/pointer-sized-int.rs:35:8 @@ -119,10 +119,10 @@ LL | m!(0isize, isize::MIN..isize::MAX | isize::MAX); = note: the matched value is of type `isize` = note: `isize` does not have a fixed maximum value, so a wildcard `_` is necessary to match exhaustively = help: add `#![feature(precise_pointer_size_matching)]` to the crate attributes to enable precise `isize` matching -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding a wildcard arm | -LL | match $s { $($t)+ => {}, _ => todo!() } - | ++++++++++++++ +LL | match $s { $($t)+ => {}, _ => { todo!() } } + | ++++++++++++++++++ error[E0004]: match is non-exhaustive --> $DIR/pointer-sized-int.rs:37:8 @@ -131,10 +131,10 @@ LL | m!((0isize, true), (isize::MIN..5, true) | ^^^^^^^^^^^^^^ pattern `(_, _)` not covered | = note: the matched value is of type `(isize, bool)` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding an arm to handle the `(_, _)` case | -LL | match $s { $($t)+ => {}, (_, _) => todo!() } - | +++++++++++++++++++ +LL | match $s { $($t)+ => {}, (_, _) => { todo!() } } + | +++++++++++++++++++++++ error[E0004]: match is non-exhaustive --> $DIR/pointer-sized-int.rs:41:11 @@ -145,10 +145,10 @@ LL | match 0isize { = note: the matched value is of type `isize` = note: `isize` does not have a fixed maximum value, so a wildcard `_` is necessary to match exhaustively = help: add `#![feature(precise_pointer_size_matching)]` to the crate attributes to enable precise `isize` matching -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding a wildcard arm | LL ~ 1 ..= isize::MAX => {} -LL + _ => todo!() +LL + _ => { todo!() }, | error[E0004]: non-exhaustive patterns: type `usize` is non-empty diff --git a/tests/ui/pattern/usefulness/integer-ranges/precise_pointer_matching-message.stderr b/tests/ui/pattern/usefulness/integer-ranges/precise_pointer_matching-message.stderr index f950e01587334..fad806a99668a 100644 --- a/tests/ui/pattern/usefulness/integer-ranges/precise_pointer_matching-message.stderr +++ b/tests/ui/pattern/usefulness/integer-ranges/precise_pointer_matching-message.stderr @@ -7,10 +7,10 @@ LL | match 0usize { = note: the matched value is of type `usize` = note: `usize` does not have a fixed maximum value, so a wildcard `_` is necessary to match exhaustively = help: add `#![feature(precise_pointer_size_matching)]` to the crate attributes to enable precise `usize` matching -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding a wildcard arm | -LL ~ 0..=usize::MAX => {} -LL + _ => todo!() +LL ~ 0..=usize::MAX => {}, +LL + _ => { todo!() }, | error[E0004]: match is non-exhaustive @@ -22,10 +22,10 @@ LL | match 0isize { = note: the matched value is of type `isize` = note: `isize` does not have a fixed maximum value, so a wildcard `_` is necessary to match exhaustively = help: add `#![feature(precise_pointer_size_matching)]` to the crate attributes to enable precise `isize` matching -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding a wildcard arm | -LL ~ isize::MIN..=isize::MAX => {} -LL + _ => todo!() +LL ~ isize::MIN..=isize::MAX => {}, +LL + _ => { todo!() }, | error: aborting due to 2 previous errors diff --git a/tests/ui/pattern/usefulness/issue-15129.stderr b/tests/ui/pattern/usefulness/issue-15129.stderr index 9b91c806d39e7..5cf998d72f4eb 100644 --- a/tests/ui/pattern/usefulness/issue-15129.stderr +++ b/tests/ui/pattern/usefulness/issue-15129.stderr @@ -5,10 +5,11 @@ LL | match (T::T1(()), V::V2(true)) { | ^^^^^^^^^^^^^^^^^^^^^^^^ patterns `(T::T1(()), V::V2(_))` and `(T::T2(()), V::V1(_))` not covered | = note: the matched value is of type `(T, V)` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms +help: ensure that all possible cases are being handled by adding more match arms | LL ~ (T::T2(()), V::V2(b)) => (), -LL ~ (T::T1(()), V::V2(_)) | (T::T2(()), V::V1(_)) => todo!(), +LL + (T::T1(()), V::V2(_)) => { todo!() }, +LL + (T::T2(()), V::V1(_)) => { todo!() }, | error: aborting due to previous error diff --git a/tests/ui/pattern/usefulness/issue-2111.stderr b/tests/ui/pattern/usefulness/issue-2111.stderr index 226c29c995de8..79fbe0d165f33 100644 --- a/tests/ui/pattern/usefulness/issue-2111.stderr +++ b/tests/ui/pattern/usefulness/issue-2111.stderr @@ -5,10 +5,11 @@ LL | match (a, b) { | ^^^^^^ patterns `(None, None)` and `(Some(_), Some(_))` not covered | = note: the matched value is of type `(Option, Option)` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms +help: ensure that all possible cases are being handled by adding more match arms | LL ~ (Some(_), None) | (None, Some(_)) => {} -LL + (None, None) | (Some(_), Some(_)) => todo!() +LL + (None, None) => { todo!() }, +LL + (Some(_), Some(_)) => { todo!() }, | error: aborting due to previous error diff --git a/tests/ui/pattern/usefulness/issue-30240.stderr b/tests/ui/pattern/usefulness/issue-30240.stderr index 0b4c8bd585063..f82c44ed585de 100644 --- a/tests/ui/pattern/usefulness/issue-30240.stderr +++ b/tests/ui/pattern/usefulness/issue-30240.stderr @@ -5,10 +5,10 @@ LL | match "world" { | ^^^^^^^ pattern `&_` not covered | = note: the matched value is of type `&str` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding an arm to handle the `&_` case | -LL ~ "hello" => {} -LL + &_ => todo!() +LL ~ "hello" => {}, +LL + &_ => { todo!() }, | error[E0004]: match is non-exhaustive @@ -18,10 +18,10 @@ LL | match "world" { | ^^^^^^^ pattern `&_` not covered | = note: the matched value is of type `&str` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding an arm to handle the `&_` case | LL ~ "hello" => {} -LL + &_ => todo!() +LL + &_ => { todo!() }, | error: aborting due to 2 previous errors diff --git a/tests/ui/pattern/usefulness/issue-35609.stderr b/tests/ui/pattern/usefulness/issue-35609.stderr index 16e2bd73cb91e..026400f8fe33f 100644 --- a/tests/ui/pattern/usefulness/issue-35609.stderr +++ b/tests/ui/pattern/usefulness/issue-35609.stderr @@ -5,10 +5,13 @@ LL | match (A, ()) { | ^^^^^^^ patterns `(Enum::B, _)`, `(Enum::C, _)`, `(Enum::D, _)` and 2 more not covered | = note: the matched value is of type `(Enum, ())` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown, or multiple match arms +help: ensure that all possible cases are being handled by adding more match arms | -LL ~ (A, _) => {} -LL + _ => todo!() +LL ~ (A, _) => {}, +LL + (Enum::B, _) => { todo!() }, +LL + (Enum::C, _) => { todo!() }, +LL + (Enum::D, _) => { todo!() }, +LL + _ => { todo!() }, | error[E0004]: match is non-exhaustive @@ -18,10 +21,13 @@ LL | match (A, A) { | ^^^^^^ patterns `(_, Enum::B)`, `(_, Enum::C)`, `(_, Enum::D)` and 2 more not covered | = note: the matched value is of type `(Enum, Enum)` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown, or multiple match arms +help: ensure that all possible cases are being handled by adding more match arms | -LL ~ (_, A) => {} -LL + _ => todo!() +LL ~ (_, A) => {}, +LL + (_, Enum::B) => { todo!() }, +LL + (_, Enum::C) => { todo!() }, +LL + (_, Enum::D) => { todo!() }, +LL + _ => { todo!() }, | error[E0004]: match is non-exhaustive @@ -31,10 +37,13 @@ LL | match ((A, ()), ()) { | ^^^^^^^^^^^^^ patterns `((Enum::B, _), _)`, `((Enum::C, _), _)`, `((Enum::D, _), _)` and 2 more not covered | = note: the matched value is of type `((Enum, ()), ())` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown, or multiple match arms +help: ensure that all possible cases are being handled by adding more match arms | -LL ~ ((A, ()), _) => {} -LL + _ => todo!() +LL ~ ((A, ()), _) => {}, +LL + ((Enum::B, _), _) => { todo!() }, +LL + ((Enum::C, _), _) => { todo!() }, +LL + ((Enum::D, _), _) => { todo!() }, +LL + _ => { todo!() }, | error[E0004]: match is non-exhaustive @@ -44,10 +53,13 @@ LL | match ((A, ()), A) { | ^^^^^^^^^^^^ patterns `((Enum::B, _), _)`, `((Enum::C, _), _)`, `((Enum::D, _), _)` and 2 more not covered | = note: the matched value is of type `((Enum, ()), Enum)` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown, or multiple match arms +help: ensure that all possible cases are being handled by adding more match arms | -LL ~ ((A, ()), _) => {} -LL + _ => todo!() +LL ~ ((A, ()), _) => {}, +LL + ((Enum::B, _), _) => { todo!() }, +LL + ((Enum::C, _), _) => { todo!() }, +LL + ((Enum::D, _), _) => { todo!() }, +LL + _ => { todo!() }, | error[E0004]: match is non-exhaustive @@ -57,10 +69,13 @@ LL | match ((A, ()), ()) { | ^^^^^^^^^^^^^ patterns `((Enum::B, _), _)`, `((Enum::C, _), _)`, `((Enum::D, _), _)` and 2 more not covered | = note: the matched value is of type `((Enum, ()), ())` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown, or multiple match arms +help: ensure that all possible cases are being handled by adding more match arms | -LL ~ ((A, _), _) => {} -LL + _ => todo!() +LL ~ ((A, _), _) => {}, +LL + ((Enum::B, _), _) => { todo!() }, +LL + ((Enum::C, _), _) => { todo!() }, +LL + ((Enum::D, _), _) => { todo!() }, +LL + _ => { todo!() }, | error[E0004]: match is non-exhaustive @@ -75,10 +90,13 @@ note: `S` defined here LL | struct S(Enum, ()); | ^ = note: the matched value is of type `S` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown, or multiple match arms +help: ensure that all possible cases are being handled by adding more match arms | -LL ~ S(A, _) => {} -LL + _ => todo!() +LL ~ S(A, _) => {}, +LL + S(Enum::B, _) => { todo!() }, +LL + S(Enum::C, _) => { todo!() }, +LL + S(Enum::D, _) => { todo!() }, +LL + _ => { todo!() }, | error[E0004]: match is non-exhaustive @@ -93,10 +111,13 @@ note: `Sd` defined here LL | struct Sd { x: Enum, y: () } | ^^ = note: the matched value is of type `Sd` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown, or multiple match arms +help: ensure that all possible cases are being handled by adding more match arms | -LL ~ Sd { x: A, y: _ } => {} -LL + _ => todo!() +LL ~ Sd { x: A, y: _ } => {}, +LL + Sd { x: Enum::B, .. } => { todo!() }, +LL + Sd { x: Enum::C, .. } => { todo!() }, +LL + Sd { x: Enum::D, .. } => { todo!() }, +LL + _ => { todo!() }, | error[E0004]: match is non-exhaustive @@ -106,10 +127,13 @@ LL | match Some(A) { | ^^^^^^^ patterns `Some(Enum::B)`, `Some(Enum::C)`, `Some(Enum::D)` and 2 more not covered | = note: the matched value is of type `Option` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown, or multiple match arms +help: ensure that all possible cases are being handled by adding more match arms | LL ~ None => (), -LL + _ => todo!() +LL + Some(Enum::B) => { todo!() }, +LL + Some(Enum::C) => { todo!() }, +LL + Some(Enum::D) => { todo!() }, +LL + _ => { todo!() }, | error: aborting due to 8 previous errors diff --git a/tests/ui/pattern/usefulness/issue-3601.stderr b/tests/ui/pattern/usefulness/issue-3601.stderr index ba661e7a45a64..6021342b96ac3 100644 --- a/tests/ui/pattern/usefulness/issue-3601.stderr +++ b/tests/ui/pattern/usefulness/issue-3601.stderr @@ -5,10 +5,10 @@ LL | box NodeKind::Element(ed) => match ed.kind { | ^^^^^^^ pattern `box _` not covered | = note: the matched value is of type `Box` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding an arm to handle the `box _` case | -LL ~ box ElementKind::HTMLImageElement(ref d) if d.image.is_some() => { true } -LL + box _ => todo!() +LL ~ box ElementKind::HTMLImageElement(ref d) if d.image.is_some() => { true }, +LL + box _ => { todo!() }, | error: aborting due to previous error diff --git a/tests/ui/pattern/usefulness/issue-39362.stderr b/tests/ui/pattern/usefulness/issue-39362.stderr index b450a54f91052..4b585e8506ebd 100644 --- a/tests/ui/pattern/usefulness/issue-39362.stderr +++ b/tests/ui/pattern/usefulness/issue-39362.stderr @@ -12,10 +12,13 @@ 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 by adding a match arm with a wildcard pattern as shown, or multiple match arms +help: ensure that all possible cases are being handled by adding more match arms | LL ~ Foo::Bar { bar: Bar::B, .. } => (), -LL ~ _ => todo!(), +LL + Foo::Bar { bar: Bar::C, .. } => { todo!() }, +LL + Foo::Bar { bar: Bar::D, .. } => { todo!() }, +LL + Foo::Bar { bar: Bar::E, .. } => { todo!() }, +LL + Foo::Bar { bar: Bar::F, .. } => { todo!() }, | error: aborting due to previous error diff --git a/tests/ui/pattern/usefulness/issue-40221.stderr b/tests/ui/pattern/usefulness/issue-40221.stderr index 5a228ffd1d59a..5fd5088276b64 100644 --- a/tests/ui/pattern/usefulness/issue-40221.stderr +++ b/tests/ui/pattern/usefulness/issue-40221.stderr @@ -12,10 +12,10 @@ 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 by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding an arm to handle the `P::C(PC::QA)` case | LL ~ P::C(PC::Q) => (), -LL ~ P::C(PC::QA) => todo!(), +LL + P::C(PC::QA) => { todo!() }, | error: aborting due to previous error diff --git a/tests/ui/pattern/usefulness/issue-4321.stderr b/tests/ui/pattern/usefulness/issue-4321.stderr index db556de6f13a6..a472d7ab4c222 100644 --- a/tests/ui/pattern/usefulness/issue-4321.stderr +++ b/tests/ui/pattern/usefulness/issue-4321.stderr @@ -5,10 +5,10 @@ LL | println!("foo {:}", match tup { | ^^^ pattern `(true, false)` not covered | = note: the matched value is of type `(bool, bool)` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding an arm to handle the `(true, false)` case | LL ~ (true, true) => "baz", -LL + (true, false) => todo!() +LL + (true, false) => { todo!() }, | error: aborting due to previous error diff --git a/tests/ui/pattern/usefulness/issue-50900.stderr b/tests/ui/pattern/usefulness/issue-50900.stderr index 07f2e66d3764d..e5f246805d4ea 100644 --- a/tests/ui/pattern/usefulness/issue-50900.stderr +++ b/tests/ui/pattern/usefulness/issue-50900.stderr @@ -10,10 +10,10 @@ note: `Tag` defined here 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 by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding an arm to handle the `Tag(Context::Exif, _)` case | -LL ~ Tag::ExifIFDPointer => {} -LL + Tag(Context::Exif, _) => todo!() +LL ~ Tag::ExifIFDPointer => {}, +LL + Tag(Context::Exif, _) => { todo!() }, | error: aborting due to previous error diff --git a/tests/ui/pattern/usefulness/issue-56379.stderr b/tests/ui/pattern/usefulness/issue-56379.stderr index 0385f4f310b4e..04568a6b67ed1 100644 --- a/tests/ui/pattern/usefulness/issue-56379.stderr +++ b/tests/ui/pattern/usefulness/issue-56379.stderr @@ -16,10 +16,12 @@ LL | B(bool), LL | C(bool), | - not covered = note: the matched value is of type `Foo` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms +help: ensure that all possible cases are being handled by adding more match arms | LL ~ Foo::C(true) => {} -LL + Foo::A(false) | Foo::B(false) | Foo::C(false) => todo!() +LL + Foo::A(false) => { todo!() }, +LL + Foo::B(false) => { todo!() }, +LL + Foo::C(false) => { todo!() }, | error: aborting due to previous error diff --git a/tests/ui/pattern/usefulness/issue-72377.stderr b/tests/ui/pattern/usefulness/issue-72377.stderr index 97db8ec7ffce4..e34a3d47a85bc 100644 --- a/tests/ui/pattern/usefulness/issue-72377.stderr +++ b/tests/ui/pattern/usefulness/issue-72377.stderr @@ -5,10 +5,13 @@ LL | match (x, y) { | ^^^^^^ patterns `(X::A, Some(X::A))`, `(X::A, Some(X::B))`, `(X::B, Some(X::B))` and 2 more not covered | = note: the matched value is of type `(X, Option)` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown, or multiple match arms +help: ensure that all possible cases are being handled by adding more match arms | LL ~ (X::A, Some(X::C)) | (X::C, Some(X::A)) => false, -LL ~ _ => todo!(), +LL + (X::A, Some(X::A)) => { todo!() }, +LL + (X::A, Some(X::B)) => { todo!() }, +LL + (X::B, Some(X::B)) => { todo!() }, +LL + _ => { todo!() }, | error: aborting due to previous error diff --git a/tests/ui/pattern/usefulness/match-arm-statics-2.stderr b/tests/ui/pattern/usefulness/match-arm-statics-2.stderr index 4affd9c49ecf6..7b764e773adef 100644 --- a/tests/ui/pattern/usefulness/match-arm-statics-2.stderr +++ b/tests/ui/pattern/usefulness/match-arm-statics-2.stderr @@ -5,10 +5,10 @@ LL | match (true, false) { | ^^^^^^^^^^^^^ pattern `(true, false)` not covered | = note: the matched value is of type `(bool, bool)` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding an arm to handle the `(true, false)` case | LL ~ (false, true) => (), -LL + (true, false) => todo!() +LL + (true, false) => { todo!() }, | error[E0004]: match is non-exhaustive @@ -18,10 +18,10 @@ LL | match Some(Some(North)) { | ^^^^^^^^^^^^^^^^^ pattern `Some(Some(Direction::West))` not covered | = note: the matched value is of type `Option>` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding an arm to handle the `Some(Some(Direction::West))` case | LL ~ None => (), -LL + Some(Some(Direction::West)) => todo!() +LL + Some(Some(Direction::West)) => { todo!() }, | error[E0004]: match is non-exhaustive @@ -36,10 +36,10 @@ note: `Foo` defined here LL | struct Foo { | ^^^ = note: the matched value is of type `Foo` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding an arm to handle the `Foo { bar: Some(Direction::North), baz: NewBool(true) }` case | LL ~ Foo { bar: Some(EAST), .. } => (), -LL + Foo { bar: Some(Direction::North), baz: NewBool(true) } => todo!() +LL + Foo { bar: Some(Direction::North), baz: NewBool(true) } => { todo!() }, | error: aborting due to 3 previous errors diff --git a/tests/ui/pattern/usefulness/match-byte-array-patterns-2.stderr b/tests/ui/pattern/usefulness/match-byte-array-patterns-2.stderr index 6068063e300c3..3b70ba517e975 100644 --- a/tests/ui/pattern/usefulness/match-byte-array-patterns-2.stderr +++ b/tests/ui/pattern/usefulness/match-byte-array-patterns-2.stderr @@ -5,10 +5,11 @@ LL | match buf { | ^^^ patterns `&[0_u8..=64_u8, _, _, _]` and `&[66_u8..=u8::MAX, _, _, _]` not covered | = note: the matched value is of type `&[u8; 4]` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms +help: ensure that all possible cases are being handled by adding more match arms | -LL ~ b"AAAA" => {} -LL + &[0_u8..=64_u8, _, _, _] | &[66_u8..=u8::MAX, _, _, _] => todo!() +LL ~ b"AAAA" => {}, +LL + &[0_u8..=64_u8, _, _, _] => { todo!() }, +LL + &[66_u8..=u8::MAX, _, _, _] => { todo!() }, | error[E0004]: match is non-exhaustive @@ -18,10 +19,13 @@ LL | match buf { | ^^^ patterns `&[]`, `&[_]`, `&[_, _]` and 2 more not covered | = note: the matched value is of type `&[u8]` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown, or multiple match arms +help: ensure that all possible cases are being handled by adding more match arms | -LL ~ b"AAAA" => {} -LL + _ => todo!() +LL ~ b"AAAA" => {}, +LL + &[] => { todo!() }, +LL + &[_] => { todo!() }, +LL + &[_, _] => { todo!() }, +LL + _ => { todo!() }, | error: aborting due to 2 previous errors diff --git a/tests/ui/pattern/usefulness/match-non-exhaustive.stderr b/tests/ui/pattern/usefulness/match-non-exhaustive.stderr index 56140e055b8e6..c3b90950ed258 100644 --- a/tests/ui/pattern/usefulness/match-non-exhaustive.stderr +++ b/tests/ui/pattern/usefulness/match-non-exhaustive.stderr @@ -5,10 +5,10 @@ LL | match 0 { 1 => () } | ^ patterns `i32::MIN..=0_i32` and `2_i32..=i32::MAX` not covered | = note: the matched value is of type `i32` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms +help: ensure that all possible cases are being handled by adding more match arms | -LL | match 0 { 1 => (), i32::MIN..=0_i32 | 2_i32..=i32::MAX => todo!() } - | ++++++++++++++++++++++++++++++++++++++++++++++++ +LL | match 0 { 1 => (), _ => { todo!() } } + | ++++++++++++++++++ error[E0004]: match is non-exhaustive --> $DIR/match-non-exhaustive.rs:3:11 @@ -17,10 +17,10 @@ LL | match 0 { 0 if false => () } | ^ pattern `_` not covered | = note: the matched value is of type `i32` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding a wildcard arm | -LL | match 0 { 0 if false => (), _ => todo!() } - | ++++++++++++++ +LL | match 0 { 0 if false => (), _ => { todo!() } } + | ++++++++++++++++++ error: aborting due to 2 previous errors diff --git a/tests/ui/pattern/usefulness/match-privately-empty.stderr b/tests/ui/pattern/usefulness/match-privately-empty.stderr index 7c71b83c8ed10..bd4d900743c4c 100644 --- a/tests/ui/pattern/usefulness/match-privately-empty.stderr +++ b/tests/ui/pattern/usefulness/match-privately-empty.stderr @@ -5,10 +5,10 @@ LL | match private::DATA { | ^^^^^^^^^^^^^ pattern `Some(Private { misc: true, .. })` not covered | = note: the matched value is of type `Option` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding an arm to handle the `Some(Private { misc: true, .. })` case | LL ~ }) => {} -LL + Some(Private { misc: true, .. }) => todo!() +LL + Some(Private { misc: true, .. }) => { todo!() }, | error: aborting due to previous error diff --git a/tests/ui/pattern/usefulness/match-slice-patterns.stderr b/tests/ui/pattern/usefulness/match-slice-patterns.stderr index 516d58d4c8b8a..7065195286763 100644 --- a/tests/ui/pattern/usefulness/match-slice-patterns.stderr +++ b/tests/ui/pattern/usefulness/match-slice-patterns.stderr @@ -5,10 +5,10 @@ LL | match list { | ^^^^ pattern `&[_, Some(_), .., None, _]` not covered | = note: the matched value is of type `&[Option<()>]` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding an arm to handle the `&[_, Some(_), .., None, _]` case | LL ~ &[.., Some(_), _] => {} -LL ~ &[_, Some(_), .., None, _] => todo!(), +LL + &[_, Some(_), .., None, _] => { todo!() }, | error: aborting due to previous error diff --git a/tests/ui/pattern/usefulness/non-exhaustive-defined-here.stderr b/tests/ui/pattern/usefulness/non-exhaustive-defined-here.stderr index 0785d98bc900d..cc0ab25c9a2a0 100644 --- a/tests/ui/pattern/usefulness/non-exhaustive-defined-here.stderr +++ b/tests/ui/pattern/usefulness/non-exhaustive-defined-here.stderr @@ -16,10 +16,11 @@ LL | B, LL | C | - not covered = note: the matched value is of type `E` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms +help: ensure that all possible cases are being handled by adding more match arms | -LL ~ E::A => {} -LL + E::B | E::C => todo!() +LL ~ E::A => {}, +LL + E::B => { todo!() }, +LL + E::C => { todo!() }, | error[E0005]: refutable pattern in local binding @@ -65,10 +66,11 @@ LL | B, LL | C | - not covered = note: the matched value is of type `&E` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms +help: ensure that all possible cases are being handled by adding more match arms | -LL ~ E::A => {} -LL + &E::B | &E::C => todo!() +LL ~ E::A => {}, +LL + &E::B => { todo!() }, +LL + &E::C => { todo!() }, | error[E0005]: refutable pattern in local binding @@ -114,10 +116,11 @@ LL | B, LL | C | - not covered = note: the matched value is of type `&&mut &E` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms +help: ensure that all possible cases are being handled by adding more match arms | -LL ~ E::A => {} -LL + &&mut &E::B | &&mut &E::C => todo!() +LL ~ E::A => {}, +LL + &&mut &E::B => { todo!() }, +LL + &&mut &E::C => { todo!() }, | error[E0005]: refutable pattern in local binding @@ -160,10 +163,10 @@ LL | enum Opt { LL | None, | ---- not covered = note: the matched value is of type `Opt` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding an arm to handle the `Opt::None` case | -LL ~ Opt::Some(ref _x) => {} -LL + Opt::None => todo!() +LL ~ Opt::Some(ref _x) => {}, +LL + Opt::None => { todo!() }, | error[E0005]: refutable pattern in local binding diff --git a/tests/ui/pattern/usefulness/non-exhaustive-match-nested.stderr b/tests/ui/pattern/usefulness/non-exhaustive-match-nested.stderr index 0ed436b301aa7..5d10463a8be54 100644 --- a/tests/ui/pattern/usefulness/non-exhaustive-match-nested.stderr +++ b/tests/ui/pattern/usefulness/non-exhaustive-match-nested.stderr @@ -5,10 +5,10 @@ LL | match (l1, l2) { | ^^^^^^^^ pattern `(Some(&[]), Err(_))` not covered | = note: the matched value is of type `(Option<&[T]>, Result<&[T], ()>)` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding an arm to handle the `(Some(&[]), Err(_))` case | LL ~ (None, Ok(&[_, _, ..])) => "None, Ok(at least two elements)", -LL + (Some(&[]), Err(_)) => todo!() +LL + (Some(&[]), Err(_)) => { todo!() }, | error[E0004]: match is non-exhaustive @@ -23,10 +23,10 @@ note: `T` defined here 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 by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding an arm to handle the `T::A(U::C)` case | LL ~ T::B => { panic!("goodbye"); } -LL + T::A(U::C) => todo!() +LL + T::A(U::C) => { todo!() }, | error: aborting due to 2 previous errors diff --git a/tests/ui/pattern/usefulness/non-exhaustive-match.stderr b/tests/ui/pattern/usefulness/non-exhaustive-match.stderr index 78f2918acdb2b..ec577073d7663 100644 --- a/tests/ui/pattern/usefulness/non-exhaustive-match.stderr +++ b/tests/ui/pattern/usefulness/non-exhaustive-match.stderr @@ -10,10 +10,10 @@ note: `T` defined here LL | enum T { A, B } | ^ - not covered = note: the matched value is of type `T` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding an arm to handle the `T::A` case | -LL | match x { T::B => { }, T::A => todo!() } - | +++++++++++++++++ +LL | match x { T::B => { }, T::A => { todo!() } } + | +++++++++++++++++++++ error[E0004]: match is non-exhaustive --> $DIR/non-exhaustive-match.rs:8:11 @@ -22,10 +22,10 @@ LL | match true { | ^^^^ pattern `false` not covered | = note: the matched value is of type `bool` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding an arm to handle the `false` case | -LL ~ true => {} -LL + false => todo!() +LL ~ true => {}, +LL + false => { todo!() }, | error[E0004]: match is non-exhaustive @@ -35,10 +35,10 @@ LL | match Some(10) { | ^^^^^^^^ pattern `Some(_)` not covered | = note: the matched value is of type `Option` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding an arm to handle the `Some(_)` case | -LL ~ None => {} -LL + Some(_) => todo!() +LL ~ None => {}, +LL + Some(_) => { todo!() }, | error[E0004]: match is non-exhaustive @@ -48,10 +48,11 @@ LL | match (2, 3, 4) { | ^^^^^^^^^ patterns `(_, _, i32::MIN..=3_i32)` and `(_, _, 5_i32..=i32::MAX)` not covered | = note: the matched value is of type `(i32, i32, i32)` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms +help: ensure that all possible cases are being handled by adding more match arms | -LL ~ (_, _, 4) => {} -LL + (_, _, i32::MIN..=3_i32) | (_, _, 5_i32..=i32::MAX) => todo!() +LL ~ (_, _, 4) => {}, +LL + (_, _, i32::MIN..=3_i32) => { todo!() }, +LL + (_, _, 5_i32..=i32::MAX) => { todo!() }, | error[E0004]: match is non-exhaustive @@ -61,10 +62,11 @@ LL | match (T::A, T::A) { | ^^^^^^^^^^^^ patterns `(T::A, T::A)` and `(T::B, T::B)` not covered | = note: the matched value is of type `(T, T)` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms +help: ensure that all possible cases are being handled by adding more match arms | LL ~ (T::B, T::A) => {} -LL + (T::A, T::A) | (T::B, T::B) => todo!() +LL + (T::A, T::A) => { todo!() }, +LL + (T::B, T::B) => { todo!() }, | error[E0004]: match is non-exhaustive @@ -79,10 +81,10 @@ note: `T` defined here LL | enum T { A, B } | ^ - not covered = note: the matched value is of type `T` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding an arm to handle the `T::B` case | -LL ~ T::A => {} -LL + T::B => todo!() +LL ~ T::A => {}, +LL + T::B => { todo!() }, | error[E0004]: match is non-exhaustive @@ -92,10 +94,10 @@ LL | match *vec { | ^^^^ pattern `[]` not covered | = note: the matched value is of type `[Option]` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding an arm to handle the `[]` case | LL ~ [None] => {} -LL + [] => todo!() +LL + [] => { todo!() }, | error[E0004]: match is non-exhaustive @@ -105,10 +107,10 @@ LL | match *vec { | ^^^^ pattern `[_, _, _, _, ..]` not covered | = note: the matched value is of type `[f32]` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding an arm to handle the `[_, _, _, _, ..]` case | LL ~ [] => (), -LL + [_, _, _, _, ..] => todo!() +LL + [_, _, _, _, ..] => { todo!() }, | error: aborting due to 8 previous errors diff --git a/tests/ui/pattern/usefulness/non-exhaustive-pattern-witness.stderr b/tests/ui/pattern/usefulness/non-exhaustive-pattern-witness.stderr index ec06c010df11b..fb8d37af02726 100644 --- a/tests/ui/pattern/usefulness/non-exhaustive-pattern-witness.stderr +++ b/tests/ui/pattern/usefulness/non-exhaustive-pattern-witness.stderr @@ -10,10 +10,10 @@ note: `Foo` defined here LL | struct Foo { | ^^^ = note: the matched value is of type `Foo` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding an arm to handle the `Foo { first: false, second: Some([_, _, _, _]) }` case | LL ~ Foo { first: false, second: Some([1, 2, 3, 4]) } => (), -LL + Foo { first: false, second: Some([_, _, _, _]) } => todo!() +LL + Foo { first: false, second: Some([_, _, _, _]) } => { todo!() }, | error[E0004]: match is non-exhaustive @@ -30,10 +30,10 @@ LL | enum Color { LL | Red, | --- not covered = note: the matched value is of type `Color` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding an arm to handle the `Color::Red` case | LL ~ Color::Green => (), -LL + Color::Red => todo!() +LL + Color::Red => { todo!() }, | error[E0004]: match is non-exhaustive @@ -53,10 +53,12 @@ LL | North, East, South, West | | not covered | not covered = note: the matched value is of type `Direction` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms +help: ensure that all possible cases are being handled by adding more match arms | LL ~ Direction::North => (), -LL + Direction::East | Direction::South | Direction::West => todo!() +LL + Direction::East => { todo!() }, +LL + Direction::South => { todo!() }, +LL + Direction::West => { todo!() }, | error[E0004]: match is non-exhaustive @@ -78,10 +80,13 @@ LL | First, Second, Third, Fourth, Fifth, Sixth, Seventh, Eighth, Ninth, Ten | | not covered | not covered = note: the matched value is of type `ExcessiveEnum` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown, or multiple match arms +help: ensure that all possible cases are being handled by adding more match arms | LL ~ ExcessiveEnum::First => (), -LL + _ => todo!() +LL + ExcessiveEnum::Second => { todo!() }, +LL + ExcessiveEnum::Third => { todo!() }, +LL + ExcessiveEnum::Fourth => { todo!() }, +LL + _ => { todo!() }, | error[E0004]: match is non-exhaustive @@ -99,10 +104,10 @@ 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 by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding an arm to handle the `Color::CustomRGBA { a: true, .. }` case | LL ~ Color::CustomRGBA { a: false, r: _, g: _, b: _ } => (), -LL + Color::CustomRGBA { a: true, .. } => todo!() +LL + Color::CustomRGBA { a: true, .. } => { todo!() }, | error[E0004]: match is non-exhaustive @@ -112,10 +117,10 @@ LL | match *x { | ^^ pattern `[Enum::Second(true), Enum::Second(false)]` not covered | = note: the matched value is of type `[Enum]` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding an arm to handle the `[Enum::Second(true), Enum::Second(false)]` case | LL ~ [_, _, ref tail @ .., _] => (), -LL + [Enum::Second(true), Enum::Second(false)] => todo!() +LL + [Enum::Second(true), Enum::Second(false)] => { todo!() }, | error[E0004]: match is non-exhaustive @@ -125,10 +130,10 @@ LL | match ((), false) { | ^^^^^^^^^^^ pattern `((), false)` not covered | = note: the matched value is of type `((), bool)` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding an arm to handle the `((), false)` case | LL ~ ((), true) => (), -LL + ((), false) => todo!() +LL + ((), false) => { todo!() }, | error: aborting due to 7 previous errors diff --git a/tests/ui/pattern/usefulness/slice-patterns-exhaustiveness.stderr b/tests/ui/pattern/usefulness/slice-patterns-exhaustiveness.stderr index e34f4c28ba7c7..dd8f154a5fcdb 100644 --- a/tests/ui/pattern/usefulness/slice-patterns-exhaustiveness.stderr +++ b/tests/ui/pattern/usefulness/slice-patterns-exhaustiveness.stderr @@ -5,10 +5,10 @@ LL | match s2 { | ^^ pattern `&[false, _]` not covered | = note: the matched value is of type `&[bool; 2]` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding an arm to handle the `&[false, _]` case | -LL ~ [true, .., true] => {} -LL + &[false, _] => todo!() +LL ~ [true, .., true] => {}, +LL + &[false, _] => { todo!() }, | error[E0004]: match is non-exhaustive @@ -18,10 +18,10 @@ LL | match s3 { | ^^ pattern `&[false, ..]` not covered | = note: the matched value is of type `&[bool; 3]` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding an arm to handle the `&[false, ..]` case | -LL ~ [true, .., true] => {} -LL + &[false, ..] => todo!() +LL ~ [true, .., true] => {}, +LL + &[false, ..] => { todo!() }, | error[E0004]: match is non-exhaustive @@ -31,10 +31,10 @@ LL | match s10 { | ^^^ pattern `&[false, ..]` not covered | = note: the matched value is of type `&[bool; 10]` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding an arm to handle the `&[false, ..]` case | -LL ~ [true, .., true] => {} -LL + &[false, ..] => todo!() +LL ~ [true, .., true] => {}, +LL + &[false, ..] => { todo!() }, | error[E0004]: match is non-exhaustive @@ -44,10 +44,10 @@ LL | match s2 { | ^^ pattern `&[false, true]` not covered | = note: the matched value is of type `&[bool; 2]` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding an arm to handle the `&[false, true]` case | LL ~ [.., false] => {} -LL + &[false, true] => todo!() +LL + &[false, true] => { todo!() }, | error[E0004]: match is non-exhaustive @@ -57,10 +57,10 @@ LL | match s3 { | ^^ pattern `&[false, .., true]` not covered | = note: the matched value is of type `&[bool; 3]` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding an arm to handle the `&[false, .., true]` case | LL ~ [.., false] => {} -LL + &[false, .., true] => todo!() +LL + &[false, .., true] => { todo!() }, | error[E0004]: match is non-exhaustive @@ -70,10 +70,10 @@ LL | match s { | ^ pattern `&[false, .., true]` not covered | = note: the matched value is of type `&[bool]` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding an arm to handle the `&[false, .., true]` case | LL ~ [.., false] => {} -LL + &[false, .., true] => todo!() +LL + &[false, .., true] => { todo!() }, | error[E0004]: match is non-exhaustive @@ -83,10 +83,10 @@ LL | match s { | ^ pattern `&[_, ..]` not covered | = note: the matched value is of type `&[bool]` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding an arm to handle the `&[_, ..]` case | -LL ~ [] => {} -LL + &[_, ..] => todo!() +LL ~ [] => {}, +LL + &[_, ..] => { todo!() }, | error[E0004]: match is non-exhaustive @@ -96,10 +96,10 @@ LL | match s { | ^ pattern `&[_, _, ..]` not covered | = note: the matched value is of type `&[bool]` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding an arm to handle the `&[_, _, ..]` case | LL ~ [_] => {} -LL + &[_, _, ..] => todo!() +LL + &[_, _, ..] => { todo!() }, | error[E0004]: match is non-exhaustive @@ -109,10 +109,10 @@ LL | match s { | ^ pattern `&[false, ..]` not covered | = note: the matched value is of type `&[bool]` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding an arm to handle the `&[false, ..]` case | LL ~ [true, ..] => {} -LL + &[false, ..] => todo!() +LL + &[false, ..] => { todo!() }, | error[E0004]: match is non-exhaustive @@ -122,10 +122,10 @@ LL | match s { | ^ pattern `&[false, _, ..]` not covered | = note: the matched value is of type `&[bool]` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding an arm to handle the `&[false, _, ..]` case | LL ~ [true, ..] => {} -LL + &[false, _, ..] => todo!() +LL + &[false, _, ..] => { todo!() }, | error[E0004]: match is non-exhaustive @@ -135,10 +135,10 @@ LL | match s { | ^ pattern `&[_, .., false]` not covered | = note: the matched value is of type `&[bool]` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding an arm to handle the `&[_, .., false]` case | LL ~ [.., true] => {} -LL + &[_, .., false] => todo!() +LL + &[_, .., false] => { todo!() }, | error[E0004]: match is non-exhaustive @@ -148,10 +148,10 @@ LL | match s { | ^ pattern `&[_, _, .., true]` not covered | = note: the matched value is of type `&[bool]` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding an arm to handle the `&[_, _, .., true]` case | LL ~ [.., false] => {} -LL + &[_, _, .., true] => todo!() +LL + &[_, _, .., true] => { todo!() }, | error[E0004]: match is non-exhaustive @@ -161,10 +161,10 @@ LL | match s { | ^ pattern `&[true, _, .., _]` not covered | = note: the matched value is of type `&[bool]` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding an arm to handle the `&[true, _, .., _]` case | LL ~ [false, .., false] => {} -LL + &[true, _, .., _] => todo!() +LL + &[true, _, .., _] => { todo!() }, | error[E0004]: match is non-exhaustive @@ -174,10 +174,11 @@ LL | match s { | ^ patterns `&[]` and `&[_, _, ..]` not covered | = note: the matched value is of type `&[bool]` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms +help: ensure that all possible cases are being handled by adding more match arms | -LL ~ &[true] => {} -LL + &[] | &[_, _, ..] => todo!() +LL ~ &[true] => {}, +LL + &[] => { todo!() }, +LL + &[_, _, ..] => { todo!() }, | error[E0004]: match is non-exhaustive @@ -187,10 +188,11 @@ LL | match s { | ^ patterns `&[]` and `&[_, _, ..]` not covered | = note: the matched value is of type `&[bool]` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms +help: ensure that all possible cases are being handled by adding more match arms | -LL ~ CONST => {} -LL + &[] | &[_, _, ..] => todo!() +LL ~ CONST => {}, +LL + &[] => { todo!() }, +LL + &[_, _, ..] => { todo!() }, | error[E0004]: match is non-exhaustive @@ -200,10 +202,11 @@ LL | match s { | ^ patterns `&[]` and `&[_, _, ..]` not covered | = note: the matched value is of type `&[bool]` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms +help: ensure that all possible cases are being handled by adding more match arms | LL ~ &[false] => {} -LL + &[] | &[_, _, ..] => todo!() +LL + &[] => { todo!() }, +LL + &[_, _, ..] => { todo!() }, | error[E0004]: match is non-exhaustive @@ -213,10 +216,11 @@ LL | match s { | ^ patterns `&[]` and `&[_, _, ..]` not covered | = note: the matched value is of type `&[bool]` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms +help: ensure that all possible cases are being handled by adding more match arms | LL ~ CONST => {} -LL + &[] | &[_, _, ..] => todo!() +LL + &[] => { todo!() }, +LL + &[_, _, ..] => { todo!() }, | error[E0004]: match is non-exhaustive @@ -226,10 +230,10 @@ LL | match s { | ^ pattern `&[_, _, ..]` not covered | = note: the matched value is of type `&[bool]` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding an arm to handle the `&[_, _, ..]` case | LL ~ CONST => {} -LL + &[_, _, ..] => todo!() +LL + &[_, _, ..] => { todo!() }, | error[E0004]: match is non-exhaustive @@ -239,10 +243,10 @@ LL | match s { | ^ pattern `&[false]` not covered | = note: the matched value is of type `&[bool]` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding an arm to handle the `&[false]` case | LL ~ &[_, _, ..] => {} -LL + &[false] => todo!() +LL + &[false] => { todo!() }, | error[E0004]: match is non-exhaustive @@ -252,10 +256,10 @@ LL | match s1 { | ^^ pattern `&[false]` not covered | = note: the matched value is of type `&[bool; 1]` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding an arm to handle the `&[false]` case | -LL ~ CONST1 => {} -LL + &[false] => todo!() +LL ~ CONST1 => {}, +LL + &[false] => { todo!() }, | error: aborting due to 20 previous errors diff --git a/tests/ui/pattern/usefulness/stable-gated-patterns.stderr b/tests/ui/pattern/usefulness/stable-gated-patterns.stderr index ae1a8f7fe3eea..f452c53bb01ae 100644 --- a/tests/ui/pattern/usefulness/stable-gated-patterns.stderr +++ b/tests/ui/pattern/usefulness/stable-gated-patterns.stderr @@ -5,10 +5,11 @@ LL | match UnstableEnum::Stable { | ^^^^^^^^^^^^^^^^^^^^ patterns `UnstableEnum::Stable2` and `_` not covered | = note: the matched value is of type `UnstableEnum` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms +help: ensure that all possible cases are being handled by adding more match arms | -LL ~ UnstableEnum::Stable => {} -LL + UnstableEnum::Stable2 | _ => todo!() +LL ~ UnstableEnum::Stable => {}, +LL + UnstableEnum::Stable2 => { todo!() }, +LL + _ => { todo!() }, | error[E0004]: match is non-exhaustive @@ -18,10 +19,10 @@ LL | match UnstableEnum::Stable { | ^^^^^^^^^^^^^^^^^^^^ pattern `_` not covered | = note: the matched value is of type `UnstableEnum` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding a wildcard arm | LL ~ UnstableEnum::Stable2 => {} -LL + _ => todo!() +LL + _ => { todo!() }, | error: aborting due to 2 previous errors diff --git a/tests/ui/pattern/usefulness/struct-like-enum-nonexhaustive.stderr b/tests/ui/pattern/usefulness/struct-like-enum-nonexhaustive.stderr index 0e0d89c210093..b8400312c9d92 100644 --- a/tests/ui/pattern/usefulness/struct-like-enum-nonexhaustive.stderr +++ b/tests/ui/pattern/usefulness/struct-like-enum-nonexhaustive.stderr @@ -12,10 +12,10 @@ 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 by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding an arm to handle the `A::B { x: Some(_) }` case | LL ~ A::B { x: None } => {} -LL + A::B { x: Some(_) } => todo!() +LL + A::B { x: Some(_) } => { todo!() }, | error: aborting due to previous error diff --git a/tests/ui/pattern/usefulness/tuple-struct-nonexhaustive.stderr b/tests/ui/pattern/usefulness/tuple-struct-nonexhaustive.stderr index c56213ecb5654..cabdf2eb9431c 100644 --- a/tests/ui/pattern/usefulness/tuple-struct-nonexhaustive.stderr +++ b/tests/ui/pattern/usefulness/tuple-struct-nonexhaustive.stderr @@ -10,10 +10,10 @@ note: `Foo` defined here LL | struct Foo(isize, isize); | ^^^ = note: the matched value is of type `Foo` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding an arm to handle the `Foo(_, _)` case | LL ~ Foo(2, b) => println!("{}", b), -LL + Foo(_, _) => todo!() +LL + Foo(_, _) => { todo!() }, | error: aborting due to previous error diff --git a/tests/ui/pattern/usefulness/type_polymorphic_byte_str_literals.stderr b/tests/ui/pattern/usefulness/type_polymorphic_byte_str_literals.stderr index f7bbe1ed18d2f..5e2ac53b95c0f 100644 --- a/tests/ui/pattern/usefulness/type_polymorphic_byte_str_literals.stderr +++ b/tests/ui/pattern/usefulness/type_polymorphic_byte_str_literals.stderr @@ -5,10 +5,10 @@ LL | match data { | ^^^^ pattern `&[_, ..]` not covered | = note: the matched value is of type `&[u8]` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding an arm to handle the `&[_, ..]` case | LL ~ b"" => 1, -LL ~ &[_, ..] => todo!(), +LL + &[_, ..] => { todo!() }, | error[E0004]: match is non-exhaustive @@ -18,10 +18,13 @@ LL | match data { | ^^^^ patterns `&[]`, `&[_]`, `&[_, _]` and 1 more not covered | = note: the matched value is of type `&[u8]` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown, or multiple match arms +help: ensure that all possible cases are being handled by adding more match arms | LL ~ [_, _, _] => 1, -LL ~ _ => todo!(), +LL + &[] => { todo!() }, +LL + &[_] => { todo!() }, +LL + &[_, _] => { todo!() }, +LL + &[_, _, _, _, ..] => { todo!() }, | error: aborting due to 2 previous errors diff --git a/tests/ui/pattern/usefulness/unstable-gated-patterns.stderr b/tests/ui/pattern/usefulness/unstable-gated-patterns.stderr index 5a4a6265d74b1..41eab797418f9 100644 --- a/tests/ui/pattern/usefulness/unstable-gated-patterns.stderr +++ b/tests/ui/pattern/usefulness/unstable-gated-patterns.stderr @@ -5,10 +5,10 @@ LL | match UnstableEnum::Stable { | ^^^^^^^^^^^^^^^^^^^^ pattern `UnstableEnum::Unstable` not covered | = note: the matched value is of type `UnstableEnum` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding an arm to handle the `UnstableEnum::Unstable` case | LL ~ UnstableEnum::Stable2 => {} -LL + UnstableEnum::Unstable => todo!() +LL + UnstableEnum::Unstable => { todo!() }, | error: aborting due to previous error diff --git a/tests/ui/rfc-2005-default-binding-mode/slice.stderr b/tests/ui/rfc-2005-default-binding-mode/slice.stderr index c6150fe5c9283..4d87d7710fadb 100644 --- a/tests/ui/rfc-2005-default-binding-mode/slice.stderr +++ b/tests/ui/rfc-2005-default-binding-mode/slice.stderr @@ -5,10 +5,10 @@ LL | match sl { | ^^ pattern `&[]` not covered | = note: the matched value is of type `&[u8]` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding an arm to handle the `&[]` case | -LL ~ [first, remainder @ ..] => {} -LL ~ &[] => todo!(), +LL ~ [first, remainder @ ..] => {}, +LL + &[] => { todo!() }, | error: aborting due to previous error diff --git a/tests/ui/rfc-2008-non-exhaustive/enum.stderr b/tests/ui/rfc-2008-non-exhaustive/enum.stderr index f78803bcfe5ef..555c584dd4f99 100644 --- a/tests/ui/rfc-2008-non-exhaustive/enum.stderr +++ b/tests/ui/rfc-2008-non-exhaustive/enum.stderr @@ -24,10 +24,10 @@ LL | match enum_unit { | ^^^^^^^^^ pattern `_` not covered | = note: the matched value is of type `NonExhaustiveEnum`, which is marked as non-exhaustive -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding a wildcard arm | LL ~ NonExhaustiveEnum::Struct { .. } => "third", -LL + _ => todo!() +LL + _ => { todo!() }, | error[E0004]: match is non-exhaustive @@ -37,10 +37,10 @@ LL | match enum_unit {}; | ^^^^^^^^^ pattern `_` not covered | = note: the matched value is of type `NonExhaustiveEnum`, which is marked as non-exhaustive -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding a wildcard arm | LL ~ match enum_unit { -LL + _ => todo!(), +LL + _ => { todo!() }, LL ~ }; | diff --git a/tests/ui/rfc-2008-non-exhaustive/enum_same_crate_empty_match.stderr b/tests/ui/rfc-2008-non-exhaustive/enum_same_crate_empty_match.stderr index 02985fbc3664e..1e10f1db12c7d 100644 --- a/tests/ui/rfc-2008-non-exhaustive/enum_same_crate_empty_match.stderr +++ b/tests/ui/rfc-2008-non-exhaustive/enum_same_crate_empty_match.stderr @@ -30,10 +30,12 @@ LL | LL | Struct { field: u32 } | ------ not covered = note: the matched value is of type `NonExhaustiveEnum` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms +help: ensure that all possible cases are being handled by adding more match arms | LL ~ match NonExhaustiveEnum::Unit { -LL + NonExhaustiveEnum::Unit | NonExhaustiveEnum::Tuple(_) | NonExhaustiveEnum::Struct { .. } => todo!(), +LL + NonExhaustiveEnum::Unit => { todo!() }, +LL + NonExhaustiveEnum::Tuple(_) => { todo!() }, +LL + NonExhaustiveEnum::Struct { .. } => { todo!() }, LL + } | @@ -57,10 +59,12 @@ LL | LL | Struct { field: u32 } | ------ not covered = note: the matched value is of type `NormalEnum` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms +help: ensure that all possible cases are being handled by adding more match arms | LL ~ match NormalEnum::Unit { -LL + NormalEnum::Unit | NormalEnum::Tuple(_) | NormalEnum::Struct { .. } => todo!(), +LL + NormalEnum::Unit => { todo!() }, +LL + NormalEnum::Tuple(_) => { todo!() }, +LL + NormalEnum::Struct { .. } => { todo!() }, LL + } | diff --git a/tests/ui/rfc-2008-non-exhaustive/uninhabited/match.stderr b/tests/ui/rfc-2008-non-exhaustive/uninhabited/match.stderr index 6fbef340beed5..1d15bc598a9eb 100644 --- a/tests/ui/rfc-2008-non-exhaustive/uninhabited/match.stderr +++ b/tests/ui/rfc-2008-non-exhaustive/uninhabited/match.stderr @@ -62,10 +62,11 @@ LL | match x {} | ^ patterns `UninhabitedVariants::Tuple(_)` and `UninhabitedVariants::Struct { .. }` not covered | = note: the matched value is of type `UninhabitedVariants` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms +help: ensure that all possible cases are being handled by adding more match arms | LL ~ match x { -LL + UninhabitedVariants::Tuple(_) | UninhabitedVariants::Struct { .. } => todo!(), +LL + UninhabitedVariants::Tuple(_) => { todo!() }, +LL + UninhabitedVariants::Struct { .. } => { todo!() }, LL ~ } | diff --git a/tests/ui/rfc-2008-non-exhaustive/uninhabited/match_same_crate.stderr b/tests/ui/rfc-2008-non-exhaustive/uninhabited/match_same_crate.stderr index 7b6150b6ddc6e..a9404351a706a 100644 --- a/tests/ui/rfc-2008-non-exhaustive/uninhabited/match_same_crate.stderr +++ b/tests/ui/rfc-2008-non-exhaustive/uninhabited/match_same_crate.stderr @@ -52,10 +52,11 @@ LL | #[non_exhaustive] Tuple(!), LL | #[non_exhaustive] Struct { x: ! } | ------ not covered = note: the matched value is of type `UninhabitedVariants` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms +help: ensure that all possible cases are being handled by adding more match arms | LL ~ match x { -LL + UninhabitedVariants::Tuple(_) | UninhabitedVariants::Struct { .. } => todo!(), +LL + UninhabitedVariants::Tuple(_) => { todo!() }, +LL + UninhabitedVariants::Struct { .. } => { todo!() }, LL ~ } | diff --git a/tests/ui/rfc-2008-non-exhaustive/uninhabited/match_with_exhaustive_patterns.stderr b/tests/ui/rfc-2008-non-exhaustive/uninhabited/match_with_exhaustive_patterns.stderr index b9e86f56f28ff..8d0d6c736247c 100644 --- a/tests/ui/rfc-2008-non-exhaustive/uninhabited/match_with_exhaustive_patterns.stderr +++ b/tests/ui/rfc-2008-non-exhaustive/uninhabited/match_with_exhaustive_patterns.stderr @@ -62,10 +62,11 @@ LL | match x {} | ^ patterns `UninhabitedVariants::Tuple(_)` and `UninhabitedVariants::Struct { .. }` not covered | = note: the matched value is of type `UninhabitedVariants` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms +help: ensure that all possible cases are being handled by adding more match arms | LL ~ match x { -LL + UninhabitedVariants::Tuple(_) | UninhabitedVariants::Struct { .. } => todo!(), +LL + UninhabitedVariants::Tuple(_) => { todo!() }, +LL + UninhabitedVariants::Struct { .. } => { todo!() }, LL ~ } | diff --git a/tests/ui/uninhabited/uninhabited-matches-feature-gated.stderr b/tests/ui/uninhabited/uninhabited-matches-feature-gated.stderr index 6f921706333bf..4b988bf07b354 100644 --- a/tests/ui/uninhabited/uninhabited-matches-feature-gated.stderr +++ b/tests/ui/uninhabited/uninhabited-matches-feature-gated.stderr @@ -5,10 +5,10 @@ LL | let _ = match x { | ^ pattern `Err(_)` not covered | = note: the matched value is of type `Result` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding an arm to handle the `Err(_)` case | LL ~ Ok(n) => n, -LL ~ Err(_) => todo!(), +LL + Err(_) => { todo!() }, | error[E0004]: non-exhaustive patterns: type `&Void` is non-empty @@ -66,10 +66,10 @@ LL | let _ = match x { | ^ pattern `&[_, ..]` not covered | = note: the matched value is of type `&[Void]` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding an arm to handle the `&[_, ..]` case | LL ~ &[] => (), -LL ~ &[_, ..] => todo!(), +LL + &[_, ..] => { todo!() }, | error[E0004]: match is non-exhaustive @@ -79,10 +79,10 @@ LL | let _ = match x { | ^ pattern `Err(_)` not covered | = note: the matched value is of type `Result` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown +help: ensure that all possible cases are being handled by adding an arm to handle the `Err(_)` case | LL ~ Ok(x) => x, -LL ~ Err(_) => todo!(), +LL + Err(_) => { todo!() }, | error[E0005]: refutable pattern in local binding From 3cfd34ce3d356f9c7d169c3555ccf82ba82d2255 Mon Sep 17 00:00:00 2001 From: mejrs <59372212+mejrs@users.noreply.github.com> Date: Thu, 23 Feb 2023 15:27:17 +0100 Subject: [PATCH 08/11] Fix up the rebase --- compiler/rustc_mir_build/src/errors.rs | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/compiler/rustc_mir_build/src/errors.rs b/compiler/rustc_mir_build/src/errors.rs index d2254b25aaad4..3475ed0ca48b8 100644 --- a/compiler/rustc_mir_build/src/errors.rs +++ b/compiler/rustc_mir_build/src/errors.rs @@ -1,8 +1,10 @@ use crate::{ fluent_generated as fluent, - thir::pattern::{deconstruct_pat::{Constructor, DeconstructedPat}, MatchCheckCtxt}, + thir::pattern::{ + deconstruct_pat::{Constructor, DeconstructedPat}, + MatchCheckCtxt, + }, }; -use rustc_errors::Handler; use rustc_errors::{ error_code, AddToDiagnostic, Applicability, Diagnostic, DiagnosticBuilder, ErrorGuaranteed, Handler, IntoDiagnostic, MultiSpan, SubdiagnosticMessage, @@ -391,9 +393,7 @@ impl<'a> IntoDiagnostic<'a> for NonExhaustivePatternsTypeNotEmpty<'_, '_, '_> { TypeNote::MarkedExhaustive { .. } => { diag.note(fluent::mir_build_type_note_non_exhaustive) } - TypeNote::NotMarkedExhaustive { .. } => { - diag.note(fluent::mir_build_type_note) - } + TypeNote::NotMarkedExhaustive { .. } => diag.note(fluent::mir_build_type_note), }; if self.ref_note.is_some() { @@ -858,7 +858,7 @@ impl<'tcx> AddToDiagnostic for AdtDefinedHere<'tcx> { diag.set_arg("ty", self.ty); let mut spans = MultiSpan::from(self.adt_def_span); - for Variant { span } in self.variants { + for span in self.variants { spans.push_span_label(span, fluent::mir_build_variant_defined_here); } @@ -1036,12 +1036,12 @@ impl<'tcx> AddToDiagnostic for ArmSuggestions<'tcx> { ArmSuggestions::OneLiner { suggest_msg, span, pattern } => { let suggestion = format!(", {pattern} => {{ todo!() }}"); let suggest_msg = match suggest_msg { - AddArmKind::Wildcard => rustc_errors::fluent::mir_build_suggest_wildcard_arm, + AddArmKind::Wildcard => fluent::mir_build_suggest_wildcard_arm, AddArmKind::Single { pat } => { diag.set_arg("pat", pat); - rustc_errors::fluent::mir_build_suggest_single_arm + fluent::mir_build_suggest_single_arm } - AddArmKind::Multiple => rustc_errors::fluent::mir_build_suggest_multiple_arms, + AddArmKind::Multiple => fluent::mir_build_suggest_multiple_arms, }; diag.span_suggestion_verbose( span, @@ -1059,12 +1059,12 @@ impl<'tcx> AddToDiagnostic for ArmSuggestions<'tcx> { arm_suggestions, } => { let suggest_msg = match suggest_msg { - AddArmKind::Wildcard => rustc_errors::fluent::mir_build_suggest_wildcard_arm, + AddArmKind::Wildcard => fluent::mir_build_suggest_wildcard_arm, AddArmKind::Single { pat } => { diag.set_arg("pat", pat); - rustc_errors::fluent::mir_build_suggest_single_arm + fluent::mir_build_suggest_single_arm } - AddArmKind::Multiple => rustc_errors::fluent::mir_build_suggest_multiple_arms, + AddArmKind::Multiple => fluent::mir_build_suggest_multiple_arms, }; let mut suggestion = String::new(); From 81f0c578dd46196c809b57e398c3b040ee343a53 Mon Sep 17 00:00:00 2001 From: mejrs <59372212+mejrs@users.noreply.github.com> Date: Fri, 24 Feb 2023 00:52:24 +0100 Subject: [PATCH 09/11] Avoid blowing the stack on large if else chains. --- compiler/rustc_mir_build/src/thir/pattern/check_match.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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 250105267583e..a6d45f29512fe 100644 --- a/compiler/rustc_mir_build/src/thir/pattern/check_match.rs +++ b/compiler/rustc_mir_build/src/thir/pattern/check_match.rs @@ -9,6 +9,7 @@ use crate::errors; use hir::{ExprKind, PatKind}; use rustc_arena::TypedArena; use rustc_ast::{LitKind, Mutability}; +use rustc_data_structures::stack::ensure_sufficient_stack; use rustc_hir as hir; use rustc_hir::def::*; use rustc_hir::def_id::DefId; @@ -55,7 +56,7 @@ struct MatchVisitor<'a, 'p, 'tcx> { impl<'tcx> Visitor<'tcx> for MatchVisitor<'_, '_, 'tcx> { fn visit_expr(&mut self, ex: &'tcx hir::Expr<'tcx>) { - intravisit::walk_expr(self, ex); + ensure_sufficient_stack(|| intravisit::walk_expr(self, ex)); match &ex.kind { hir::ExprKind::Match(scrut, arms, source) => { self.check_match(scrut, arms, *source, ex.span) From fa8de86560cef60c7c5efd41e28e962c630ff9c4 Mon Sep 17 00:00:00 2001 From: mejrs <59372212+mejrs@users.noreply.github.com> Date: Fri, 24 Feb 2023 02:02:52 +0100 Subject: [PATCH 10/11] Nix the commas --- compiler/rustc_mir_build/src/errors.rs | 4 +- .../src/thir/pattern/check_match.rs | 18 +++-- .../match/issue-88331.stderr | 8 +- .../const_in_pattern/incomplete-slice.stderr | 4 +- tests/ui/error-codes/E0004-2.stderr | 4 +- tests/ui/error-codes/E0004.stderr | 4 +- ...on_exhaustive_omitted_patterns_lint.stderr | 2 +- ...-gate-precise_pointer_size_matching.stderr | 8 +- tests/ui/issue-94866.stderr | 2 +- .../exhaustiveness-non-exhaustive.stderr | 12 +-- ...een-expanded-earlier-non-exhaustive.stderr | 6 +- ...e-missing-pattern-excluding-comments.fixed | 2 +- ...-missing-pattern-excluding-comments.stderr | 2 +- .../doc-hidden-non-exhaustive.stderr | 16 ++-- .../empty-match.exhaustive_patterns.stderr | 40 +++++----- .../usefulness/empty-match.normal.stderr | 40 +++++----- tests/ui/pattern/usefulness/floats.stderr | 4 +- tests/ui/pattern/usefulness/guards.stderr | 2 +- .../integer-ranges/exhaustiveness.stderr | 4 +- .../pointer-sized-int.deny.stderr | 10 +-- .../precise_pointer_matching-message.stderr | 8 +- .../ui/pattern/usefulness/issue-15129.stderr | 4 +- tests/ui/pattern/usefulness/issue-2111.stderr | 4 +- .../ui/pattern/usefulness/issue-30240.stderr | 6 +- .../ui/pattern/usefulness/issue-35609.stderr | 78 +++++++++---------- tests/ui/pattern/usefulness/issue-3601.stderr | 4 +- .../ui/pattern/usefulness/issue-39362.stderr | 8 +- .../ui/pattern/usefulness/issue-40221.stderr | 2 +- tests/ui/pattern/usefulness/issue-4321.stderr | 2 +- .../ui/pattern/usefulness/issue-50900.stderr | 4 +- .../ui/pattern/usefulness/issue-56379.stderr | 6 +- .../ui/pattern/usefulness/issue-72377.stderr | 8 +- .../usefulness/match-arm-statics-2.stderr | 6 +- .../match-byte-array-patterns-2.stderr | 16 ++-- .../usefulness/match-privately-empty.stderr | 2 +- .../usefulness/match-slice-patterns.stderr | 2 +- .../non-exhaustive-defined-here.stderr | 22 +++--- .../non-exhaustive-match-nested.stderr | 4 +- .../usefulness/non-exhaustive-match.stderr | 26 +++---- .../non-exhaustive-pattern-witness.stderr | 24 +++--- .../slice-patterns-exhaustiveness.stderr | 62 +++++++-------- .../usefulness/stable-gated-patterns.stderr | 8 +- .../struct-like-enum-nonexhaustive.stderr | 2 +- .../tuple-struct-nonexhaustive.stderr | 2 +- .../type_polymorphic_byte_str_literals.stderr | 10 +-- .../usefulness/unstable-gated-patterns.stderr | 2 +- .../slice.stderr | 4 +- tests/ui/rfc-2008-non-exhaustive/enum.stderr | 4 +- .../enum_same_crate_empty_match.stderr | 12 +-- .../uninhabited/match.stderr | 4 +- .../uninhabited/match_same_crate.stderr | 4 +- .../match_with_exhaustive_patterns.stderr | 4 +- .../uninhabited-matches-feature-gated.stderr | 6 +- 53 files changed, 278 insertions(+), 274 deletions(-) diff --git a/compiler/rustc_mir_build/src/errors.rs b/compiler/rustc_mir_build/src/errors.rs index 3475ed0ca48b8..8e2ca40e3b165 100644 --- a/compiler/rustc_mir_build/src/errors.rs +++ b/compiler/rustc_mir_build/src/errors.rs @@ -1081,10 +1081,10 @@ impl<'tcx> AddToDiagnostic for ArmSuggestions<'tcx> { }; for pattern in arm_suggestions.iter().take(truncate_at) { - writeln!(&mut suggestion, "{indentation}{pattern} => {{ todo!() }},").unwrap(); + writeln!(&mut suggestion, "{indentation}{pattern} => {{ todo!() }}").unwrap(); } if need_wildcard { - writeln!(&mut suggestion, "{indentation}_ => {{ todo!() }},").unwrap(); + writeln!(&mut suggestion, "{indentation}_ => {{ todo!() }}").unwrap(); } suggestion.push_str(&postfix); 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 a6d45f29512fe..e5e7b1db2ca2e 100644 --- a/compiler/rustc_mir_build/src/thir/pattern/check_match.rs +++ b/compiler/rustc_mir_build/src/thir/pattern/check_match.rs @@ -629,7 +629,7 @@ fn non_exhaustive_match<'p, 'tcx>( let mut suggestion_span = None; // If the user wrote something like `match x { 1 => 2 }`, we suggest something that stays a one-liner - let mut do_oneliner = false; + let mut is_oneliner = false; let sm = cx.tcx.sess.source_map(); match arms { @@ -644,14 +644,18 @@ fn non_exhaustive_match<'p, 'tcx>( postfix.push_str("}"); suggestion_span = Some(span.shrink_to_hi().with_hi(expr_span.hi())); } - [hir::Arm {span, ..}] => { + [hir::Arm {span, body, ..}] => { if let Some(indent) = sm.indentation_before(*span) && let Ok(with_trailing) = sm.span_extend_while(*span, |c| c.is_whitespace() || c == ',') - && sm.is_multiline(with_trailing) { - prefix.push_str(",\n"); + && sm.is_multiline(with_trailing) + { + if !(matches!(body.kind, hir::ExprKind::Block(..)) && span.eq_ctxt(body.span)) { + prefix.push_str(","); + } + prefix.push_str("\n"); indentation.push_str(&indent); } else { - do_oneliner = true; + is_oneliner = true; }; suggestion_span = Some(span.shrink_to_hi()); } @@ -663,7 +667,7 @@ fn non_exhaustive_match<'p, 'tcx>( prefix.push_str("\n"); indentation.push_str(&indent); } else { - do_oneliner = true; + is_oneliner = true; }; suggestion_span = Some(last.span.shrink_to_hi()); } @@ -671,7 +675,7 @@ fn non_exhaustive_match<'p, 'tcx>( } let suggest_arms = if let Some(span) = suggestion_span { - if do_oneliner { + if is_oneliner { errors::ArmSuggestions::OneLiner { span, pattern: if let [pat] = &*arm_suggestions { diff --git a/tests/ui/closures/2229_closure_analysis/match/issue-88331.stderr b/tests/ui/closures/2229_closure_analysis/match/issue-88331.stderr index 118b8fa4d3d63..aa6acec523b44 100644 --- a/tests/ui/closures/2229_closure_analysis/match/issue-88331.stderr +++ b/tests/ui/closures/2229_closure_analysis/match/issue-88331.stderr @@ -13,8 +13,8 @@ LL | pub struct Opcode(pub u8); help: ensure that all possible cases are being handled by adding more match arms | LL ~ Opcode::OP1 => unimplemented!(), -LL + Opcode(0_u8) => { todo!() }, -LL + Opcode(2_u8..=u8::MAX) => { todo!() }, +LL + Opcode(0_u8) => { todo!() } +LL + Opcode(2_u8..=u8::MAX) => { todo!() } | error[E0004]: match is non-exhaustive @@ -32,8 +32,8 @@ LL | pub struct Opcode2(Opcode); help: ensure that all possible cases are being handled by adding more match arms | LL ~ Opcode2::OP2=> unimplemented!(), -LL + Opcode2(Opcode(0_u8)) => { todo!() }, -LL + Opcode2(Opcode(2_u8..=u8::MAX)) => { todo!() }, +LL + Opcode2(Opcode(0_u8)) => { todo!() } +LL + Opcode2(Opcode(2_u8..=u8::MAX)) => { todo!() } | error: aborting due to 2 previous errors diff --git a/tests/ui/consts/const_in_pattern/incomplete-slice.stderr b/tests/ui/consts/const_in_pattern/incomplete-slice.stderr index 46b3cc8a5ca68..8e89bf34fe658 100644 --- a/tests/ui/consts/const_in_pattern/incomplete-slice.stderr +++ b/tests/ui/consts/const_in_pattern/incomplete-slice.stderr @@ -17,8 +17,8 @@ LL | match &[][..] { = note: the matched value is of type `&[E]` help: ensure that all possible cases are being handled by adding an arm to handle the `&_` case | -LL ~ E_SL => {}, -LL + &_ => { todo!() }, +LL ~ E_SL => {} +LL + &_ => { todo!() } | error: aborting due to previous error; 1 warning emitted diff --git a/tests/ui/error-codes/E0004-2.stderr b/tests/ui/error-codes/E0004-2.stderr index f91bef1f635e2..5b4388dc689c6 100644 --- a/tests/ui/error-codes/E0004-2.stderr +++ b/tests/ui/error-codes/E0004-2.stderr @@ -8,8 +8,8 @@ LL | match x { } help: ensure that all possible cases are being handled by adding more match arms | LL ~ match x { -LL + None => { todo!() }, -LL + Some(_) => { todo!() }, +LL + None => { todo!() } +LL + Some(_) => { todo!() } LL ~ } | diff --git a/tests/ui/error-codes/E0004.stderr b/tests/ui/error-codes/E0004.stderr index 85e9a61050235..b50c20f982525 100644 --- a/tests/ui/error-codes/E0004.stderr +++ b/tests/ui/error-codes/E0004.stderr @@ -14,8 +14,8 @@ LL | HastaLaVistaBaby, = note: the matched value is of type `Terminator` help: ensure that all possible cases are being handled by adding an arm to handle the `Terminator::HastaLaVistaBaby` case | -LL ~ Terminator::TalkToMyHand => {}, -LL + Terminator::HastaLaVistaBaby => { todo!() }, +LL ~ Terminator::TalkToMyHand => {} +LL + Terminator::HastaLaVistaBaby => { todo!() } | error: aborting due to previous error diff --git a/tests/ui/feature-gates/feature-gate-non_exhaustive_omitted_patterns_lint.stderr b/tests/ui/feature-gates/feature-gate-non_exhaustive_omitted_patterns_lint.stderr index 2dfe2ad7f1f6c..641f27c54ba92 100644 --- a/tests/ui/feature-gates/feature-gate-non_exhaustive_omitted_patterns_lint.stderr +++ b/tests/ui/feature-gates/feature-gate-non_exhaustive_omitted_patterns_lint.stderr @@ -116,7 +116,7 @@ LL | A, B, C, help: ensure that all possible cases are being handled by adding an arm to handle the `Foo::C` case | LL ~ Foo::B => {} -LL + Foo::C => { todo!() }, +LL + Foo::C => { todo!() } | error: aborting due to previous error; 10 warnings emitted diff --git a/tests/ui/feature-gates/feature-gate-precise_pointer_size_matching.stderr b/tests/ui/feature-gates/feature-gate-precise_pointer_size_matching.stderr index aeec10ec53263..4ae6a33e05856 100644 --- a/tests/ui/feature-gates/feature-gate-precise_pointer_size_matching.stderr +++ b/tests/ui/feature-gates/feature-gate-precise_pointer_size_matching.stderr @@ -9,8 +9,8 @@ LL | match 0usize { = help: add `#![feature(precise_pointer_size_matching)]` to the crate attributes to enable precise `usize` matching help: ensure that all possible cases are being handled by adding a wildcard arm | -LL ~ 0..=usize::MAX => {}, -LL + _ => { todo!() }, +LL ~ 0..=usize::MAX => {} +LL + _ => { todo!() } | error[E0004]: match is non-exhaustive @@ -24,8 +24,8 @@ LL | match 0isize { = help: add `#![feature(precise_pointer_size_matching)]` to the crate attributes to enable precise `isize` matching help: ensure that all possible cases are being handled by adding a wildcard arm | -LL ~ isize::MIN..=isize::MAX => {}, -LL + _ => { todo!() }, +LL ~ isize::MIN..=isize::MAX => {} +LL + _ => { todo!() } | error: aborting due to 2 previous errors diff --git a/tests/ui/issue-94866.stderr b/tests/ui/issue-94866.stderr index 748d5d9f1a48f..2a73f1b0268b7 100644 --- a/tests/ui/issue-94866.stderr +++ b/tests/ui/issue-94866.stderr @@ -13,7 +13,7 @@ LL | enum Enum { A, B } help: ensure that all possible cases are being handled by adding an arm to handle the `Enum::B` case | LL ~ Enum::A => m!(), -LL + Enum::B => { todo!() }, +LL + Enum::B => { todo!() } | error: aborting due to previous error diff --git a/tests/ui/or-patterns/exhaustiveness-non-exhaustive.stderr b/tests/ui/or-patterns/exhaustiveness-non-exhaustive.stderr index f93336a31fa53..410f726afc470 100644 --- a/tests/ui/or-patterns/exhaustiveness-non-exhaustive.stderr +++ b/tests/ui/or-patterns/exhaustiveness-non-exhaustive.stderr @@ -7,8 +7,8 @@ LL | match (0u8, 0u8) { = note: the matched value is of type `(u8, u8)` help: ensure that all possible cases are being handled by adding an arm to handle the `(2_u8..=u8::MAX, _)` case | -LL ~ (0 | 1, 2 | 3) => {}, -LL + (2_u8..=u8::MAX, _) => { todo!() }, +LL ~ (0 | 1, 2 | 3) => {} +LL + (2_u8..=u8::MAX, _) => { todo!() } | error[E0004]: match is non-exhaustive @@ -20,8 +20,8 @@ LL | match ((0u8,),) { = note: the matched value is of type `((u8,),)` help: ensure that all possible cases are being handled by adding an arm to handle the `((4_u8..=u8::MAX))` case | -LL ~ ((0 | 1,) | (2 | 3,),) => {}, -LL + ((4_u8..=u8::MAX)) => { todo!() }, +LL ~ ((0 | 1,) | (2 | 3,),) => {} +LL + ((4_u8..=u8::MAX)) => { todo!() } | error[E0004]: match is non-exhaustive @@ -33,8 +33,8 @@ LL | match (Some(0u8),) { = note: the matched value is of type `(Option,)` help: ensure that all possible cases are being handled by adding an arm to handle the `(Some(2_u8..=u8::MAX))` case | -LL ~ (None | Some(0 | 1),) => {}, -LL + (Some(2_u8..=u8::MAX)) => { todo!() }, +LL ~ (None | Some(0 | 1),) => {} +LL + (Some(2_u8..=u8::MAX)) => { todo!() } | error: aborting due to 3 previous errors diff --git a/tests/ui/or-patterns/issue-69875-should-have-been-expanded-earlier-non-exhaustive.stderr b/tests/ui/or-patterns/issue-69875-should-have-been-expanded-earlier-non-exhaustive.stderr index 40a993d3320e0..ac8485712aed2 100644 --- a/tests/ui/or-patterns/issue-69875-should-have-been-expanded-earlier-non-exhaustive.stderr +++ b/tests/ui/or-patterns/issue-69875-should-have-been-expanded-earlier-non-exhaustive.stderr @@ -21,9 +21,9 @@ LL | match 0 { = note: the matched value is of type `i32` help: ensure that all possible cases are being handled by adding more match arms | -LL ~ 0 | (1 | 2) => {}, -LL + i32::MIN..=-1_i32 => { todo!() }, -LL + 3_i32..=i32::MAX => { todo!() }, +LL ~ 0 | (1 | 2) => {} +LL + i32::MIN..=-1_i32 => { todo!() } +LL + 3_i32..=i32::MAX => { todo!() } | error: aborting due to 2 previous errors diff --git a/tests/ui/pattern/suggest-adding-appropriate-missing-pattern-excluding-comments.fixed b/tests/ui/pattern/suggest-adding-appropriate-missing-pattern-excluding-comments.fixed index 3446d78eae3e3..d13668bbc2929 100644 --- a/tests/ui/pattern/suggest-adding-appropriate-missing-pattern-excluding-comments.fixed +++ b/tests/ui/pattern/suggest-adding-appropriate-missing-pattern-excluding-comments.fixed @@ -5,7 +5,7 @@ fn main() { Some(1) => {} // hello Some(_) => {} - None => { todo!() }, + None => { todo!() } } } diff --git a/tests/ui/pattern/suggest-adding-appropriate-missing-pattern-excluding-comments.stderr b/tests/ui/pattern/suggest-adding-appropriate-missing-pattern-excluding-comments.stderr index 00988e7752a3f..56fd7261215f6 100644 --- a/tests/ui/pattern/suggest-adding-appropriate-missing-pattern-excluding-comments.stderr +++ b/tests/ui/pattern/suggest-adding-appropriate-missing-pattern-excluding-comments.stderr @@ -8,7 +8,7 @@ LL | match Some(1) { help: ensure that all possible cases are being handled by adding an arm to handle the `None` case | LL ~ Some(_) => {} -LL + None => { todo!() }, +LL + None => { todo!() } | error: aborting due to previous error diff --git a/tests/ui/pattern/usefulness/doc-hidden-non-exhaustive.stderr b/tests/ui/pattern/usefulness/doc-hidden-non-exhaustive.stderr index 52d5f452bd508..5a12b5bbe1b79 100644 --- a/tests/ui/pattern/usefulness/doc-hidden-non-exhaustive.stderr +++ b/tests/ui/pattern/usefulness/doc-hidden-non-exhaustive.stderr @@ -8,7 +8,7 @@ LL | match HiddenEnum::A { help: ensure that all possible cases are being handled by adding a wildcard arm | LL ~ HiddenEnum::B => {} -LL + _ => { todo!() }, +LL + _ => { todo!() } | error[E0004]: match is non-exhaustive @@ -21,7 +21,7 @@ LL | match HiddenEnum::A { help: ensure that all possible cases are being handled by adding an arm to handle the `HiddenEnum::B` case | LL ~ HiddenEnum::C => {} -LL + HiddenEnum::B => { todo!() }, +LL + HiddenEnum::B => { todo!() } | error[E0004]: match is non-exhaustive @@ -33,9 +33,9 @@ LL | match HiddenEnum::A { = note: the matched value is of type `HiddenEnum` help: ensure that all possible cases are being handled by adding more match arms | -LL ~ HiddenEnum::A => {}, -LL + HiddenEnum::B => { todo!() }, -LL + _ => { todo!() }, +LL ~ HiddenEnum::A => {} +LL + HiddenEnum::B => { todo!() } +LL + _ => { todo!() } | error[E0004]: match is non-exhaustive @@ -48,8 +48,8 @@ LL | match None { help: ensure that all possible cases are being handled by adding more match arms | LL ~ Some(HiddenEnum::A) => {} -LL + Some(HiddenEnum::B) => { todo!() }, -LL + Some(_) => { todo!() }, +LL + Some(HiddenEnum::B) => { todo!() } +LL + Some(_) => { todo!() } | error[E0004]: match is non-exhaustive @@ -70,7 +70,7 @@ LL | C, help: ensure that all possible cases are being handled by adding an arm to handle the `InCrate::C` case | LL ~ InCrate::B => {} -LL + InCrate::C => { todo!() }, +LL + InCrate::C => { todo!() } | error: aborting due to 5 previous errors diff --git a/tests/ui/pattern/usefulness/empty-match.exhaustive_patterns.stderr b/tests/ui/pattern/usefulness/empty-match.exhaustive_patterns.stderr index ea319def40422..136d1560473f0 100644 --- a/tests/ui/pattern/usefulness/empty-match.exhaustive_patterns.stderr +++ b/tests/ui/pattern/usefulness/empty-match.exhaustive_patterns.stderr @@ -169,8 +169,8 @@ LL | match_guarded_arm!(0u8); = note: the matched value is of type `u8` help: ensure that all possible cases are being handled by adding a wildcard arm | -LL ~ _ if false => {}, -LL + _ => { todo!() }, +LL ~ _ if false => {} +LL + _ => { todo!() } | error[E0004]: match is non-exhaustive @@ -187,8 +187,8 @@ LL | struct NonEmptyStruct1; = note: the matched value is of type `NonEmptyStruct1` help: ensure that all possible cases are being handled by adding an arm to handle the `NonEmptyStruct1` case | -LL ~ _ if false => {}, -LL + NonEmptyStruct1 => { todo!() }, +LL ~ _ if false => {} +LL + NonEmptyStruct1 => { todo!() } | error[E0004]: match is non-exhaustive @@ -205,8 +205,8 @@ LL | struct NonEmptyStruct2(bool); = note: the matched value is of type `NonEmptyStruct2` help: ensure that all possible cases are being handled by adding an arm to handle the `NonEmptyStruct2(_)` case | -LL ~ _ if false => {}, -LL + NonEmptyStruct2(_) => { todo!() }, +LL ~ _ if false => {} +LL + NonEmptyStruct2(_) => { todo!() } | error[E0004]: match is non-exhaustive @@ -223,8 +223,8 @@ LL | union NonEmptyUnion1 { = note: the matched value is of type `NonEmptyUnion1` help: ensure that all possible cases are being handled by adding an arm to handle the `NonEmptyUnion1 { .. }` case | -LL ~ _ if false => {}, -LL + NonEmptyUnion1 { .. } => { todo!() }, +LL ~ _ if false => {} +LL + NonEmptyUnion1 { .. } => { todo!() } | error[E0004]: match is non-exhaustive @@ -241,8 +241,8 @@ LL | union NonEmptyUnion2 { = note: the matched value is of type `NonEmptyUnion2` help: ensure that all possible cases are being handled by adding an arm to handle the `NonEmptyUnion2 { .. }` case | -LL ~ _ if false => {}, -LL + NonEmptyUnion2 { .. } => { todo!() }, +LL ~ _ if false => {} +LL + NonEmptyUnion2 { .. } => { todo!() } | error[E0004]: match is non-exhaustive @@ -261,8 +261,8 @@ LL | Foo(bool), = note: the matched value is of type `NonEmptyEnum1` help: ensure that all possible cases are being handled by adding an arm to handle the `NonEmptyEnum1::Foo(_)` case | -LL ~ _ if false => {}, -LL + NonEmptyEnum1::Foo(_) => { todo!() }, +LL ~ _ if false => {} +LL + NonEmptyEnum1::Foo(_) => { todo!() } | error[E0004]: match is non-exhaustive @@ -283,9 +283,9 @@ LL | Bar, = note: the matched value is of type `NonEmptyEnum2` help: ensure that all possible cases are being handled by adding more match arms | -LL ~ _ if false => {}, -LL + NonEmptyEnum2::Foo(_) => { todo!() }, -LL + NonEmptyEnum2::Bar => { todo!() }, +LL ~ _ if false => {} +LL + NonEmptyEnum2::Foo(_) => { todo!() } +LL + NonEmptyEnum2::Bar => { todo!() } | error[E0004]: match is non-exhaustive @@ -309,11 +309,11 @@ LL | V1, V2, V3, V4, V5, = note: the matched value is of type `NonEmptyEnum5` help: ensure that all possible cases are being handled by adding more match arms | -LL ~ _ if false => {}, -LL + NonEmptyEnum5::V1 => { todo!() }, -LL + NonEmptyEnum5::V2 => { todo!() }, -LL + NonEmptyEnum5::V3 => { todo!() }, -LL + _ => { todo!() }, +LL ~ _ if false => {} +LL + NonEmptyEnum5::V1 => { todo!() } +LL + NonEmptyEnum5::V2 => { todo!() } +LL + NonEmptyEnum5::V3 => { todo!() } +LL + _ => { todo!() } | error: aborting due to 22 previous errors diff --git a/tests/ui/pattern/usefulness/empty-match.normal.stderr b/tests/ui/pattern/usefulness/empty-match.normal.stderr index ea319def40422..136d1560473f0 100644 --- a/tests/ui/pattern/usefulness/empty-match.normal.stderr +++ b/tests/ui/pattern/usefulness/empty-match.normal.stderr @@ -169,8 +169,8 @@ LL | match_guarded_arm!(0u8); = note: the matched value is of type `u8` help: ensure that all possible cases are being handled by adding a wildcard arm | -LL ~ _ if false => {}, -LL + _ => { todo!() }, +LL ~ _ if false => {} +LL + _ => { todo!() } | error[E0004]: match is non-exhaustive @@ -187,8 +187,8 @@ LL | struct NonEmptyStruct1; = note: the matched value is of type `NonEmptyStruct1` help: ensure that all possible cases are being handled by adding an arm to handle the `NonEmptyStruct1` case | -LL ~ _ if false => {}, -LL + NonEmptyStruct1 => { todo!() }, +LL ~ _ if false => {} +LL + NonEmptyStruct1 => { todo!() } | error[E0004]: match is non-exhaustive @@ -205,8 +205,8 @@ LL | struct NonEmptyStruct2(bool); = note: the matched value is of type `NonEmptyStruct2` help: ensure that all possible cases are being handled by adding an arm to handle the `NonEmptyStruct2(_)` case | -LL ~ _ if false => {}, -LL + NonEmptyStruct2(_) => { todo!() }, +LL ~ _ if false => {} +LL + NonEmptyStruct2(_) => { todo!() } | error[E0004]: match is non-exhaustive @@ -223,8 +223,8 @@ LL | union NonEmptyUnion1 { = note: the matched value is of type `NonEmptyUnion1` help: ensure that all possible cases are being handled by adding an arm to handle the `NonEmptyUnion1 { .. }` case | -LL ~ _ if false => {}, -LL + NonEmptyUnion1 { .. } => { todo!() }, +LL ~ _ if false => {} +LL + NonEmptyUnion1 { .. } => { todo!() } | error[E0004]: match is non-exhaustive @@ -241,8 +241,8 @@ LL | union NonEmptyUnion2 { = note: the matched value is of type `NonEmptyUnion2` help: ensure that all possible cases are being handled by adding an arm to handle the `NonEmptyUnion2 { .. }` case | -LL ~ _ if false => {}, -LL + NonEmptyUnion2 { .. } => { todo!() }, +LL ~ _ if false => {} +LL + NonEmptyUnion2 { .. } => { todo!() } | error[E0004]: match is non-exhaustive @@ -261,8 +261,8 @@ LL | Foo(bool), = note: the matched value is of type `NonEmptyEnum1` help: ensure that all possible cases are being handled by adding an arm to handle the `NonEmptyEnum1::Foo(_)` case | -LL ~ _ if false => {}, -LL + NonEmptyEnum1::Foo(_) => { todo!() }, +LL ~ _ if false => {} +LL + NonEmptyEnum1::Foo(_) => { todo!() } | error[E0004]: match is non-exhaustive @@ -283,9 +283,9 @@ LL | Bar, = note: the matched value is of type `NonEmptyEnum2` help: ensure that all possible cases are being handled by adding more match arms | -LL ~ _ if false => {}, -LL + NonEmptyEnum2::Foo(_) => { todo!() }, -LL + NonEmptyEnum2::Bar => { todo!() }, +LL ~ _ if false => {} +LL + NonEmptyEnum2::Foo(_) => { todo!() } +LL + NonEmptyEnum2::Bar => { todo!() } | error[E0004]: match is non-exhaustive @@ -309,11 +309,11 @@ LL | V1, V2, V3, V4, V5, = note: the matched value is of type `NonEmptyEnum5` help: ensure that all possible cases are being handled by adding more match arms | -LL ~ _ if false => {}, -LL + NonEmptyEnum5::V1 => { todo!() }, -LL + NonEmptyEnum5::V2 => { todo!() }, -LL + NonEmptyEnum5::V3 => { todo!() }, -LL + _ => { todo!() }, +LL ~ _ if false => {} +LL + NonEmptyEnum5::V1 => { todo!() } +LL + NonEmptyEnum5::V2 => { todo!() } +LL + NonEmptyEnum5::V3 => { todo!() } +LL + _ => { todo!() } | error: aborting due to 22 previous errors diff --git a/tests/ui/pattern/usefulness/floats.stderr b/tests/ui/pattern/usefulness/floats.stderr index ce731d4250c63..9e65b6a27da51 100644 --- a/tests/ui/pattern/usefulness/floats.stderr +++ b/tests/ui/pattern/usefulness/floats.stderr @@ -7,8 +7,8 @@ LL | match 0.0 { = note: the matched value is of type `f64` help: ensure that all possible cases are being handled by adding a wildcard arm | -LL ~ 0.0..=1.0 => {}, -LL + _ => { todo!() }, +LL ~ 0.0..=1.0 => {} +LL + _ => { todo!() } | error: unreachable pattern diff --git a/tests/ui/pattern/usefulness/guards.stderr b/tests/ui/pattern/usefulness/guards.stderr index 6dc5b29f3e8b8..f18a917d01081 100644 --- a/tests/ui/pattern/usefulness/guards.stderr +++ b/tests/ui/pattern/usefulness/guards.stderr @@ -8,7 +8,7 @@ LL | match 0u8 { help: ensure that all possible cases are being handled by adding an arm to handle the `128_u8..=u8::MAX` case | LL ~ 128 ..= 255 if true => {} -LL + 128_u8..=u8::MAX => { todo!() }, +LL + 128_u8..=u8::MAX => { todo!() } | error: aborting due to previous error diff --git a/tests/ui/pattern/usefulness/integer-ranges/exhaustiveness.stderr b/tests/ui/pattern/usefulness/integer-ranges/exhaustiveness.stderr index 6723087e41e4a..c7ff20f17a532 100644 --- a/tests/ui/pattern/usefulness/integer-ranges/exhaustiveness.stderr +++ b/tests/ui/pattern/usefulness/integer-ranges/exhaustiveness.stderr @@ -92,7 +92,7 @@ LL | match 0i8 { help: ensure that all possible cases are being handled by adding an arm to handle the `0_i8` case | LL ~ 1 ..= i8::MAX => {} -LL + 0_i8 => { todo!() }, +LL + 0_i8 => { todo!() } | error[E0004]: match is non-exhaustive @@ -141,7 +141,7 @@ LL | match (0u8, true) { help: ensure that all possible cases are being handled by adding an arm to handle the `(126_u8..=127_u8, false)` case | LL ~ (0 ..= 255, true) => {} -LL + (126_u8..=127_u8, false) => { todo!() }, +LL + (126_u8..=127_u8, false) => { todo!() } | error: aborting due to 12 previous errors diff --git a/tests/ui/pattern/usefulness/integer-ranges/pointer-sized-int.deny.stderr b/tests/ui/pattern/usefulness/integer-ranges/pointer-sized-int.deny.stderr index a6385a1c0b902..5008e21a3ab2e 100644 --- a/tests/ui/pattern/usefulness/integer-ranges/pointer-sized-int.deny.stderr +++ b/tests/ui/pattern/usefulness/integer-ranges/pointer-sized-int.deny.stderr @@ -9,8 +9,8 @@ LL | match 0usize { = help: add `#![feature(precise_pointer_size_matching)]` to the crate attributes to enable precise `usize` matching help: ensure that all possible cases are being handled by adding a wildcard arm | -LL ~ 0 ..= usize::MAX => {}, -LL + _ => { todo!() }, +LL ~ 0 ..= usize::MAX => {} +LL + _ => { todo!() } | error[E0004]: match is non-exhaustive @@ -24,8 +24,8 @@ LL | match 0isize { = help: add `#![feature(precise_pointer_size_matching)]` to the crate attributes to enable precise `isize` matching help: ensure that all possible cases are being handled by adding a wildcard arm | -LL ~ isize::MIN ..= isize::MAX => {}, -LL + _ => { todo!() }, +LL ~ isize::MIN ..= isize::MAX => {} +LL + _ => { todo!() } | error[E0004]: match is non-exhaustive @@ -148,7 +148,7 @@ LL | match 0isize { help: ensure that all possible cases are being handled by adding a wildcard arm | LL ~ 1 ..= isize::MAX => {} -LL + _ => { todo!() }, +LL + _ => { todo!() } | error[E0004]: non-exhaustive patterns: type `usize` is non-empty diff --git a/tests/ui/pattern/usefulness/integer-ranges/precise_pointer_matching-message.stderr b/tests/ui/pattern/usefulness/integer-ranges/precise_pointer_matching-message.stderr index fad806a99668a..37a0a3d2f807f 100644 --- a/tests/ui/pattern/usefulness/integer-ranges/precise_pointer_matching-message.stderr +++ b/tests/ui/pattern/usefulness/integer-ranges/precise_pointer_matching-message.stderr @@ -9,8 +9,8 @@ LL | match 0usize { = help: add `#![feature(precise_pointer_size_matching)]` to the crate attributes to enable precise `usize` matching help: ensure that all possible cases are being handled by adding a wildcard arm | -LL ~ 0..=usize::MAX => {}, -LL + _ => { todo!() }, +LL ~ 0..=usize::MAX => {} +LL + _ => { todo!() } | error[E0004]: match is non-exhaustive @@ -24,8 +24,8 @@ LL | match 0isize { = help: add `#![feature(precise_pointer_size_matching)]` to the crate attributes to enable precise `isize` matching help: ensure that all possible cases are being handled by adding a wildcard arm | -LL ~ isize::MIN..=isize::MAX => {}, -LL + _ => { todo!() }, +LL ~ isize::MIN..=isize::MAX => {} +LL + _ => { todo!() } | error: aborting due to 2 previous errors diff --git a/tests/ui/pattern/usefulness/issue-15129.stderr b/tests/ui/pattern/usefulness/issue-15129.stderr index 5cf998d72f4eb..505b8fbb908cf 100644 --- a/tests/ui/pattern/usefulness/issue-15129.stderr +++ b/tests/ui/pattern/usefulness/issue-15129.stderr @@ -8,8 +8,8 @@ LL | match (T::T1(()), V::V2(true)) { help: ensure that all possible cases are being handled by adding more match arms | LL ~ (T::T2(()), V::V2(b)) => (), -LL + (T::T1(()), V::V2(_)) => { todo!() }, -LL + (T::T2(()), V::V1(_)) => { todo!() }, +LL + (T::T1(()), V::V2(_)) => { todo!() } +LL + (T::T2(()), V::V1(_)) => { todo!() } | error: aborting due to previous error diff --git a/tests/ui/pattern/usefulness/issue-2111.stderr b/tests/ui/pattern/usefulness/issue-2111.stderr index 79fbe0d165f33..16b0cedae63c7 100644 --- a/tests/ui/pattern/usefulness/issue-2111.stderr +++ b/tests/ui/pattern/usefulness/issue-2111.stderr @@ -8,8 +8,8 @@ LL | match (a, b) { help: ensure that all possible cases are being handled by adding more match arms | LL ~ (Some(_), None) | (None, Some(_)) => {} -LL + (None, None) => { todo!() }, -LL + (Some(_), Some(_)) => { todo!() }, +LL + (None, None) => { todo!() } +LL + (Some(_), Some(_)) => { todo!() } | error: aborting due to previous error diff --git a/tests/ui/pattern/usefulness/issue-30240.stderr b/tests/ui/pattern/usefulness/issue-30240.stderr index f82c44ed585de..5f14cc6b0379a 100644 --- a/tests/ui/pattern/usefulness/issue-30240.stderr +++ b/tests/ui/pattern/usefulness/issue-30240.stderr @@ -7,8 +7,8 @@ LL | match "world" { = note: the matched value is of type `&str` help: ensure that all possible cases are being handled by adding an arm to handle the `&_` case | -LL ~ "hello" => {}, -LL + &_ => { todo!() }, +LL ~ "hello" => {} +LL + &_ => { todo!() } | error[E0004]: match is non-exhaustive @@ -21,7 +21,7 @@ LL | match "world" { help: ensure that all possible cases are being handled by adding an arm to handle the `&_` case | LL ~ "hello" => {} -LL + &_ => { todo!() }, +LL + &_ => { todo!() } | error: aborting due to 2 previous errors diff --git a/tests/ui/pattern/usefulness/issue-35609.stderr b/tests/ui/pattern/usefulness/issue-35609.stderr index 026400f8fe33f..8e96785ae81da 100644 --- a/tests/ui/pattern/usefulness/issue-35609.stderr +++ b/tests/ui/pattern/usefulness/issue-35609.stderr @@ -7,11 +7,11 @@ LL | match (A, ()) { = note: the matched value is of type `(Enum, ())` help: ensure that all possible cases are being handled by adding more match arms | -LL ~ (A, _) => {}, -LL + (Enum::B, _) => { todo!() }, -LL + (Enum::C, _) => { todo!() }, -LL + (Enum::D, _) => { todo!() }, -LL + _ => { todo!() }, +LL ~ (A, _) => {} +LL + (Enum::B, _) => { todo!() } +LL + (Enum::C, _) => { todo!() } +LL + (Enum::D, _) => { todo!() } +LL + _ => { todo!() } | error[E0004]: match is non-exhaustive @@ -23,11 +23,11 @@ LL | match (A, A) { = note: the matched value is of type `(Enum, Enum)` help: ensure that all possible cases are being handled by adding more match arms | -LL ~ (_, A) => {}, -LL + (_, Enum::B) => { todo!() }, -LL + (_, Enum::C) => { todo!() }, -LL + (_, Enum::D) => { todo!() }, -LL + _ => { todo!() }, +LL ~ (_, A) => {} +LL + (_, Enum::B) => { todo!() } +LL + (_, Enum::C) => { todo!() } +LL + (_, Enum::D) => { todo!() } +LL + _ => { todo!() } | error[E0004]: match is non-exhaustive @@ -39,11 +39,11 @@ LL | match ((A, ()), ()) { = note: the matched value is of type `((Enum, ()), ())` help: ensure that all possible cases are being handled by adding more match arms | -LL ~ ((A, ()), _) => {}, -LL + ((Enum::B, _), _) => { todo!() }, -LL + ((Enum::C, _), _) => { todo!() }, -LL + ((Enum::D, _), _) => { todo!() }, -LL + _ => { todo!() }, +LL ~ ((A, ()), _) => {} +LL + ((Enum::B, _), _) => { todo!() } +LL + ((Enum::C, _), _) => { todo!() } +LL + ((Enum::D, _), _) => { todo!() } +LL + _ => { todo!() } | error[E0004]: match is non-exhaustive @@ -55,11 +55,11 @@ LL | match ((A, ()), A) { = note: the matched value is of type `((Enum, ()), Enum)` help: ensure that all possible cases are being handled by adding more match arms | -LL ~ ((A, ()), _) => {}, -LL + ((Enum::B, _), _) => { todo!() }, -LL + ((Enum::C, _), _) => { todo!() }, -LL + ((Enum::D, _), _) => { todo!() }, -LL + _ => { todo!() }, +LL ~ ((A, ()), _) => {} +LL + ((Enum::B, _), _) => { todo!() } +LL + ((Enum::C, _), _) => { todo!() } +LL + ((Enum::D, _), _) => { todo!() } +LL + _ => { todo!() } | error[E0004]: match is non-exhaustive @@ -71,11 +71,11 @@ LL | match ((A, ()), ()) { = note: the matched value is of type `((Enum, ()), ())` help: ensure that all possible cases are being handled by adding more match arms | -LL ~ ((A, _), _) => {}, -LL + ((Enum::B, _), _) => { todo!() }, -LL + ((Enum::C, _), _) => { todo!() }, -LL + ((Enum::D, _), _) => { todo!() }, -LL + _ => { todo!() }, +LL ~ ((A, _), _) => {} +LL + ((Enum::B, _), _) => { todo!() } +LL + ((Enum::C, _), _) => { todo!() } +LL + ((Enum::D, _), _) => { todo!() } +LL + _ => { todo!() } | error[E0004]: match is non-exhaustive @@ -92,11 +92,11 @@ LL | struct S(Enum, ()); = note: the matched value is of type `S` help: ensure that all possible cases are being handled by adding more match arms | -LL ~ S(A, _) => {}, -LL + S(Enum::B, _) => { todo!() }, -LL + S(Enum::C, _) => { todo!() }, -LL + S(Enum::D, _) => { todo!() }, -LL + _ => { todo!() }, +LL ~ S(A, _) => {} +LL + S(Enum::B, _) => { todo!() } +LL + S(Enum::C, _) => { todo!() } +LL + S(Enum::D, _) => { todo!() } +LL + _ => { todo!() } | error[E0004]: match is non-exhaustive @@ -113,11 +113,11 @@ LL | struct Sd { x: Enum, y: () } = note: the matched value is of type `Sd` help: ensure that all possible cases are being handled by adding more match arms | -LL ~ Sd { x: A, y: _ } => {}, -LL + Sd { x: Enum::B, .. } => { todo!() }, -LL + Sd { x: Enum::C, .. } => { todo!() }, -LL + Sd { x: Enum::D, .. } => { todo!() }, -LL + _ => { todo!() }, +LL ~ Sd { x: A, y: _ } => {} +LL + Sd { x: Enum::B, .. } => { todo!() } +LL + Sd { x: Enum::C, .. } => { todo!() } +LL + Sd { x: Enum::D, .. } => { todo!() } +LL + _ => { todo!() } | error[E0004]: match is non-exhaustive @@ -130,10 +130,10 @@ LL | match Some(A) { help: ensure that all possible cases are being handled by adding more match arms | LL ~ None => (), -LL + Some(Enum::B) => { todo!() }, -LL + Some(Enum::C) => { todo!() }, -LL + Some(Enum::D) => { todo!() }, -LL + _ => { todo!() }, +LL + Some(Enum::B) => { todo!() } +LL + Some(Enum::C) => { todo!() } +LL + Some(Enum::D) => { todo!() } +LL + _ => { todo!() } | error: aborting due to 8 previous errors diff --git a/tests/ui/pattern/usefulness/issue-3601.stderr b/tests/ui/pattern/usefulness/issue-3601.stderr index 6021342b96ac3..743124b2e2aef 100644 --- a/tests/ui/pattern/usefulness/issue-3601.stderr +++ b/tests/ui/pattern/usefulness/issue-3601.stderr @@ -7,8 +7,8 @@ LL | box NodeKind::Element(ed) => match ed.kind { = note: the matched value is of type `Box` help: ensure that all possible cases are being handled by adding an arm to handle the `box _` case | -LL ~ box ElementKind::HTMLImageElement(ref d) if d.image.is_some() => { true }, -LL + box _ => { todo!() }, +LL ~ box ElementKind::HTMLImageElement(ref d) if d.image.is_some() => { true } +LL + box _ => { todo!() } | error: aborting due to previous error diff --git a/tests/ui/pattern/usefulness/issue-39362.stderr b/tests/ui/pattern/usefulness/issue-39362.stderr index 4b585e8506ebd..6ee885a75ea5f 100644 --- a/tests/ui/pattern/usefulness/issue-39362.stderr +++ b/tests/ui/pattern/usefulness/issue-39362.stderr @@ -15,10 +15,10 @@ LL | Bar { bar: Bar, id: usize } help: ensure that all possible cases are being handled by adding more match arms | LL ~ Foo::Bar { bar: Bar::B, .. } => (), -LL + Foo::Bar { bar: Bar::C, .. } => { todo!() }, -LL + Foo::Bar { bar: Bar::D, .. } => { todo!() }, -LL + Foo::Bar { bar: Bar::E, .. } => { todo!() }, -LL + Foo::Bar { bar: Bar::F, .. } => { todo!() }, +LL + Foo::Bar { bar: Bar::C, .. } => { todo!() } +LL + Foo::Bar { bar: Bar::D, .. } => { todo!() } +LL + Foo::Bar { bar: Bar::E, .. } => { todo!() } +LL + Foo::Bar { bar: Bar::F, .. } => { todo!() } | error: aborting due to previous error diff --git a/tests/ui/pattern/usefulness/issue-40221.stderr b/tests/ui/pattern/usefulness/issue-40221.stderr index 5fd5088276b64..33f15da8676c0 100644 --- a/tests/ui/pattern/usefulness/issue-40221.stderr +++ b/tests/ui/pattern/usefulness/issue-40221.stderr @@ -15,7 +15,7 @@ LL | C(PC), help: ensure that all possible cases are being handled by adding an arm to handle the `P::C(PC::QA)` case | LL ~ P::C(PC::Q) => (), -LL + P::C(PC::QA) => { todo!() }, +LL + P::C(PC::QA) => { todo!() } | error: aborting due to previous error diff --git a/tests/ui/pattern/usefulness/issue-4321.stderr b/tests/ui/pattern/usefulness/issue-4321.stderr index a472d7ab4c222..cf48dc37914c8 100644 --- a/tests/ui/pattern/usefulness/issue-4321.stderr +++ b/tests/ui/pattern/usefulness/issue-4321.stderr @@ -8,7 +8,7 @@ LL | println!("foo {:}", match tup { help: ensure that all possible cases are being handled by adding an arm to handle the `(true, false)` case | LL ~ (true, true) => "baz", -LL + (true, false) => { todo!() }, +LL + (true, false) => { todo!() } | error: aborting due to previous error diff --git a/tests/ui/pattern/usefulness/issue-50900.stderr b/tests/ui/pattern/usefulness/issue-50900.stderr index e5f246805d4ea..b0a4e4ff33fdf 100644 --- a/tests/ui/pattern/usefulness/issue-50900.stderr +++ b/tests/ui/pattern/usefulness/issue-50900.stderr @@ -12,8 +12,8 @@ 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 by adding an arm to handle the `Tag(Context::Exif, _)` case | -LL ~ Tag::ExifIFDPointer => {}, -LL + Tag(Context::Exif, _) => { todo!() }, +LL ~ Tag::ExifIFDPointer => {} +LL + Tag(Context::Exif, _) => { todo!() } | error: aborting due to previous error diff --git a/tests/ui/pattern/usefulness/issue-56379.stderr b/tests/ui/pattern/usefulness/issue-56379.stderr index 04568a6b67ed1..4233e17d4226b 100644 --- a/tests/ui/pattern/usefulness/issue-56379.stderr +++ b/tests/ui/pattern/usefulness/issue-56379.stderr @@ -19,9 +19,9 @@ LL | C(bool), help: ensure that all possible cases are being handled by adding more match arms | LL ~ Foo::C(true) => {} -LL + Foo::A(false) => { todo!() }, -LL + Foo::B(false) => { todo!() }, -LL + Foo::C(false) => { todo!() }, +LL + Foo::A(false) => { todo!() } +LL + Foo::B(false) => { todo!() } +LL + Foo::C(false) => { todo!() } | error: aborting due to previous error diff --git a/tests/ui/pattern/usefulness/issue-72377.stderr b/tests/ui/pattern/usefulness/issue-72377.stderr index e34a3d47a85bc..f9b8d5011dc0c 100644 --- a/tests/ui/pattern/usefulness/issue-72377.stderr +++ b/tests/ui/pattern/usefulness/issue-72377.stderr @@ -8,10 +8,10 @@ LL | match (x, y) { help: ensure that all possible cases are being handled by adding more match arms | LL ~ (X::A, Some(X::C)) | (X::C, Some(X::A)) => false, -LL + (X::A, Some(X::A)) => { todo!() }, -LL + (X::A, Some(X::B)) => { todo!() }, -LL + (X::B, Some(X::B)) => { todo!() }, -LL + _ => { todo!() }, +LL + (X::A, Some(X::A)) => { todo!() } +LL + (X::A, Some(X::B)) => { todo!() } +LL + (X::B, Some(X::B)) => { todo!() } +LL + _ => { todo!() } | error: aborting due to previous error diff --git a/tests/ui/pattern/usefulness/match-arm-statics-2.stderr b/tests/ui/pattern/usefulness/match-arm-statics-2.stderr index 7b764e773adef..1585e9dd19303 100644 --- a/tests/ui/pattern/usefulness/match-arm-statics-2.stderr +++ b/tests/ui/pattern/usefulness/match-arm-statics-2.stderr @@ -8,7 +8,7 @@ LL | match (true, false) { help: ensure that all possible cases are being handled by adding an arm to handle the `(true, false)` case | LL ~ (false, true) => (), -LL + (true, false) => { todo!() }, +LL + (true, false) => { todo!() } | error[E0004]: match is non-exhaustive @@ -21,7 +21,7 @@ LL | match Some(Some(North)) { help: ensure that all possible cases are being handled by adding an arm to handle the `Some(Some(Direction::West))` case | LL ~ None => (), -LL + Some(Some(Direction::West)) => { todo!() }, +LL + Some(Some(Direction::West)) => { todo!() } | error[E0004]: match is non-exhaustive @@ -39,7 +39,7 @@ LL | struct Foo { help: ensure that all possible cases are being handled by adding an arm to handle the `Foo { bar: Some(Direction::North), baz: NewBool(true) }` case | LL ~ Foo { bar: Some(EAST), .. } => (), -LL + Foo { bar: Some(Direction::North), baz: NewBool(true) } => { todo!() }, +LL + Foo { bar: Some(Direction::North), baz: NewBool(true) } => { todo!() } | error: aborting due to 3 previous errors diff --git a/tests/ui/pattern/usefulness/match-byte-array-patterns-2.stderr b/tests/ui/pattern/usefulness/match-byte-array-patterns-2.stderr index 3b70ba517e975..e05b277527b0d 100644 --- a/tests/ui/pattern/usefulness/match-byte-array-patterns-2.stderr +++ b/tests/ui/pattern/usefulness/match-byte-array-patterns-2.stderr @@ -7,9 +7,9 @@ LL | match buf { = note: the matched value is of type `&[u8; 4]` help: ensure that all possible cases are being handled by adding more match arms | -LL ~ b"AAAA" => {}, -LL + &[0_u8..=64_u8, _, _, _] => { todo!() }, -LL + &[66_u8..=u8::MAX, _, _, _] => { todo!() }, +LL ~ b"AAAA" => {} +LL + &[0_u8..=64_u8, _, _, _] => { todo!() } +LL + &[66_u8..=u8::MAX, _, _, _] => { todo!() } | error[E0004]: match is non-exhaustive @@ -21,11 +21,11 @@ LL | match buf { = note: the matched value is of type `&[u8]` help: ensure that all possible cases are being handled by adding more match arms | -LL ~ b"AAAA" => {}, -LL + &[] => { todo!() }, -LL + &[_] => { todo!() }, -LL + &[_, _] => { todo!() }, -LL + _ => { todo!() }, +LL ~ b"AAAA" => {} +LL + &[] => { todo!() } +LL + &[_] => { todo!() } +LL + &[_, _] => { todo!() } +LL + _ => { todo!() } | error: aborting due to 2 previous errors diff --git a/tests/ui/pattern/usefulness/match-privately-empty.stderr b/tests/ui/pattern/usefulness/match-privately-empty.stderr index bd4d900743c4c..2f2d0607a9855 100644 --- a/tests/ui/pattern/usefulness/match-privately-empty.stderr +++ b/tests/ui/pattern/usefulness/match-privately-empty.stderr @@ -8,7 +8,7 @@ LL | match private::DATA { help: ensure that all possible cases are being handled by adding an arm to handle the `Some(Private { misc: true, .. })` case | LL ~ }) => {} -LL + Some(Private { misc: true, .. }) => { todo!() }, +LL + Some(Private { misc: true, .. }) => { todo!() } | error: aborting due to previous error diff --git a/tests/ui/pattern/usefulness/match-slice-patterns.stderr b/tests/ui/pattern/usefulness/match-slice-patterns.stderr index 7065195286763..608e821c85821 100644 --- a/tests/ui/pattern/usefulness/match-slice-patterns.stderr +++ b/tests/ui/pattern/usefulness/match-slice-patterns.stderr @@ -8,7 +8,7 @@ LL | match list { help: ensure that all possible cases are being handled by adding an arm to handle the `&[_, Some(_), .., None, _]` case | LL ~ &[.., Some(_), _] => {} -LL + &[_, Some(_), .., None, _] => { todo!() }, +LL + &[_, Some(_), .., None, _] => { todo!() } | error: aborting due to previous error diff --git a/tests/ui/pattern/usefulness/non-exhaustive-defined-here.stderr b/tests/ui/pattern/usefulness/non-exhaustive-defined-here.stderr index cc0ab25c9a2a0..5d260df0f55e0 100644 --- a/tests/ui/pattern/usefulness/non-exhaustive-defined-here.stderr +++ b/tests/ui/pattern/usefulness/non-exhaustive-defined-here.stderr @@ -18,9 +18,9 @@ LL | C = note: the matched value is of type `E` help: ensure that all possible cases are being handled by adding more match arms | -LL ~ E::A => {}, -LL + E::B => { todo!() }, -LL + E::C => { todo!() }, +LL ~ E::A => {} +LL + E::B => { todo!() } +LL + E::C => { todo!() } | error[E0005]: refutable pattern in local binding @@ -68,9 +68,9 @@ LL | C = note: the matched value is of type `&E` help: ensure that all possible cases are being handled by adding more match arms | -LL ~ E::A => {}, -LL + &E::B => { todo!() }, -LL + &E::C => { todo!() }, +LL ~ E::A => {} +LL + &E::B => { todo!() } +LL + &E::C => { todo!() } | error[E0005]: refutable pattern in local binding @@ -118,9 +118,9 @@ LL | C = note: the matched value is of type `&&mut &E` help: ensure that all possible cases are being handled by adding more match arms | -LL ~ E::A => {}, -LL + &&mut &E::B => { todo!() }, -LL + &&mut &E::C => { todo!() }, +LL ~ E::A => {} +LL + &&mut &E::B => { todo!() } +LL + &&mut &E::C => { todo!() } | error[E0005]: refutable pattern in local binding @@ -165,8 +165,8 @@ LL | None, = note: the matched value is of type `Opt` help: ensure that all possible cases are being handled by adding an arm to handle the `Opt::None` case | -LL ~ Opt::Some(ref _x) => {}, -LL + Opt::None => { todo!() }, +LL ~ Opt::Some(ref _x) => {} +LL + Opt::None => { todo!() } | error[E0005]: refutable pattern in local binding diff --git a/tests/ui/pattern/usefulness/non-exhaustive-match-nested.stderr b/tests/ui/pattern/usefulness/non-exhaustive-match-nested.stderr index 5d10463a8be54..ea250babe8c6b 100644 --- a/tests/ui/pattern/usefulness/non-exhaustive-match-nested.stderr +++ b/tests/ui/pattern/usefulness/non-exhaustive-match-nested.stderr @@ -8,7 +8,7 @@ LL | match (l1, l2) { help: ensure that all possible cases are being handled by adding an arm to handle the `(Some(&[]), Err(_))` case | LL ~ (None, Ok(&[_, _, ..])) => "None, Ok(at least two elements)", -LL + (Some(&[]), Err(_)) => { todo!() }, +LL + (Some(&[]), Err(_)) => { todo!() } | error[E0004]: match is non-exhaustive @@ -26,7 +26,7 @@ LL | enum T { A(U), B } help: ensure that all possible cases are being handled by adding an arm to handle the `T::A(U::C)` case | LL ~ T::B => { panic!("goodbye"); } -LL + T::A(U::C) => { todo!() }, +LL + T::A(U::C) => { todo!() } | error: aborting due to 2 previous errors diff --git a/tests/ui/pattern/usefulness/non-exhaustive-match.stderr b/tests/ui/pattern/usefulness/non-exhaustive-match.stderr index ec577073d7663..66efa45c97565 100644 --- a/tests/ui/pattern/usefulness/non-exhaustive-match.stderr +++ b/tests/ui/pattern/usefulness/non-exhaustive-match.stderr @@ -24,8 +24,8 @@ LL | match true { = note: the matched value is of type `bool` help: ensure that all possible cases are being handled by adding an arm to handle the `false` case | -LL ~ true => {}, -LL + false => { todo!() }, +LL ~ true => {} +LL + false => { todo!() } | error[E0004]: match is non-exhaustive @@ -37,8 +37,8 @@ LL | match Some(10) { = note: the matched value is of type `Option` help: ensure that all possible cases are being handled by adding an arm to handle the `Some(_)` case | -LL ~ None => {}, -LL + Some(_) => { todo!() }, +LL ~ None => {} +LL + Some(_) => { todo!() } | error[E0004]: match is non-exhaustive @@ -50,9 +50,9 @@ LL | match (2, 3, 4) { = note: the matched value is of type `(i32, i32, i32)` help: ensure that all possible cases are being handled by adding more match arms | -LL ~ (_, _, 4) => {}, -LL + (_, _, i32::MIN..=3_i32) => { todo!() }, -LL + (_, _, 5_i32..=i32::MAX) => { todo!() }, +LL ~ (_, _, 4) => {} +LL + (_, _, i32::MIN..=3_i32) => { todo!() } +LL + (_, _, 5_i32..=i32::MAX) => { todo!() } | error[E0004]: match is non-exhaustive @@ -65,8 +65,8 @@ LL | match (T::A, T::A) { help: ensure that all possible cases are being handled by adding more match arms | LL ~ (T::B, T::A) => {} -LL + (T::A, T::A) => { todo!() }, -LL + (T::B, T::B) => { todo!() }, +LL + (T::A, T::A) => { todo!() } +LL + (T::B, T::B) => { todo!() } | error[E0004]: match is non-exhaustive @@ -83,8 +83,8 @@ LL | enum T { A, B } = note: the matched value is of type `T` help: ensure that all possible cases are being handled by adding an arm to handle the `T::B` case | -LL ~ T::A => {}, -LL + T::B => { todo!() }, +LL ~ T::A => {} +LL + T::B => { todo!() } | error[E0004]: match is non-exhaustive @@ -97,7 +97,7 @@ LL | match *vec { help: ensure that all possible cases are being handled by adding an arm to handle the `[]` case | LL ~ [None] => {} -LL + [] => { todo!() }, +LL + [] => { todo!() } | error[E0004]: match is non-exhaustive @@ -110,7 +110,7 @@ LL | match *vec { help: ensure that all possible cases are being handled by adding an arm to handle the `[_, _, _, _, ..]` case | LL ~ [] => (), -LL + [_, _, _, _, ..] => { todo!() }, +LL + [_, _, _, _, ..] => { todo!() } | error: aborting due to 8 previous errors diff --git a/tests/ui/pattern/usefulness/non-exhaustive-pattern-witness.stderr b/tests/ui/pattern/usefulness/non-exhaustive-pattern-witness.stderr index fb8d37af02726..5cd00bb4b0612 100644 --- a/tests/ui/pattern/usefulness/non-exhaustive-pattern-witness.stderr +++ b/tests/ui/pattern/usefulness/non-exhaustive-pattern-witness.stderr @@ -13,7 +13,7 @@ LL | struct Foo { help: ensure that all possible cases are being handled by adding an arm to handle the `Foo { first: false, second: Some([_, _, _, _]) }` case | LL ~ Foo { first: false, second: Some([1, 2, 3, 4]) } => (), -LL + Foo { first: false, second: Some([_, _, _, _]) } => { todo!() }, +LL + Foo { first: false, second: Some([_, _, _, _]) } => { todo!() } | error[E0004]: match is non-exhaustive @@ -33,7 +33,7 @@ LL | Red, help: ensure that all possible cases are being handled by adding an arm to handle the `Color::Red` case | LL ~ Color::Green => (), -LL + Color::Red => { todo!() }, +LL + Color::Red => { todo!() } | error[E0004]: match is non-exhaustive @@ -56,9 +56,9 @@ LL | North, East, South, West help: ensure that all possible cases are being handled by adding more match arms | LL ~ Direction::North => (), -LL + Direction::East => { todo!() }, -LL + Direction::South => { todo!() }, -LL + Direction::West => { todo!() }, +LL + Direction::East => { todo!() } +LL + Direction::South => { todo!() } +LL + Direction::West => { todo!() } | error[E0004]: match is non-exhaustive @@ -83,10 +83,10 @@ LL | First, Second, Third, Fourth, Fifth, Sixth, Seventh, Eighth, Ninth, Ten help: ensure that all possible cases are being handled by adding more match arms | LL ~ ExcessiveEnum::First => (), -LL + ExcessiveEnum::Second => { todo!() }, -LL + ExcessiveEnum::Third => { todo!() }, -LL + ExcessiveEnum::Fourth => { todo!() }, -LL + _ => { todo!() }, +LL + ExcessiveEnum::Second => { todo!() } +LL + ExcessiveEnum::Third => { todo!() } +LL + ExcessiveEnum::Fourth => { todo!() } +LL + _ => { todo!() } | error[E0004]: match is non-exhaustive @@ -107,7 +107,7 @@ LL | CustomRGBA { a: bool, r: u8, g: u8, b: u8 } help: ensure that all possible cases are being handled by adding an arm to handle the `Color::CustomRGBA { a: true, .. }` case | LL ~ Color::CustomRGBA { a: false, r: _, g: _, b: _ } => (), -LL + Color::CustomRGBA { a: true, .. } => { todo!() }, +LL + Color::CustomRGBA { a: true, .. } => { todo!() } | error[E0004]: match is non-exhaustive @@ -120,7 +120,7 @@ LL | match *x { help: ensure that all possible cases are being handled by adding an arm to handle the `[Enum::Second(true), Enum::Second(false)]` case | LL ~ [_, _, ref tail @ .., _] => (), -LL + [Enum::Second(true), Enum::Second(false)] => { todo!() }, +LL + [Enum::Second(true), Enum::Second(false)] => { todo!() } | error[E0004]: match is non-exhaustive @@ -133,7 +133,7 @@ LL | match ((), false) { help: ensure that all possible cases are being handled by adding an arm to handle the `((), false)` case | LL ~ ((), true) => (), -LL + ((), false) => { todo!() }, +LL + ((), false) => { todo!() } | error: aborting due to 7 previous errors diff --git a/tests/ui/pattern/usefulness/slice-patterns-exhaustiveness.stderr b/tests/ui/pattern/usefulness/slice-patterns-exhaustiveness.stderr index dd8f154a5fcdb..90c0e78584424 100644 --- a/tests/ui/pattern/usefulness/slice-patterns-exhaustiveness.stderr +++ b/tests/ui/pattern/usefulness/slice-patterns-exhaustiveness.stderr @@ -7,8 +7,8 @@ LL | match s2 { = note: the matched value is of type `&[bool; 2]` help: ensure that all possible cases are being handled by adding an arm to handle the `&[false, _]` case | -LL ~ [true, .., true] => {}, -LL + &[false, _] => { todo!() }, +LL ~ [true, .., true] => {} +LL + &[false, _] => { todo!() } | error[E0004]: match is non-exhaustive @@ -20,8 +20,8 @@ LL | match s3 { = note: the matched value is of type `&[bool; 3]` help: ensure that all possible cases are being handled by adding an arm to handle the `&[false, ..]` case | -LL ~ [true, .., true] => {}, -LL + &[false, ..] => { todo!() }, +LL ~ [true, .., true] => {} +LL + &[false, ..] => { todo!() } | error[E0004]: match is non-exhaustive @@ -33,8 +33,8 @@ LL | match s10 { = note: the matched value is of type `&[bool; 10]` help: ensure that all possible cases are being handled by adding an arm to handle the `&[false, ..]` case | -LL ~ [true, .., true] => {}, -LL + &[false, ..] => { todo!() }, +LL ~ [true, .., true] => {} +LL + &[false, ..] => { todo!() } | error[E0004]: match is non-exhaustive @@ -47,7 +47,7 @@ LL | match s2 { help: ensure that all possible cases are being handled by adding an arm to handle the `&[false, true]` case | LL ~ [.., false] => {} -LL + &[false, true] => { todo!() }, +LL + &[false, true] => { todo!() } | error[E0004]: match is non-exhaustive @@ -60,7 +60,7 @@ LL | match s3 { help: ensure that all possible cases are being handled by adding an arm to handle the `&[false, .., true]` case | LL ~ [.., false] => {} -LL + &[false, .., true] => { todo!() }, +LL + &[false, .., true] => { todo!() } | error[E0004]: match is non-exhaustive @@ -73,7 +73,7 @@ LL | match s { help: ensure that all possible cases are being handled by adding an arm to handle the `&[false, .., true]` case | LL ~ [.., false] => {} -LL + &[false, .., true] => { todo!() }, +LL + &[false, .., true] => { todo!() } | error[E0004]: match is non-exhaustive @@ -85,8 +85,8 @@ LL | match s { = note: the matched value is of type `&[bool]` help: ensure that all possible cases are being handled by adding an arm to handle the `&[_, ..]` case | -LL ~ [] => {}, -LL + &[_, ..] => { todo!() }, +LL ~ [] => {} +LL + &[_, ..] => { todo!() } | error[E0004]: match is non-exhaustive @@ -99,7 +99,7 @@ LL | match s { help: ensure that all possible cases are being handled by adding an arm to handle the `&[_, _, ..]` case | LL ~ [_] => {} -LL + &[_, _, ..] => { todo!() }, +LL + &[_, _, ..] => { todo!() } | error[E0004]: match is non-exhaustive @@ -112,7 +112,7 @@ LL | match s { help: ensure that all possible cases are being handled by adding an arm to handle the `&[false, ..]` case | LL ~ [true, ..] => {} -LL + &[false, ..] => { todo!() }, +LL + &[false, ..] => { todo!() } | error[E0004]: match is non-exhaustive @@ -125,7 +125,7 @@ LL | match s { help: ensure that all possible cases are being handled by adding an arm to handle the `&[false, _, ..]` case | LL ~ [true, ..] => {} -LL + &[false, _, ..] => { todo!() }, +LL + &[false, _, ..] => { todo!() } | error[E0004]: match is non-exhaustive @@ -138,7 +138,7 @@ LL | match s { help: ensure that all possible cases are being handled by adding an arm to handle the `&[_, .., false]` case | LL ~ [.., true] => {} -LL + &[_, .., false] => { todo!() }, +LL + &[_, .., false] => { todo!() } | error[E0004]: match is non-exhaustive @@ -151,7 +151,7 @@ LL | match s { help: ensure that all possible cases are being handled by adding an arm to handle the `&[_, _, .., true]` case | LL ~ [.., false] => {} -LL + &[_, _, .., true] => { todo!() }, +LL + &[_, _, .., true] => { todo!() } | error[E0004]: match is non-exhaustive @@ -164,7 +164,7 @@ LL | match s { help: ensure that all possible cases are being handled by adding an arm to handle the `&[true, _, .., _]` case | LL ~ [false, .., false] => {} -LL + &[true, _, .., _] => { todo!() }, +LL + &[true, _, .., _] => { todo!() } | error[E0004]: match is non-exhaustive @@ -176,9 +176,9 @@ LL | match s { = note: the matched value is of type `&[bool]` help: ensure that all possible cases are being handled by adding more match arms | -LL ~ &[true] => {}, -LL + &[] => { todo!() }, -LL + &[_, _, ..] => { todo!() }, +LL ~ &[true] => {} +LL + &[] => { todo!() } +LL + &[_, _, ..] => { todo!() } | error[E0004]: match is non-exhaustive @@ -190,9 +190,9 @@ LL | match s { = note: the matched value is of type `&[bool]` help: ensure that all possible cases are being handled by adding more match arms | -LL ~ CONST => {}, -LL + &[] => { todo!() }, -LL + &[_, _, ..] => { todo!() }, +LL ~ CONST => {} +LL + &[] => { todo!() } +LL + &[_, _, ..] => { todo!() } | error[E0004]: match is non-exhaustive @@ -205,8 +205,8 @@ LL | match s { help: ensure that all possible cases are being handled by adding more match arms | LL ~ &[false] => {} -LL + &[] => { todo!() }, -LL + &[_, _, ..] => { todo!() }, +LL + &[] => { todo!() } +LL + &[_, _, ..] => { todo!() } | error[E0004]: match is non-exhaustive @@ -219,8 +219,8 @@ LL | match s { help: ensure that all possible cases are being handled by adding more match arms | LL ~ CONST => {} -LL + &[] => { todo!() }, -LL + &[_, _, ..] => { todo!() }, +LL + &[] => { todo!() } +LL + &[_, _, ..] => { todo!() } | error[E0004]: match is non-exhaustive @@ -233,7 +233,7 @@ LL | match s { help: ensure that all possible cases are being handled by adding an arm to handle the `&[_, _, ..]` case | LL ~ CONST => {} -LL + &[_, _, ..] => { todo!() }, +LL + &[_, _, ..] => { todo!() } | error[E0004]: match is non-exhaustive @@ -246,7 +246,7 @@ LL | match s { help: ensure that all possible cases are being handled by adding an arm to handle the `&[false]` case | LL ~ &[_, _, ..] => {} -LL + &[false] => { todo!() }, +LL + &[false] => { todo!() } | error[E0004]: match is non-exhaustive @@ -258,8 +258,8 @@ LL | match s1 { = note: the matched value is of type `&[bool; 1]` help: ensure that all possible cases are being handled by adding an arm to handle the `&[false]` case | -LL ~ CONST1 => {}, -LL + &[false] => { todo!() }, +LL ~ CONST1 => {} +LL + &[false] => { todo!() } | error: aborting due to 20 previous errors diff --git a/tests/ui/pattern/usefulness/stable-gated-patterns.stderr b/tests/ui/pattern/usefulness/stable-gated-patterns.stderr index f452c53bb01ae..b223861175fe9 100644 --- a/tests/ui/pattern/usefulness/stable-gated-patterns.stderr +++ b/tests/ui/pattern/usefulness/stable-gated-patterns.stderr @@ -7,9 +7,9 @@ LL | match UnstableEnum::Stable { = note: the matched value is of type `UnstableEnum` help: ensure that all possible cases are being handled by adding more match arms | -LL ~ UnstableEnum::Stable => {}, -LL + UnstableEnum::Stable2 => { todo!() }, -LL + _ => { todo!() }, +LL ~ UnstableEnum::Stable => {} +LL + UnstableEnum::Stable2 => { todo!() } +LL + _ => { todo!() } | error[E0004]: match is non-exhaustive @@ -22,7 +22,7 @@ LL | match UnstableEnum::Stable { help: ensure that all possible cases are being handled by adding a wildcard arm | LL ~ UnstableEnum::Stable2 => {} -LL + _ => { todo!() }, +LL + _ => { todo!() } | error: aborting due to 2 previous errors diff --git a/tests/ui/pattern/usefulness/struct-like-enum-nonexhaustive.stderr b/tests/ui/pattern/usefulness/struct-like-enum-nonexhaustive.stderr index b8400312c9d92..af1784a88241f 100644 --- a/tests/ui/pattern/usefulness/struct-like-enum-nonexhaustive.stderr +++ b/tests/ui/pattern/usefulness/struct-like-enum-nonexhaustive.stderr @@ -15,7 +15,7 @@ LL | B { x: Option }, help: ensure that all possible cases are being handled by adding an arm to handle the `A::B { x: Some(_) }` case | LL ~ A::B { x: None } => {} -LL + A::B { x: Some(_) } => { todo!() }, +LL + A::B { x: Some(_) } => { todo!() } | error: aborting due to previous error diff --git a/tests/ui/pattern/usefulness/tuple-struct-nonexhaustive.stderr b/tests/ui/pattern/usefulness/tuple-struct-nonexhaustive.stderr index cabdf2eb9431c..629a52e161357 100644 --- a/tests/ui/pattern/usefulness/tuple-struct-nonexhaustive.stderr +++ b/tests/ui/pattern/usefulness/tuple-struct-nonexhaustive.stderr @@ -13,7 +13,7 @@ LL | struct Foo(isize, isize); help: ensure that all possible cases are being handled by adding an arm to handle the `Foo(_, _)` case | LL ~ Foo(2, b) => println!("{}", b), -LL + Foo(_, _) => { todo!() }, +LL + Foo(_, _) => { todo!() } | error: aborting due to previous error diff --git a/tests/ui/pattern/usefulness/type_polymorphic_byte_str_literals.stderr b/tests/ui/pattern/usefulness/type_polymorphic_byte_str_literals.stderr index 5e2ac53b95c0f..caa2939803815 100644 --- a/tests/ui/pattern/usefulness/type_polymorphic_byte_str_literals.stderr +++ b/tests/ui/pattern/usefulness/type_polymorphic_byte_str_literals.stderr @@ -8,7 +8,7 @@ LL | match data { help: ensure that all possible cases are being handled by adding an arm to handle the `&[_, ..]` case | LL ~ b"" => 1, -LL + &[_, ..] => { todo!() }, +LL + &[_, ..] => { todo!() } | error[E0004]: match is non-exhaustive @@ -21,10 +21,10 @@ LL | match data { help: ensure that all possible cases are being handled by adding more match arms | LL ~ [_, _, _] => 1, -LL + &[] => { todo!() }, -LL + &[_] => { todo!() }, -LL + &[_, _] => { todo!() }, -LL + &[_, _, _, _, ..] => { todo!() }, +LL + &[] => { todo!() } +LL + &[_] => { todo!() } +LL + &[_, _] => { todo!() } +LL + &[_, _, _, _, ..] => { todo!() } | error: aborting due to 2 previous errors diff --git a/tests/ui/pattern/usefulness/unstable-gated-patterns.stderr b/tests/ui/pattern/usefulness/unstable-gated-patterns.stderr index 41eab797418f9..fc00c7c3dbcf0 100644 --- a/tests/ui/pattern/usefulness/unstable-gated-patterns.stderr +++ b/tests/ui/pattern/usefulness/unstable-gated-patterns.stderr @@ -8,7 +8,7 @@ LL | match UnstableEnum::Stable { help: ensure that all possible cases are being handled by adding an arm to handle the `UnstableEnum::Unstable` case | LL ~ UnstableEnum::Stable2 => {} -LL + UnstableEnum::Unstable => { todo!() }, +LL + UnstableEnum::Unstable => { todo!() } | error: aborting due to previous error diff --git a/tests/ui/rfc-2005-default-binding-mode/slice.stderr b/tests/ui/rfc-2005-default-binding-mode/slice.stderr index 4d87d7710fadb..9bede81fd8951 100644 --- a/tests/ui/rfc-2005-default-binding-mode/slice.stderr +++ b/tests/ui/rfc-2005-default-binding-mode/slice.stderr @@ -7,8 +7,8 @@ LL | match sl { = note: the matched value is of type `&[u8]` help: ensure that all possible cases are being handled by adding an arm to handle the `&[]` case | -LL ~ [first, remainder @ ..] => {}, -LL + &[] => { todo!() }, +LL ~ [first, remainder @ ..] => {} +LL + &[] => { todo!() } | error: aborting due to previous error diff --git a/tests/ui/rfc-2008-non-exhaustive/enum.stderr b/tests/ui/rfc-2008-non-exhaustive/enum.stderr index 555c584dd4f99..2ac649a899fca 100644 --- a/tests/ui/rfc-2008-non-exhaustive/enum.stderr +++ b/tests/ui/rfc-2008-non-exhaustive/enum.stderr @@ -27,7 +27,7 @@ LL | match enum_unit { help: ensure that all possible cases are being handled by adding a wildcard arm | LL ~ NonExhaustiveEnum::Struct { .. } => "third", -LL + _ => { todo!() }, +LL + _ => { todo!() } | error[E0004]: match is non-exhaustive @@ -40,7 +40,7 @@ LL | match enum_unit {}; help: ensure that all possible cases are being handled by adding a wildcard arm | LL ~ match enum_unit { -LL + _ => { todo!() }, +LL + _ => { todo!() } LL ~ }; | diff --git a/tests/ui/rfc-2008-non-exhaustive/enum_same_crate_empty_match.stderr b/tests/ui/rfc-2008-non-exhaustive/enum_same_crate_empty_match.stderr index 1e10f1db12c7d..94b8a95f02ac7 100644 --- a/tests/ui/rfc-2008-non-exhaustive/enum_same_crate_empty_match.stderr +++ b/tests/ui/rfc-2008-non-exhaustive/enum_same_crate_empty_match.stderr @@ -33,9 +33,9 @@ LL | Struct { field: u32 } help: ensure that all possible cases are being handled by adding more match arms | LL ~ match NonExhaustiveEnum::Unit { -LL + NonExhaustiveEnum::Unit => { todo!() }, -LL + NonExhaustiveEnum::Tuple(_) => { todo!() }, -LL + NonExhaustiveEnum::Struct { .. } => { todo!() }, +LL + NonExhaustiveEnum::Unit => { todo!() } +LL + NonExhaustiveEnum::Tuple(_) => { todo!() } +LL + NonExhaustiveEnum::Struct { .. } => { todo!() } LL + } | @@ -62,9 +62,9 @@ LL | Struct { field: u32 } help: ensure that all possible cases are being handled by adding more match arms | LL ~ match NormalEnum::Unit { -LL + NormalEnum::Unit => { todo!() }, -LL + NormalEnum::Tuple(_) => { todo!() }, -LL + NormalEnum::Struct { .. } => { todo!() }, +LL + NormalEnum::Unit => { todo!() } +LL + NormalEnum::Tuple(_) => { todo!() } +LL + NormalEnum::Struct { .. } => { todo!() } LL + } | diff --git a/tests/ui/rfc-2008-non-exhaustive/uninhabited/match.stderr b/tests/ui/rfc-2008-non-exhaustive/uninhabited/match.stderr index 1d15bc598a9eb..8c9d72dd3f7ab 100644 --- a/tests/ui/rfc-2008-non-exhaustive/uninhabited/match.stderr +++ b/tests/ui/rfc-2008-non-exhaustive/uninhabited/match.stderr @@ -65,8 +65,8 @@ LL | match x {} help: ensure that all possible cases are being handled by adding more match arms | LL ~ match x { -LL + UninhabitedVariants::Tuple(_) => { todo!() }, -LL + UninhabitedVariants::Struct { .. } => { todo!() }, +LL + UninhabitedVariants::Tuple(_) => { todo!() } +LL + UninhabitedVariants::Struct { .. } => { todo!() } LL ~ } | diff --git a/tests/ui/rfc-2008-non-exhaustive/uninhabited/match_same_crate.stderr b/tests/ui/rfc-2008-non-exhaustive/uninhabited/match_same_crate.stderr index a9404351a706a..25f5109b97a1c 100644 --- a/tests/ui/rfc-2008-non-exhaustive/uninhabited/match_same_crate.stderr +++ b/tests/ui/rfc-2008-non-exhaustive/uninhabited/match_same_crate.stderr @@ -55,8 +55,8 @@ LL | #[non_exhaustive] Struct { x: ! } help: ensure that all possible cases are being handled by adding more match arms | LL ~ match x { -LL + UninhabitedVariants::Tuple(_) => { todo!() }, -LL + UninhabitedVariants::Struct { .. } => { todo!() }, +LL + UninhabitedVariants::Tuple(_) => { todo!() } +LL + UninhabitedVariants::Struct { .. } => { todo!() } LL ~ } | diff --git a/tests/ui/rfc-2008-non-exhaustive/uninhabited/match_with_exhaustive_patterns.stderr b/tests/ui/rfc-2008-non-exhaustive/uninhabited/match_with_exhaustive_patterns.stderr index 8d0d6c736247c..83e6fe709d1d6 100644 --- a/tests/ui/rfc-2008-non-exhaustive/uninhabited/match_with_exhaustive_patterns.stderr +++ b/tests/ui/rfc-2008-non-exhaustive/uninhabited/match_with_exhaustive_patterns.stderr @@ -65,8 +65,8 @@ LL | match x {} help: ensure that all possible cases are being handled by adding more match arms | LL ~ match x { -LL + UninhabitedVariants::Tuple(_) => { todo!() }, -LL + UninhabitedVariants::Struct { .. } => { todo!() }, +LL + UninhabitedVariants::Tuple(_) => { todo!() } +LL + UninhabitedVariants::Struct { .. } => { todo!() } LL ~ } | diff --git a/tests/ui/uninhabited/uninhabited-matches-feature-gated.stderr b/tests/ui/uninhabited/uninhabited-matches-feature-gated.stderr index 4b988bf07b354..7673c86f7867e 100644 --- a/tests/ui/uninhabited/uninhabited-matches-feature-gated.stderr +++ b/tests/ui/uninhabited/uninhabited-matches-feature-gated.stderr @@ -8,7 +8,7 @@ LL | let _ = match x { help: ensure that all possible cases are being handled by adding an arm to handle the `Err(_)` case | LL ~ Ok(n) => n, -LL + Err(_) => { todo!() }, +LL + Err(_) => { todo!() } | error[E0004]: non-exhaustive patterns: type `&Void` is non-empty @@ -69,7 +69,7 @@ LL | let _ = match x { help: ensure that all possible cases are being handled by adding an arm to handle the `&[_, ..]` case | LL ~ &[] => (), -LL + &[_, ..] => { todo!() }, +LL + &[_, ..] => { todo!() } | error[E0004]: match is non-exhaustive @@ -82,7 +82,7 @@ LL | let _ = match x { help: ensure that all possible cases are being handled by adding an arm to handle the `Err(_)` case | LL ~ Ok(x) => x, -LL + Err(_) => { todo!() }, +LL + Err(_) => { todo!() } | error[E0005]: refutable pattern in local binding From 2e7bca1a42bfaa121ee1ccb0290270322f3c7aa1 Mon Sep 17 00:00:00 2001 From: mejrs <59372212+mejrs@users.noreply.github.com> Date: Sun, 12 Mar 2023 15:49:19 +0100 Subject: [PATCH 11/11] Fix up the rebase :( --- compiler/rustc_mir_build/src/errors.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/compiler/rustc_mir_build/src/errors.rs b/compiler/rustc_mir_build/src/errors.rs index 8e2ca40e3b165..01d5a51d0106c 100644 --- a/compiler/rustc_mir_build/src/errors.rs +++ b/compiler/rustc_mir_build/src/errors.rs @@ -941,6 +941,9 @@ pub enum RustcBoxAttrReason { NotBoxNew, #[note(mir_build_missing_box)] MissingBox, +} + +#[derive(Diagnostic)] #[diag(mir_build_non_exhaustive_pattern, code = "E0004")] pub(crate) struct NonExhaustivePatterns<'tcx> { #[primary_span]