diff --git a/compiler/rustc_mir_build/messages.ftl b/compiler/rustc_mir_build/messages.ftl index 93e7fb330e093..c55ac6c54af52 100644 --- a/compiler/rustc_mir_build/messages.ftl +++ b/compiler/rustc_mir_build/messages.ftl @@ -176,11 +176,8 @@ 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 - .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 +372,25 @@ 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 + +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 + +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 dc4d2276e4aab..01d5a51d0106c 100644 --- a/compiler/rustc_mir_build/src/errors.rs +++ b/compiler/rustc_mir_build/src/errors.rs @@ -1,6 +1,9 @@ use crate::{ fluent_generated as fluent, - thir::pattern::{deconstruct_pat::DeconstructedPat, MatchCheckCtxt}, + thir::pattern::{ + deconstruct_pat::{Constructor, DeconstructedPat}, + MatchCheckCtxt, + }, }; use rustc_errors::{ error_code, AddToDiagnostic, Applicability, Diagnostic, DiagnosticBuilder, ErrorGuaranteed, @@ -9,7 +12,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)] @@ -352,7 +355,9 @@ 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>, + pub type_note: TypeNote<'tcx>, + pub ref_note: Option, } impl<'a> IntoDiagnostic<'a> for NonExhaustivePatternsTypeNotEmpty<'_, '_, '_> { @@ -363,8 +368,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,23 +389,15 @@ 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() { - ty::Adt(def, _) if def.is_variant_list_non_exhaustive() && !def.did().is_local() => { - true + match self.type_note { + TypeNote::MarkedExhaustive { .. } => { + diag.note(fluent::mir_build_type_note_non_exhaustive) } - _ => false, + TypeNote::NotMarkedExhaustive { .. } => diag.note(fluent::mir_build_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.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; @@ -760,7 +757,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 { @@ -805,14 +802,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> { @@ -823,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); } @@ -907,3 +942,163 @@ pub enum RustcBoxAttrReason { #[note(mir_build_missing_box)] MissingBox, } + +#[derive(Diagnostic)] +#[diag(mir_build_non_exhaustive_pattern, code = "E0004")] +pub(crate) struct NonExhaustivePatterns<'tcx> { + #[primary_span] + pub span: Span, + #[subdiagnostic] + pub uncovered: Uncovered<'tcx>, + #[subdiagnostic] + pub adt_defined_here: Option>, + #[subdiagnostic] + pub type_note: TypeNote<'tcx>, + #[subdiagnostic] + pub no_fixed_max_value: Option>, + #[subdiagnostic] + pub ppsm: Option>, + #[subdiagnostic] + pub ref_note: Option, + #[subdiagnostic] + pub suggest_arms: ArmSuggestions<'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 }, + } + } +} + +#[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> { + pub scrut_ty: Ty<'tcx>, +} + +#[derive(Subdiagnostic)] +#[help(mir_build_suggest_precise_pointer_size_matching)] +pub struct SuggestPrecisePointerSizeMatching<'tcx> { + pub scrut_ty: Ty<'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 => fluent::mir_build_suggest_wildcard_arm, + AddArmKind::Single { pat } => { + diag.set_arg("pat", pat); + fluent::mir_build_suggest_single_arm + } + AddArmKind::Multiple => 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 => fluent::mir_build_suggest_wildcard_arm, + AddArmKind::Single { pat } => { + diag.set_arg("pat", pat); + fluent::mir_build_suggest_single_arm + } + AddArmKind::Multiple => 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 2640ca56b00e9..e5e7b1db2ca2e 100644 --- a/compiler/rustc_mir_build/src/thir/pattern/check_match.rs +++ b/compiler/rustc_mir_build/src/thir/pattern/check_match.rs @@ -4,26 +4,23 @@ use super::usefulness::{ }; use super::{PatCtxt, PatternError}; -use crate::errors::*; +use crate::errors; 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_data_structures::stack::ensure_sufficient_stack; 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, AdtDef, Ty, TyCtxt}; - +use rustc_middle::ty::{self, 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, @@ -67,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) @@ -111,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 }); } } } @@ -358,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) { @@ -368,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 } @@ -401,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, } @@ -434,31 +423,19 @@ 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 { - 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(Variant { span }); - } - 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: (), @@ -466,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), }); } } @@ -495,7 +472,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`. @@ -525,7 +502,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, + }, ); } @@ -543,7 +523,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 }); }}; } @@ -605,7 +585,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, @@ -615,251 +595,134 @@ 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. - let mut err; - let pattern; - let patterns_len; if is_empty_match && !non_empty_enum { - cx.tcx.sess.emit_err(NonExhaustivePatternsTypeNotEmpty { + cx.tcx.sess.emit_err(errors::NonExhaustivePatternsTypeNotEmpty { cx, expr_span, - span: sp, - ty: scrut_ty, + span, + scrut_ty, + type_note: errors::TypeNote::new(scrut_ty), + ref_note, }); return; - } 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() - }; - }; + } - 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, + 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, }; - adt_defined_here(cx, &mut err, scrut_ty, &witnesses); - 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 - && 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, - )); - 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, - )); - } - } - 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 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 is_oneliner = false; - let mut suggestion = None; let sm = cx.tcx.sess.source_map(); match arms { - [] if sp.eq_ctxt(expr_span) => { - // Get the span for the empty match body `{}`. - let (indentation, more) = if let Some(snippet) = sm.indentation_before(sp) { - (format!("\n{}", snippet), " ") - } else { - (" ".to_string(), "") - }; - suggestion = Some(( - sp.shrink_to_hi().with_hi(expr_span.hi()), - format!( - " {{{indentation}{more}{pattern} => todo!(),{indentation}}}", - indentation = indentation, - more = more, - pattern = pattern, - ), - )); + // 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())); } - [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 == ',') + [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) { - (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 - { - "" + if !(matches!(body.kind, hir::ExprKind::Block(..)) && span.eq_ctxt(body.span)) { + prefix.push_str(","); + } + prefix.push_str("\n"); + indentation.push_str(&indent); } else { - "," + is_oneliner = true; }; - suggestion = Some(( - only.span.shrink_to_hi(), - format!("{}{}{} => todo!()", comma, pre_indentation, pattern), - )); - } + suggestion_span = Some(span.shrink_to_hi()); + } [.., 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}")) + 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 { - Some(" ".to_string()) + is_oneliner = true; }; - if let Some(spacing) = spacing { - suggestion = Some(( - last.span.shrink_to_hi(), - format!("{}{}{} => todo!()", comma, spacing, pattern), - )); - } + suggestion_span = Some(last.span.shrink_to_hi()); } _ => {} } - 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" + let suggest_arms = if let Some(span) = suggestion_span { + if is_oneliner { + errors::ArmSuggestions::OneLiner { + span, + pattern: if let [pat] = &*arm_suggestions { + pat.clone() + } else { + thir::Pat::wildcard_from_ty(scrut_ty) + }, + suggest_msg, + } } 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); + errors::ArmSuggestions::MultipleLines { + span, + prefix, + indentation, + postfix, + arm_suggestions, + suggest_msg, + } + } } else { - err.help(&msg); - } - err.emit(); -} + errors::ArmSuggestions::Help { suggest_msg } + }; -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()) - } - } -} + 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, + ref_note, + suggest_arms, + }; -pub(crate) fn pattern_not_covered_label( - witnesses: &[DeconstructedPat<'_, '_>], - joined_patterns: &str, -) -> String { - format!("pattern{} {} not covered", rustc_errors::pluralize!(witnesses.len()), joined_patterns) -} + 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.no_fixed_max_value = Some(errors::NoFixedMaxValue { scrut_ty }); -/// 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"); + if cx.tcx.sess.is_nightly_build() { + err.ppsm = Some(errors::SuggestPrecisePointerSizeMatching { scrut_ty }); } - 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 + 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`. @@ -900,7 +763,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, @@ -930,17 +793,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. } @@ -951,8 +814,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); @@ -961,20 +824,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 }); } } 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/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..aa6acec523b44 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 { @@ -10,13 +10,14 @@ 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]: 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 { @@ -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.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..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 @@ -1,19 +1,19 @@ -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 => () } }; | ^^ 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 +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 @@ -34,22 +34,17 @@ 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 => () } }; | ^^ 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 +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.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..8e89bf34fe658 100644 --- a/tests/ui/consts/const_in_pattern/incomplete-slice.stderr +++ b/tests/ui/consts/const_in_pattern/incomplete-slice.stderr @@ -8,17 +8,17 @@ 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 &[][..] { | ^^^^^^^ 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 + &_ => { 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 e829bac196f79..5b4388dc689c6 100644 --- a/tests/ui/error-codes/E0004-2.stderr +++ b/tests/ui/error-codes/E0004-2.stderr @@ -1,22 +1,15 @@ -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 { } | ^ 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 +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 4ac8c904f0530..b50c20f982525 100644 --- a/tests/ui/error-codes/E0004.stderr +++ b/tests/ui/error-codes/E0004.stderr @@ -1,21 +1,21 @@ -error[E0004]: non-exhaustive patterns: `Terminator::HastaLaVistaBaby` not covered +error[E0004]: match is non-exhaustive --> $DIR/E0004.rs:9:11 | 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 +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::HastaLaVistaBaby => { todo!() } | error: aborting due to previous error 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..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 @@ -99,24 +99,24 @@ 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 { | ^^^^^^ 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 +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.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..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 @@ -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 { @@ -7,13 +7,13 @@ 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 + _ => { 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 { @@ -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 + _ => { todo!() } | error: aborting due to 2 previous errors 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..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 @@ -1,818 +1,818 @@ -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..); | ^^^^ 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]: 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); | ^^^^ 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]: 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); | ^^^ 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]: 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); | ^^^ 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]: 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..); | ^^^ 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]: 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); | ^^^ 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]: 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..); | ^^^ 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]: 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..); | ^^^ 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]: 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); | ^ 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]: 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); | ^ 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]: 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..); | ^ 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]: 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); | ^ 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]: 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..); | ^ 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]: 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..); | ^ 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]: 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); | ^ 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]: 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); | ^ 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]: 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..); | ^ 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]: 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); | ^ 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]: 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..); | ^ 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]: 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..); | ^ 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]: 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); | ^ 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]: 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); | ^ 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]: 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..); | ^ 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]: 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); | ^ 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]: 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..); | ^ 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]: 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..); | ^ 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]: 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); | ^ 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]: 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); | ^ 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]: 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..); | ^ 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]: 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); | ^ 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]: 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..); | ^ 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]: 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..); | ^ 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]: 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); | ^ 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]: 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); | ^ 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]: 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..); | ^ 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]: 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); | ^ 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]: 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..); | ^ 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]: 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..); | ^ 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]: 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); | ^ 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]: 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); | ^ 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]: 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..); | ^ 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]: 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); | ^ 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]: 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..); | ^ 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]: 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..); | ^ 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]: 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); | ^ 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]: 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); | ^ 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]: 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..); | ^ 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]: 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); | ^ 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]: 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..); | ^ 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]: 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..); | ^ 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]: 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); | ^ 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]: 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); | ^ 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]: 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..); | ^ 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]: 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); | ^ 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]: 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..); | ^ 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]: 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..); | ^ 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]: 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); | ^ 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]: 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); | ^ 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]: 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..); | ^ 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]: 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); | ^ 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]: 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..); | ^ 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]: 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..); | ^ 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]: 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); | ^ 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]: 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); | ^ 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]: 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..); | ^ 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]: 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); | ^ 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]: 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..); | ^ 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]: 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..); | ^ 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.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..2a73f1b0268b7 100644 --- a/tests/ui/issue-94866.stderr +++ b/tests/ui/issue-94866.stderr @@ -1,19 +1,19 @@ -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 { | ^^^^^^^ 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 +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.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..efba07957c000 100644 --- a/tests/ui/match/match_non_exhaustive.stderr +++ b/tests/ui/match/match_non_exhaustive.stderr @@ -1,19 +1,19 @@ -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 => () }; | ^ 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 +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 @@ -34,22 +34,17 @@ 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 => () }; | ^^ 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 +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.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..410f726afc470 100644 --- a/tests/ui/or-patterns/exhaustiveness-non-exhaustive.stderr +++ b/tests/ui/or-patterns/exhaustiveness-non-exhaustive.stderr @@ -1,40 +1,40 @@ -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) { | ^^^^^^^^^^ 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 + (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,),) { | ^^^^^^^^^ 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 + ((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),) { | ^^^^^^^^^^^^ 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 + (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.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..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 @@ -12,17 +12,18 @@ 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 { | ^ 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 + 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 b28dce8810593..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 @@ -1,10 +1,11 @@ // 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(_) => {} - None => todo!() + None => { todo!() } + } } 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..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 @@ -1,19 +1,14 @@ -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) { | ^^^^^^^ 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 +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.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..5a12b5bbe1b79 100644 --- a/tests/ui/pattern/usefulness/doc-hidden-non-exhaustive.stderr +++ b/tests/ui/pattern/usefulness/doc-hidden-non-exhaustive.stderr @@ -1,100 +1,76 @@ -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 { | ^^^^^^^^^^^^^ 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 +help: ensure that all possible cases are being handled by adding a wildcard arm | LL ~ HiddenEnum::B => {} -LL + _ => todo!() +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 { | ^^^^^^^^^^^^^ 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 +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]: 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 { | ^^^^^^^^^^^^^ 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 +help: ensure that all possible cases are being handled by adding more match arms | LL ~ HiddenEnum::A => {} -LL + HiddenEnum::B | _ => todo!() +LL + HiddenEnum::B => { todo!() } +LL + _ => { 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 { | ^^^^ 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 +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]: 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 { | ^^^^^^^^^^ 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 +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 5e12bc1d22f01..136d1560473f0 100644 --- a/tests/ui/pattern/usefulness/empty-match.exhaustive_patterns.stderr +++ b/tests/ui/pattern/usefulness/empty-match.exhaustive_patterns.stderr @@ -105,41 +105,41 @@ 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)); | ^^^^^^^^^^^^^^^^^^^^^^^^ 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 + = help: ensure that all possible cases are being handled by adding an arm to handle the `NonEmptyEnum1::Foo(_)` case -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)); | ^^^^^^^^^^^^^^^^^^^^^^^^ 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 + = help: ensure that all possible cases are being handled by adding more 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); @@ -150,23 +150,30 @@ 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 + = help: ensure that all possible cases are being handled by adding more 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); | ^^^ 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 + _ => { 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); @@ -178,13 +185,13 @@ 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 + 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)); @@ -196,13 +203,13 @@ 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 + 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: () })); @@ -214,13 +221,13 @@ 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 + 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: () })); @@ -232,55 +239,56 @@ 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 + 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)); | ^^^^^^^^^^^^^^^^^^^^^^^^ 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 +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 + 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)); | ^^^^^^^^^^^^^^^^^^^^^^^^ 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 +help: ensure that all possible cases are being handled by adding more match arms | LL ~ _ if false => {} -LL + NonEmptyEnum2::Foo(_) | NonEmptyEnum2::Bar => todo!() +LL + NonEmptyEnum2::Foo(_) => { todo!() } +LL + 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); @@ -291,11 +299,21 @@ 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 +help: ensure that all possible cases are being handled by adding more match arms | LL ~ _ if false => {} -LL + _ => todo!() +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 5e12bc1d22f01..136d1560473f0 100644 --- a/tests/ui/pattern/usefulness/empty-match.normal.stderr +++ b/tests/ui/pattern/usefulness/empty-match.normal.stderr @@ -105,41 +105,41 @@ 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)); | ^^^^^^^^^^^^^^^^^^^^^^^^ 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 + = help: ensure that all possible cases are being handled by adding an arm to handle the `NonEmptyEnum1::Foo(_)` case -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)); | ^^^^^^^^^^^^^^^^^^^^^^^^ 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 + = help: ensure that all possible cases are being handled by adding more 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); @@ -150,23 +150,30 @@ 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 + = help: ensure that all possible cases are being handled by adding more 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); | ^^^ 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 + _ => { 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); @@ -178,13 +185,13 @@ 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 + 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)); @@ -196,13 +203,13 @@ 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 + 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: () })); @@ -214,13 +221,13 @@ 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 + 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: () })); @@ -232,55 +239,56 @@ 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 + 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)); | ^^^^^^^^^^^^^^^^^^^^^^^^ 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 +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 + 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)); | ^^^^^^^^^^^^^^^^^^^^^^^^ 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 +help: ensure that all possible cases are being handled by adding more match arms | LL ~ _ if false => {} -LL + NonEmptyEnum2::Foo(_) | NonEmptyEnum2::Bar => todo!() +LL + NonEmptyEnum2::Foo(_) => { todo!() } +LL + 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); @@ -291,11 +299,21 @@ 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 +help: ensure that all possible cases are being handled by adding more match arms | LL ~ _ if false => {} -LL + _ => todo!() +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.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..9e65b6a27da51 100644 --- a/tests/ui/pattern/usefulness/floats.stderr +++ b/tests/ui/pattern/usefulness/floats.stderr @@ -1,14 +1,14 @@ -error[E0004]: non-exhaustive patterns: `_` not covered +error[E0004]: match is non-exhaustive --> $DIR/floats.rs:10:11 | 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 + _ => { todo!() } | error: unreachable pattern 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..f18a917d01081 100644 --- a/tests/ui/pattern/usefulness/guards.stderr +++ b/tests/ui/pattern/usefulness/guards.stderr @@ -1,14 +1,14 @@ -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 { | ^^^ 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.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..c7ff20f17a532 100644 --- a/tests/ui/pattern/usefulness/integer-ranges/exhaustiveness.stderr +++ b/tests/ui/pattern/usefulness/integer-ranges/exhaustiveness.stderr @@ -1,147 +1,147 @@ -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); | ^^^ 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]: non-exhaustive patterns: `u8::MAX` not covered +error[E0004]: match is non-exhaustive --> $DIR/exhaustiveness.rs:48:8 | 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]: non-exhaustive patterns: `0_u8` not covered +error[E0004]: match is non-exhaustive --> $DIR/exhaustiveness.rs:49:8 | 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]: 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); | ^^^ 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]: non-exhaustive patterns: `i8::MAX` not covered +error[E0004]: match is non-exhaustive --> $DIR/exhaustiveness.rs:51:8 | 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]: non-exhaustive patterns: `i8::MAX` not covered +error[E0004]: match is non-exhaustive --> $DIR/exhaustiveness.rs:52:8 | 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]: non-exhaustive patterns: `i8::MIN` not covered +error[E0004]: match is non-exhaustive --> $DIR/exhaustiveness.rs:53:8 | 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]: non-exhaustive patterns: `0_i8` not covered +error[E0004]: match is non-exhaustive --> $DIR/exhaustiveness.rs:54:11 | 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]: non-exhaustive patterns: `u128::MAX` not covered +error[E0004]: match is non-exhaustive --> $DIR/exhaustiveness.rs:59:8 | 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]: 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); | ^^^^^ 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]: non-exhaustive patterns: `0_u128` not covered +error[E0004]: match is non-exhaustive --> $DIR/exhaustiveness.rs:61:8 | 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]: 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) { | ^^^^^^^^^^^ 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 e3eb98ccdcda5..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 @@ -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 { @@ -7,13 +7,13 @@ 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 + _ => { todo!() } | -error[E0004]: non-exhaustive patterns: `_` not covered +error[E0004]: match is non-exhaustive --> $DIR/pointer-sized-int.rs:17:11 | LL | match 0isize { @@ -22,13 +22,13 @@ 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 + _ => { 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); @@ -37,12 +37,12 @@ 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]: 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); @@ -51,12 +51,12 @@ 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]: 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); @@ -65,24 +65,24 @@ 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]: 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)); | ^^^^^^^^^^^^^^ 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]: 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); @@ -91,12 +91,12 @@ 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]: 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); @@ -105,12 +105,12 @@ 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]: 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); @@ -119,24 +119,24 @@ 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]: 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) | ^^^^^^^^^^^^^^ 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]: non-exhaustive patterns: `_` not covered +error[E0004]: match is non-exhaustive --> $DIR/pointer-sized-int.rs:41:11 | LL | match 0isize { @@ -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/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..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 @@ -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 { @@ -7,13 +7,13 @@ 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 + _ => { 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 { @@ -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 + _ => { todo!() } | error: aborting due to 2 previous errors 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..505b8fbb908cf 100644 --- a/tests/ui/pattern/usefulness/issue-15129.stderr +++ b/tests/ui/pattern/usefulness/issue-15129.stderr @@ -1,14 +1,15 @@ -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)) { | ^^^^^^^^^^^^^^^^^^^^^^^^ 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.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..16b0cedae63c7 100644 --- a/tests/ui/pattern/usefulness/issue-2111.stderr +++ b/tests/ui/pattern/usefulness/issue-2111.stderr @@ -1,14 +1,15 @@ -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) { | ^^^^^^ 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.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..5f14cc6b0379a 100644 --- a/tests/ui/pattern/usefulness/issue-30240.stderr +++ b/tests/ui/pattern/usefulness/issue-30240.stderr @@ -1,27 +1,27 @@ -error[E0004]: non-exhaustive patterns: `&_` not covered +error[E0004]: match is non-exhaustive --> $DIR/issue-30240.rs:2:11 | 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[E0004]: non-exhaustive patterns: `&_` not covered +error[E0004]: match is non-exhaustive --> $DIR/issue-30240.rs:6:11 | 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 12113957d6340..8e96785ae81da 100644 --- a/tests/ui/pattern/usefulness/issue-35609.stderr +++ b/tests/ui/pattern/usefulness/issue-35609.stderr @@ -1,69 +1,84 @@ -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, ()) { | ^^^^^^^ 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 + (Enum::B, _) => { todo!() } +LL + (Enum::C, _) => { todo!() } +LL + (Enum::D, _) => { todo!() } +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) { | ^^^^^^ 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 + (_, Enum::B) => { todo!() } +LL + (_, Enum::C) => { todo!() } +LL + (_, Enum::D) => { todo!() } +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, ()), ()) { | ^^^^^^^^^^^^^ 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 + ((Enum::B, _), _) => { todo!() } +LL + ((Enum::C, _), _) => { todo!() } +LL + ((Enum::D, _), _) => { todo!() } +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) { | ^^^^^^^^^^^^ 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 + ((Enum::B, _), _) => { todo!() } +LL + ((Enum::C, _), _) => { todo!() } +LL + ((Enum::D, _), _) => { todo!() } +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, ()), ()) { | ^^^^^^^^^^^^^ 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 + ((Enum::B, _), _) => { todo!() } +LL + ((Enum::C, _), _) => { todo!() } +LL + ((Enum::D, _), _) => { todo!() } +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, ()) { @@ -75,13 +90,16 @@ 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(Enum::B, _) => { todo!() } +LL + S(Enum::C, _) => { todo!() } +LL + S(Enum::D, _) => { todo!() } +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: () }) { @@ -93,25 +111,29 @@ 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: Enum::B, .. } => { todo!() } +LL + Sd { x: Enum::C, .. } => { todo!() } +LL + Sd { x: Enum::D, .. } => { todo!() } +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) { | ^^^^^^^ 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 +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.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..743124b2e2aef 100644 --- a/tests/ui/pattern/usefulness/issue-3601.stderr +++ b/tests/ui/pattern/usefulness/issue-3601.stderr @@ -1,16 +1,14 @@ -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 { | ^^^^^^^ 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 +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 _ => { todo!() } | error: aborting due to previous error 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..6ee885a75ea5f 100644 --- a/tests/ui/pattern/usefulness/issue-39362.stderr +++ b/tests/ui/pattern/usefulness/issue-39362.stderr @@ -1,21 +1,24 @@ -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 { | ^ 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 +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.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..33f15da8676c0 100644 --- a/tests/ui/pattern/usefulness/issue-40221.stderr +++ b/tests/ui/pattern/usefulness/issue-40221.stderr @@ -1,21 +1,21 @@ -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 { | ^^^^^ 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 +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.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..cf48dc37914c8 100644 --- a/tests/ui/pattern/usefulness/issue-4321.stderr +++ b/tests/ui/pattern/usefulness/issue-4321.stderr @@ -1,14 +1,14 @@ -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 { | ^^^ 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.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..b0a4e4ff33fdf 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 { @@ -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(Context::Exif, _) => { todo!() } | error: aborting due to previous error 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..4233e17d4226b 100644 --- a/tests/ui/pattern/usefulness/issue-56379.stderr +++ b/tests/ui/pattern/usefulness/issue-56379.stderr @@ -1,25 +1,27 @@ -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) { | ^^^^^^^^^^^^ 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 +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.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..f9b8d5011dc0c 100644 --- a/tests/ui/pattern/usefulness/issue-72377.stderr +++ b/tests/ui/pattern/usefulness/issue-72377.stderr @@ -1,14 +1,17 @@ -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) { | ^^^^^^ 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.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..1585e9dd19303 100644 --- a/tests/ui/pattern/usefulness/match-arm-statics-2.stderr +++ b/tests/ui/pattern/usefulness/match-arm-statics-2.stderr @@ -1,37 +1,30 @@ -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) { | ^^^^^^^^^^^^^ 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]: 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)) { | ^^^^^^^^^^^^^^^^^ 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 +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]: 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) }) { @@ -43,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 a90f32f7aebf3..e05b277527b0d 100644 --- a/tests/ui/pattern/usefulness/match-byte-array-patterns-2.stderr +++ b/tests/ui/pattern/usefulness/match-byte-array-patterns-2.stderr @@ -1,27 +1,31 @@ -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 { | ^^^ 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 + &[0_u8..=64_u8, _, _, _] => { todo!() } +LL + &[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 { | ^^^ 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 + &[] => { todo!() } +LL + &[_] => { todo!() } +LL + &[_, _] => { todo!() } +LL + _ => { todo!() } | error: aborting due to 2 previous errors 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..c3b90950ed258 100644 --- a/tests/ui/pattern/usefulness/match-non-exhaustive.stderr +++ b/tests/ui/pattern/usefulness/match-non-exhaustive.stderr @@ -1,26 +1,26 @@ -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 => () } | ^ 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]: non-exhaustive patterns: `_` not covered +error[E0004]: match is non-exhaustive --> $DIR/match-non-exhaustive.rs:3:11 | 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.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..2f2d0607a9855 100644 --- a/tests/ui/pattern/usefulness/match-privately-empty.stderr +++ b/tests/ui/pattern/usefulness/match-privately-empty.stderr @@ -1,19 +1,14 @@ -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 { | ^^^^^^^^^^^^^ 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 +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.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..608e821c85821 100644 --- a/tests/ui/pattern/usefulness/match-slice-patterns.stderr +++ b/tests/ui/pattern/usefulness/match-slice-patterns.stderr @@ -1,14 +1,14 @@ -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 { | ^^^^ 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.rs b/tests/ui/pattern/usefulness/non-exhaustive-defined-here.rs index 5145f769075d9..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 @@ -32,7 +29,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 +45,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 +61,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 => {} @@ -79,18 +76,17 @@ 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 } 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..5d260df0f55e0 100644 --- a/tests/ui/pattern/usefulness/non-exhaustive-defined-here.stderr +++ b/tests/ui/pattern/usefulness/non-exhaustive-defined-here.stderr @@ -1,29 +1,30 @@ -error[E0004]: non-exhaustive patterns: `E::B` and `E::C` not covered - --> $DIR/non-exhaustive-defined-here.rs:35:11 +error[E0004]: match is non-exhaustive + --> $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 +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::B => { todo!() } +LL + 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 @@ -47,32 +48,33 @@ 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 - --> $DIR/non-exhaustive-defined-here.rs:50:11 +error[E0004]: match is non-exhaustive + --> $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 +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::B => { todo!() } +LL + &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 @@ -96,32 +98,33 @@ 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 - --> $DIR/non-exhaustive-defined-here.rs:66:11 +error[E0004]: match is non-exhaustive + --> $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 +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 + &&mut &E::B => { todo!() } +LL + &&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 @@ -145,29 +148,29 @@ 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 - --> $DIR/non-exhaustive-defined-here.rs:92:11 +error[E0004]: match is non-exhaustive + --> $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 +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::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 +178,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.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..ea250babe8c6b 100644 --- a/tests/ui/pattern/usefulness/non-exhaustive-match-nested.stderr +++ b/tests/ui/pattern/usefulness/non-exhaustive-match-nested.stderr @@ -1,32 +1,32 @@ -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) { | ^^^^^^^^ 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]: 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 { | ^ 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 +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.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..66efa45c97565 100644 --- a/tests/ui/pattern/usefulness/non-exhaustive-match.stderr +++ b/tests/ui/pattern/usefulness/non-exhaustive-match.stderr @@ -1,119 +1,116 @@ -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 => { } } | ^ 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 +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]: non-exhaustive patterns: `false` not covered +error[E0004]: match is non-exhaustive --> $DIR/non-exhaustive-match.rs:8:11 | 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 + 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) { | ^^^^^^^^ 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 +help: ensure that all possible cases are being handled by adding an arm to handle the `Some(_)` case | LL ~ None => {} -LL + Some(_) => todo!() +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) { | ^^^^^^^^^ 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 + (_, _, i32::MIN..=3_i32) => { todo!() } +LL + (_, _, 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) { | ^^^^^^^^^^^^ 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]: non-exhaustive patterns: `T::B` not covered +error[E0004]: match is non-exhaustive --> $DIR/non-exhaustive-match.rs:22:11 | 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 +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::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 { | ^^^^ 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]: non-exhaustive patterns: `[_, _, _, _, ..]` not covered +error[E0004]: match is non-exhaustive --> $DIR/non-exhaustive-match.rs:46:11 | 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.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..5cd00bb4b0612 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 }) { @@ -10,56 +10,58 @@ 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]: 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 { | ^^^^^^^^^^ 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 +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]: 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 { | ^^^^^^^^^^^^^^^^ 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 = 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]: 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 { @@ -70,58 +72,68 @@ 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 +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]: 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 | 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 +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]: 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 | = 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]: 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 | = 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.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..90c0e78584424 100644 --- a/tests/ui/pattern/usefulness/slice-patterns-exhaustiveness.stderr +++ b/tests/ui/pattern/usefulness/slice-patterns-exhaustiveness.stderr @@ -1,261 +1,265 @@ -error[E0004]: non-exhaustive patterns: `&[false, _]` not covered +error[E0004]: match is non-exhaustive --> $DIR/slice-patterns-exhaustiveness.rs:8:11 | 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 + &[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 { | ^^ 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 + &[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 { | ^^^ 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 + &[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 { | ^^ 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]: non-exhaustive patterns: `&[false, .., true]` not covered +error[E0004]: match is non-exhaustive --> $DIR/slice-patterns-exhaustiveness.rs:30:11 | 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]: non-exhaustive patterns: `&[false, .., true]` not covered +error[E0004]: match is non-exhaustive --> $DIR/slice-patterns-exhaustiveness.rs:35:11 | 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]: non-exhaustive patterns: `&[_, ..]` not covered +error[E0004]: match is non-exhaustive --> $DIR/slice-patterns-exhaustiveness.rs:42:11 | 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]: non-exhaustive patterns: `&[_, _, ..]` not covered +error[E0004]: match is non-exhaustive --> $DIR/slice-patterns-exhaustiveness.rs:46:11 | 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]: non-exhaustive patterns: `&[false, ..]` not covered +error[E0004]: match is non-exhaustive --> $DIR/slice-patterns-exhaustiveness.rs:51:11 | 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]: non-exhaustive patterns: `&[false, _, ..]` not covered +error[E0004]: match is non-exhaustive --> $DIR/slice-patterns-exhaustiveness.rs:56:11 | 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]: non-exhaustive patterns: `&[_, .., false]` not covered +error[E0004]: match is non-exhaustive --> $DIR/slice-patterns-exhaustiveness.rs:62:11 | 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]: non-exhaustive patterns: `&[_, _, .., true]` not covered +error[E0004]: match is non-exhaustive --> $DIR/slice-patterns-exhaustiveness.rs:69:11 | 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]: non-exhaustive patterns: `&[true, _, .., _]` not covered +error[E0004]: match is non-exhaustive --> $DIR/slice-patterns-exhaustiveness.rs:76:11 | 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]: non-exhaustive patterns: `&[]` and `&[_, _, ..]` not covered +error[E0004]: match is non-exhaustive --> $DIR/slice-patterns-exhaustiveness.rs:85: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 + &[] => { todo!() } +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 { | ^ 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]: non-exhaustive patterns: `&[]` and `&[_, _, ..]` not covered +error[E0004]: match is non-exhaustive --> $DIR/slice-patterns-exhaustiveness.rs:93: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]: non-exhaustive patterns: `&[]` and `&[_, _, ..]` not covered +error[E0004]: match is non-exhaustive --> $DIR/slice-patterns-exhaustiveness.rs:98: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]: non-exhaustive patterns: `&[_, _, ..]` not covered +error[E0004]: match is non-exhaustive --> $DIR/slice-patterns-exhaustiveness.rs:103:11 | 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]: non-exhaustive patterns: `&[false]` not covered +error[E0004]: match is non-exhaustive --> $DIR/slice-patterns-exhaustiveness.rs:108:11 | 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]: non-exhaustive patterns: `&[false]` not covered +error[E0004]: match is non-exhaustive --> $DIR/slice-patterns-exhaustiveness.rs:121:11 | 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 + &[false] => { todo!() } | error: aborting due to 20 previous errors 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..b223861175fe9 100644 --- a/tests/ui/pattern/usefulness/stable-gated-patterns.stderr +++ b/tests/ui/pattern/usefulness/stable-gated-patterns.stderr @@ -1,40 +1,28 @@ -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 { | ^^^^^^^^^^^^^^^^^^^^ 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 +help: ensure that all possible cases are being handled by adding more match arms | LL ~ UnstableEnum::Stable => {} -LL + UnstableEnum::Stable2 | _ => todo!() +LL + UnstableEnum::Stable2 => { todo!() } +LL + _ => { 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 { | ^^^^^^^^^^^^^^^^^^^^ 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 +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.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..af1784a88241f 100644 --- a/tests/ui/pattern/usefulness/struct-like-enum-nonexhaustive.stderr +++ b/tests/ui/pattern/usefulness/struct-like-enum-nonexhaustive.stderr @@ -1,21 +1,21 @@ -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 { | ^ 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 +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 e2a65ff852404..629a52e161357 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 { @@ -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.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..caa2939803815 100644 --- a/tests/ui/pattern/usefulness/type_polymorphic_byte_str_literals.stderr +++ b/tests/ui/pattern/usefulness/type_polymorphic_byte_str_literals.stderr @@ -1,27 +1,30 @@ -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 { | ^^^^ 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]: 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 { | ^^^^ 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.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..fc00c7c3dbcf0 100644 --- a/tests/ui/pattern/usefulness/unstable-gated-patterns.stderr +++ b/tests/ui/pattern/usefulness/unstable-gated-patterns.stderr @@ -1,22 +1,14 @@ -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 { | ^^^^^^^^^^^^^^^^^^^^ 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 +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.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..9bede81fd8951 100644 --- a/tests/ui/rfc-2005-default-binding-mode/slice.stderr +++ b/tests/ui/rfc-2005-default-binding-mode/slice.stderr @@ -1,14 +1,14 @@ -error[E0004]: non-exhaustive patterns: `&[]` not covered +error[E0004]: match is non-exhaustive --> $DIR/slice.rs:4:11 | 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 + &[] => { todo!() } | error: aborting due to previous error 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..2ac649a899fca 100644 --- a/tests/ui/rfc-2008-non-exhaustive/enum.stderr +++ b/tests/ui/rfc-2008-non-exhaustive/enum.stderr @@ -17,40 +17,30 @@ 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 { | ^^^^^^^^^ 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 +help: ensure that all possible cases are being handled by adding a wildcard arm | LL ~ NonExhaustiveEnum::Struct { .. } => "third", -LL + _ => todo!() +LL + _ => { todo!() } | -error[E0004]: non-exhaustive patterns: `_` not covered +error[E0004]: match is non-exhaustive --> $DIR/enum.rs:23:11 | 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 +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.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..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 @@ -10,57 +10,61 @@ 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 {} | ^^^^^^^^^^^^^^^^^^^^^^^ 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 +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 + } | -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 {} | ^^^^^^^^^^^^^^^^ 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 +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.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..8c9d72dd3f7ab 100644 --- a/tests/ui/rfc-2008-non-exhaustive/uninhabited/match.stderr +++ b/tests/ui/rfc-2008-non-exhaustive/uninhabited/match.stderr @@ -55,26 +55,18 @@ 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 {} | ^ 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 +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.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..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 @@ -36,26 +36,27 @@ 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 {} | ^ 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 +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.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..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 @@ -55,26 +55,18 @@ 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 {} | ^ 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 +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 466d7f2eadb92..7673c86f7867e 100644 --- a/tests/ui/uninhabited/uninhabited-matches-feature-gated.stderr +++ b/tests/ui/uninhabited/uninhabited-matches-feature-gated.stderr @@ -1,19 +1,14 @@ -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 { | ^ 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 +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 @@ -64,35 +59,30 @@ 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 { | ^ 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]: non-exhaustive patterns: `Err(_)` not covered +error[E0004]: match is non-exhaustive --> $DIR/uninhabited-matches-feature-gated.rs:32:19 | 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 +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