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 204009934e7..b80d2e52ee7 100644 --- a/compiler/rustc_mir_build/src/thir/pattern/check_match.rs +++ b/compiler/rustc_mir_build/src/thir/pattern/check_match.rs @@ -336,7 +336,7 @@ fn check_for_bindings_named_same_as_variants( let ty_path = cx.tcx.def_path_str(edef.did); let mut err = lint.build(&format!( "pattern binding `{}` is named the same as one \ - of the variants of the type `{}`", + of the variants of the type `{}`", ident, ty_path )); err.code(error_code!(E0170)); @@ -508,6 +508,7 @@ fn non_exhaustive_match<'p, 'tcx>( // informative. let mut err; let pattern; + let mut patterns_len = 0; if is_empty_match && !non_empty_enum { err = create_e0004( cx.tcx.sess, @@ -523,6 +524,7 @@ fn non_exhaustive_match<'p, 'tcx>( 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() @@ -622,12 +624,29 @@ fn non_exhaustive_match<'p, 'tcx>( _ => {} } - let msg = "ensure that all possible cases are being handled, possibly by adding wildcards \ - or more match arms"; + let msg = format!( + "ensure that all possible cases are being handled by adding a match arm with a wildcard \ + pattern{}{}", + if patterns_len > 1 && patterns_len < 4 && suggestion.is_some() { + ", a match arm with multiple or-patterns" + } else { + // we are either not suggesting anything, or suggesting `_` + "" + }, + match patterns_len { + // non-exhaustive enum case + 0 if suggestion.is_some() => " as shown", + 0 => "", + 1 if suggestion.is_some() => " or an explicit pattern as shown", + 1 => " or an explicit pattern", + _ if suggestion.is_some() => " as shown, or multiple match arms", + _ => " or multiple match arms", + }, + ); if let Some((span, sugg)) = suggestion { - err.span_suggestion_verbose(span, msg, sugg, Applicability::HasPlaceholders); + err.span_suggestion_verbose(span, &msg, sugg, Applicability::HasPlaceholders); } else { - err.help(msg); + err.help(&msg); } err.emit(); } diff --git a/src/test/ui/closures/2229_closure_analysis/match/issue-88331.stderr b/src/test/ui/closures/2229_closure_analysis/match/issue-88331.stderr index 205a0e7c6fd..7e22defa98d 100644 --- a/src/test/ui/closures/2229_closure_analysis/match/issue-88331.stderr +++ b/src/test/ui/closures/2229_closure_analysis/match/issue-88331.stderr @@ -10,7 +10,7 @@ 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, possibly by adding wildcards or more match arms +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 | LL ~ Opcode::OP1 => unimplemented!(), LL ~ Opcode(0_u8) | Opcode(2_u8..=u8::MAX) => todo!(), @@ -28,7 +28,7 @@ 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, possibly by adding wildcards or more match arms +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 | LL ~ Opcode2::OP2=> unimplemented!(), LL ~ Opcode2(Opcode(0_u8)) | Opcode2(Opcode(2_u8..=u8::MAX)) => todo!(), diff --git a/src/test/ui/closures/2229_closure_analysis/match/non-exhaustive-match.stderr b/src/test/ui/closures/2229_closure_analysis/match/non-exhaustive-match.stderr index 02bd60893eb..32d36274ff6 100644 --- a/src/test/ui/closures/2229_closure_analysis/match/non-exhaustive-match.stderr +++ b/src/test/ui/closures/2229_closure_analysis/match/non-exhaustive-match.stderr @@ -10,7 +10,7 @@ note: `L1` defined here LL | enum L1 { A, B } | -- ^ not covered = note: the matched value is of type `L1` -help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL | let _b = || { match l1 { L1::A => (), B => todo!() } }; | ++++++++++++++ @@ -27,7 +27,7 @@ note: `E1` defined here LL | pub enum E1 {} | ^^^^^^^^^^^^^^ = note: the matched value is of type `E1`, which is marked as non-exhaustive -help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown | LL ~ let _d = || { match e1 { LL + _ => todo!(), @@ -46,7 +46,7 @@ note: `E2` defined here LL | pub enum E2 { A, B } | ^^^^^^^^^^^^^^^^^^^^ = note: the matched value is of type `E2`, which is marked as non-exhaustive -help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL | let _e = || { match e2 { E2::A => (), E2::B => (), _ => todo!() } }; | ++++++++++++++ diff --git a/src/test/ui/closures/2229_closure_analysis/match/pattern-matching-should-fail.stderr b/src/test/ui/closures/2229_closure_analysis/match/pattern-matching-should-fail.stderr index 44b3c559e5e..e55fb7ce4bb 100644 --- a/src/test/ui/closures/2229_closure_analysis/match/pattern-matching-should-fail.stderr +++ b/src/test/ui/closures/2229_closure_analysis/match/pattern-matching-should-fail.stderr @@ -5,7 +5,7 @@ LL | let c1 = || match x { }; | ^ | = note: the matched value is of type `u8` -help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown | LL ~ let c1 = || match x { LL + _ => todo!(), diff --git a/src/test/ui/error-codes/E0004-2.stderr b/src/test/ui/error-codes/E0004-2.stderr index 3dfa1fed48f..d4519af5408 100644 --- a/src/test/ui/error-codes/E0004-2.stderr +++ b/src/test/ui/error-codes/E0004-2.stderr @@ -19,7 +19,7 @@ LL | | Some(#[stable(feature = "rust1", since = "1.0.0")] T), LL | | } | |_- = note: the matched value is of type `Option` -help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms +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 | LL ~ match x { LL + None | Some(_) => todo!(), diff --git a/src/test/ui/error-codes/E0004.stderr b/src/test/ui/error-codes/E0004.stderr index 98cc08adf7f..8ba151d9e65 100644 --- a/src/test/ui/error-codes/E0004.stderr +++ b/src/test/ui/error-codes/E0004.stderr @@ -12,7 +12,7 @@ LL | enum Terminator { LL | HastaLaVistaBaby, | ^^^^^^^^^^^^^^^^ not covered = note: the matched value is of type `Terminator` -help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ Terminator::TalkToMyHand => {} LL + HastaLaVistaBaby => todo!() diff --git a/src/test/ui/feature-gates/feature-gate-precise_pointer_size_matching.stderr b/src/test/ui/feature-gates/feature-gate-precise_pointer_size_matching.stderr index 945afffee37..b5510683328 100644 --- a/src/test/ui/feature-gates/feature-gate-precise_pointer_size_matching.stderr +++ b/src/test/ui/feature-gates/feature-gate-precise_pointer_size_matching.stderr @@ -7,7 +7,7 @@ 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, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ 0..=usize::MAX => {} LL + _ => todo!() @@ -22,7 +22,7 @@ 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, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ isize::MIN..=isize::MAX => {} LL + _ => todo!() diff --git a/src/test/ui/half-open-range-patterns/half-open-range-pats-exhaustive-fail.stderr b/src/test/ui/half-open-range-patterns/half-open-range-pats-exhaustive-fail.stderr index 1cf267cf99a..c2c77290c43 100644 --- a/src/test/ui/half-open-range-patterns/half-open-range-pats-exhaustive-fail.stderr +++ b/src/test/ui/half-open-range-patterns/half-open-range-pats-exhaustive-fail.stderr @@ -5,7 +5,7 @@ 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, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ match $s { $($t)+ => {} LL ~ _ => todo!() } @@ -18,7 +18,7 @@ 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, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ match $s { $($t)+ => {} LL ~ _ => todo!() } @@ -31,7 +31,7 @@ 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, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ match $s { $($t)+ => {} LL ~ '\u{10ffff}' => todo!() } @@ -44,7 +44,7 @@ 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, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ match $s { $($t)+ => {} LL ~ '\u{10fffe}'..='\u{10ffff}' => todo!() } @@ -57,7 +57,7 @@ LL | m!('a', ALMOST_MIN..); | ^^^ pattern `'\u{0}'` not covered | = note: the matched value is of type `char` -help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ match $s { $($t)+ => {} LL ~ '\u{0}' => todo!() } @@ -70,7 +70,7 @@ 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, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ match $s { $($t)+ => {} LL ~ '\u{10ffff}' => todo!() } @@ -83,7 +83,7 @@ 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, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ match $s { $($t)+ => {} LL ~ 'b' => todo!() } @@ -96,7 +96,7 @@ 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, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ match $s { $($t)+ => {} LL ~ 'b' => todo!() } @@ -109,7 +109,7 @@ 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, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ match $s { $($t)+ => {} LL ~ u8::MAX => todo!() } @@ -122,7 +122,7 @@ 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, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ match $s { $($t)+ => {} LL ~ 254_u8..=u8::MAX => todo!() } @@ -135,7 +135,7 @@ 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, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ match $s { $($t)+ => {} LL ~ 0_u8 => todo!() } @@ -148,7 +148,7 @@ 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, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ match $s { $($t)+ => {} LL ~ u8::MAX => todo!() } @@ -161,7 +161,7 @@ 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, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ match $s { $($t)+ => {} LL ~ 43_u8 => todo!() } @@ -174,7 +174,7 @@ 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, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ match $s { $($t)+ => {} LL ~ 43_u8 => todo!() } @@ -187,7 +187,7 @@ 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, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ match $s { $($t)+ => {} LL ~ u16::MAX => todo!() } @@ -200,7 +200,7 @@ 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, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ match $s { $($t)+ => {} LL ~ 65534_u16..=u16::MAX => todo!() } @@ -213,7 +213,7 @@ 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, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ match $s { $($t)+ => {} LL ~ 0_u16 => todo!() } @@ -226,7 +226,7 @@ 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, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ match $s { $($t)+ => {} LL ~ u16::MAX => todo!() } @@ -239,7 +239,7 @@ 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, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ match $s { $($t)+ => {} LL ~ 43_u16 => todo!() } @@ -252,7 +252,7 @@ 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, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ match $s { $($t)+ => {} LL ~ 43_u16 => todo!() } @@ -265,7 +265,7 @@ 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, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ match $s { $($t)+ => {} LL ~ u32::MAX => todo!() } @@ -278,7 +278,7 @@ 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, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ match $s { $($t)+ => {} LL ~ 4294967294_u32..=u32::MAX => todo!() } @@ -291,7 +291,7 @@ 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, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ match $s { $($t)+ => {} LL ~ 0_u32 => todo!() } @@ -304,7 +304,7 @@ 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, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ match $s { $($t)+ => {} LL ~ u32::MAX => todo!() } @@ -317,7 +317,7 @@ 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, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ match $s { $($t)+ => {} LL ~ 43_u32 => todo!() } @@ -330,7 +330,7 @@ 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, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ match $s { $($t)+ => {} LL ~ 43_u32 => todo!() } @@ -343,7 +343,7 @@ 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, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ match $s { $($t)+ => {} LL ~ u64::MAX => todo!() } @@ -356,7 +356,7 @@ 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, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ match $s { $($t)+ => {} LL ~ 18446744073709551614_u64..=u64::MAX => todo!() } @@ -369,7 +369,7 @@ 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, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ match $s { $($t)+ => {} LL ~ 0_u64 => todo!() } @@ -382,7 +382,7 @@ 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, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ match $s { $($t)+ => {} LL ~ u64::MAX => todo!() } @@ -395,7 +395,7 @@ 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, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ match $s { $($t)+ => {} LL ~ 43_u64 => todo!() } @@ -408,7 +408,7 @@ 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, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ match $s { $($t)+ => {} LL ~ 43_u64 => todo!() } @@ -421,7 +421,7 @@ 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, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ match $s { $($t)+ => {} LL ~ u128::MAX => todo!() } @@ -434,7 +434,7 @@ 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, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ match $s { $($t)+ => {} LL ~ 340282366920938463463374607431768211454_u128..=u128::MAX => todo!() } @@ -447,7 +447,7 @@ 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, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ match $s { $($t)+ => {} LL ~ 0_u128 => todo!() } @@ -460,7 +460,7 @@ 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, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ match $s { $($t)+ => {} LL ~ u128::MAX => todo!() } @@ -473,7 +473,7 @@ 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, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ match $s { $($t)+ => {} LL ~ 43_u128 => todo!() } @@ -486,7 +486,7 @@ 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, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ match $s { $($t)+ => {} LL ~ 43_u128 => todo!() } @@ -499,7 +499,7 @@ 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, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ match $s { $($t)+ => {} LL ~ i8::MAX => todo!() } @@ -512,7 +512,7 @@ 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, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ match $s { $($t)+ => {} LL ~ 126_i8..=i8::MAX => todo!() } @@ -525,7 +525,7 @@ 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, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ match $s { $($t)+ => {} LL ~ i8::MIN => todo!() } @@ -538,7 +538,7 @@ 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, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ match $s { $($t)+ => {} LL ~ i8::MAX => todo!() } @@ -551,7 +551,7 @@ 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, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ match $s { $($t)+ => {} LL ~ 43_i8 => todo!() } @@ -564,7 +564,7 @@ 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, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ match $s { $($t)+ => {} LL ~ 43_i8 => todo!() } @@ -577,7 +577,7 @@ 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, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ match $s { $($t)+ => {} LL ~ i16::MAX => todo!() } @@ -590,7 +590,7 @@ 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, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ match $s { $($t)+ => {} LL ~ 32766_i16..=i16::MAX => todo!() } @@ -603,7 +603,7 @@ 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, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ match $s { $($t)+ => {} LL ~ i16::MIN => todo!() } @@ -616,7 +616,7 @@ 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, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ match $s { $($t)+ => {} LL ~ i16::MAX => todo!() } @@ -629,7 +629,7 @@ 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, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ match $s { $($t)+ => {} LL ~ 43_i16 => todo!() } @@ -642,7 +642,7 @@ 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, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ match $s { $($t)+ => {} LL ~ 43_i16 => todo!() } @@ -655,7 +655,7 @@ 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, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ match $s { $($t)+ => {} LL ~ i32::MAX => todo!() } @@ -668,7 +668,7 @@ 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, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ match $s { $($t)+ => {} LL ~ 2147483646_i32..=i32::MAX => todo!() } @@ -681,7 +681,7 @@ 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, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ match $s { $($t)+ => {} LL ~ i32::MIN => todo!() } @@ -694,7 +694,7 @@ 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, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ match $s { $($t)+ => {} LL ~ i32::MAX => todo!() } @@ -707,7 +707,7 @@ 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, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ match $s { $($t)+ => {} LL ~ 43_i32 => todo!() } @@ -720,7 +720,7 @@ 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, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ match $s { $($t)+ => {} LL ~ 43_i32 => todo!() } @@ -733,7 +733,7 @@ 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, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ match $s { $($t)+ => {} LL ~ i64::MAX => todo!() } @@ -746,7 +746,7 @@ 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, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ match $s { $($t)+ => {} LL ~ 9223372036854775806_i64..=i64::MAX => todo!() } @@ -759,7 +759,7 @@ 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, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ match $s { $($t)+ => {} LL ~ i64::MIN => todo!() } @@ -772,7 +772,7 @@ 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, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ match $s { $($t)+ => {} LL ~ i64::MAX => todo!() } @@ -785,7 +785,7 @@ 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, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ match $s { $($t)+ => {} LL ~ 43_i64 => todo!() } @@ -798,7 +798,7 @@ 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, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ match $s { $($t)+ => {} LL ~ 43_i64 => todo!() } @@ -811,7 +811,7 @@ 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, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ match $s { $($t)+ => {} LL ~ i128::MAX => todo!() } @@ -824,7 +824,7 @@ 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, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ match $s { $($t)+ => {} LL ~ 170141183460469231731687303715884105726_i128..=i128::MAX => todo!() } @@ -837,7 +837,7 @@ 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, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ match $s { $($t)+ => {} LL ~ i128::MIN => todo!() } @@ -850,7 +850,7 @@ 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, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ match $s { $($t)+ => {} LL ~ i128::MAX => todo!() } @@ -863,7 +863,7 @@ 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, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ match $s { $($t)+ => {} LL ~ 43_i128 => todo!() } @@ -876,7 +876,7 @@ 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, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ match $s { $($t)+ => {} LL ~ 43_i128 => todo!() } diff --git a/src/test/ui/match/match_non_exhaustive.stderr b/src/test/ui/match/match_non_exhaustive.stderr index 52edb5b67a8..6206dc85ea0 100644 --- a/src/test/ui/match/match_non_exhaustive.stderr +++ b/src/test/ui/match/match_non_exhaustive.stderr @@ -10,7 +10,7 @@ note: `L` defined here LL | enum L { A, B } | - ^ not covered = note: the matched value is of type `L` -help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL | match l { L::A => (), B => todo!() }; | ++++++++++++++ @@ -27,7 +27,7 @@ note: `E1` defined here LL | pub enum E1 {} | ^^^^^^^^^^^^^^ = note: the matched value is of type `E1`, which is marked as non-exhaustive -help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown | LL ~ match e1 { LL + _ => todo!(), @@ -46,7 +46,7 @@ note: `E2` defined here LL | pub enum E2 { A, B } | ^^^^^^^^^^^^^^^^^^^^ = note: the matched value is of type `E2`, which is marked as non-exhaustive -help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL | match e2 { E2::A => (), E2::B => (), _ => todo!() }; | ++++++++++++++ diff --git a/src/test/ui/or-patterns/exhaustiveness-non-exhaustive.stderr b/src/test/ui/or-patterns/exhaustiveness-non-exhaustive.stderr index c99a6fd2533..9aa808e6bc9 100644 --- a/src/test/ui/or-patterns/exhaustiveness-non-exhaustive.stderr +++ b/src/test/ui/or-patterns/exhaustiveness-non-exhaustive.stderr @@ -5,7 +5,7 @@ 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, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ (0 | 1, 2 | 3) => {} LL + (2_u8..=u8::MAX, _) => todo!() @@ -18,7 +18,7 @@ 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, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ ((0 | 1,) | (2 | 3,),) => {} LL + ((4_u8..=u8::MAX)) => todo!() @@ -31,7 +31,7 @@ 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, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ (None | Some(0 | 1),) => {} LL + (Some(2_u8..=u8::MAX)) => todo!() diff --git a/src/test/ui/or-patterns/issue-69875-should-have-been-expanded-earlier-non-exhaustive.stderr b/src/test/ui/or-patterns/issue-69875-should-have-been-expanded-earlier-non-exhaustive.stderr index c38e3088d2e..37a35700b36 100644 --- a/src/test/ui/or-patterns/issue-69875-should-have-been-expanded-earlier-non-exhaustive.stderr +++ b/src/test/ui/or-patterns/issue-69875-should-have-been-expanded-earlier-non-exhaustive.stderr @@ -19,7 +19,7 @@ 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, possibly by adding wildcards or more match arms +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 | LL ~ 0 | (1 | 2) => {} LL + i32::MIN..=-1_i32 | 3_i32..=i32::MAX => todo!() diff --git a/src/test/ui/pattern/usefulness/always-inhabited-union-ref.stderr b/src/test/ui/pattern/usefulness/always-inhabited-union-ref.stderr index 4b24e11881a..cd5c283f9fd 100644 --- a/src/test/ui/pattern/usefulness/always-inhabited-union-ref.stderr +++ b/src/test/ui/pattern/usefulness/always-inhabited-union-ref.stderr @@ -6,7 +6,7 @@ LL | match uninhab_ref() { | = note: the matched value is of type `&!` = note: references are always considered inhabited -help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown | LL ~ match uninhab_ref() { LL + _ => todo!(), @@ -25,7 +25,7 @@ note: `Foo` defined here LL | pub union Foo { | ^^^ = note: the matched value is of type `Foo` -help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown | LL ~ match uninhab_union() { LL + _ => todo!(), diff --git a/src/test/ui/pattern/usefulness/doc-hidden-non-exhaustive.stderr b/src/test/ui/pattern/usefulness/doc-hidden-non-exhaustive.stderr index 5a2c3c1447f..7d0b71a497e 100644 --- a/src/test/ui/pattern/usefulness/doc-hidden-non-exhaustive.stderr +++ b/src/test/ui/pattern/usefulness/doc-hidden-non-exhaustive.stderr @@ -15,7 +15,7 @@ LL | | C, LL | | } | |_^ = note: the matched value is of type `Foo` -help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ Foo::B => {} LL + _ => todo!() @@ -39,7 +39,7 @@ LL | | C, LL | | } | |_- = note: the matched value is of type `Foo` -help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ Foo::C => {} LL + B => todo!() @@ -63,7 +63,7 @@ LL | | C, LL | | } | |_- = note: the matched value is of type `Foo` -help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms +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 | LL ~ Foo::A => {} LL + B | _ => todo!() @@ -88,7 +88,7 @@ LL | | Some(#[stable(feature = "rust1", since = "1.0.0")] T), LL | | } | |_- = note: the matched value is of type `Option` -help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms +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 | LL ~ Some(Foo::A) => {} LL + Some(B) | Some(_) => todo!() diff --git a/src/test/ui/pattern/usefulness/empty-match.exhaustive_patterns.stderr b/src/test/ui/pattern/usefulness/empty-match.exhaustive_patterns.stderr index f8976960adc..d31ee0dbd14 100644 --- a/src/test/ui/pattern/usefulness/empty-match.exhaustive_patterns.stderr +++ b/src/test/ui/pattern/usefulness/empty-match.exhaustive_patterns.stderr @@ -47,7 +47,7 @@ LL | match_no_arms!(0u8); | ^^^ | = note: the matched value is of type `u8` - = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms + = help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern error[E0004]: non-exhaustive patterns: type `NonEmptyStruct1` is non-empty --> $DIR/empty-match.rs:79:20 @@ -61,7 +61,7 @@ note: `NonEmptyStruct1` defined here LL | struct NonEmptyStruct1; | ^^^^^^^^^^^^^^^ = note: the matched value is of type `NonEmptyStruct1` - = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms + = help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern error[E0004]: non-exhaustive patterns: type `NonEmptyStruct2` is non-empty --> $DIR/empty-match.rs:80:20 @@ -75,7 +75,7 @@ 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, possibly by adding wildcards or more match arms + = help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern error[E0004]: non-exhaustive patterns: type `NonEmptyUnion1` is non-empty --> $DIR/empty-match.rs:81:20 @@ -89,7 +89,7 @@ note: `NonEmptyUnion1` defined here LL | union NonEmptyUnion1 { | ^^^^^^^^^^^^^^ = note: the matched value is of type `NonEmptyUnion1` - = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms + = help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern error[E0004]: non-exhaustive patterns: type `NonEmptyUnion2` is non-empty --> $DIR/empty-match.rs:82:20 @@ -103,7 +103,7 @@ note: `NonEmptyUnion2` defined here LL | union NonEmptyUnion2 { | ^^^^^^^^^^^^^^ = note: the matched value is of type `NonEmptyUnion2` - = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms + = help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern error[E0004]: non-exhaustive patterns: `Foo(_)` not covered --> $DIR/empty-match.rs:83:20 @@ -119,7 +119,7 @@ LL | enum NonEmptyEnum1 { LL | Foo(bool), | ^^^ not covered = note: the matched value is of type `NonEmptyEnum1` - = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms + = help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern error[E0004]: non-exhaustive patterns: `Foo(_)` and `Bar` not covered --> $DIR/empty-match.rs:84:20 @@ -137,7 +137,7 @@ LL | Foo(bool), LL | Bar, | ^^^ not covered = note: the matched value is of type `NonEmptyEnum2` - = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms + = help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or multiple match arms error[E0004]: non-exhaustive patterns: `V1`, `V2`, `V3` and 2 more not covered --> $DIR/empty-match.rs:85:20 @@ -151,7 +151,7 @@ note: `NonEmptyEnum5` defined here LL | enum NonEmptyEnum5 { | ^^^^^^^^^^^^^ = note: the matched value is of type `NonEmptyEnum5` - = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms + = help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or multiple match arms error[E0004]: non-exhaustive patterns: `_` not covered --> $DIR/empty-match.rs:87:24 @@ -160,7 +160,7 @@ 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, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ _ if false => {} LL + _ => todo!() @@ -178,7 +178,7 @@ note: `NonEmptyStruct1` defined here LL | struct NonEmptyStruct1; | ^^^^^^^^^^^^^^^ = note: the matched value is of type `NonEmptyStruct1` -help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ _ if false => {} LL + NonEmptyStruct1 => todo!() @@ -196,7 +196,7 @@ 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, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ _ if false => {} LL + NonEmptyStruct2(_) => todo!() @@ -214,7 +214,7 @@ note: `NonEmptyUnion1` defined here LL | union NonEmptyUnion1 { | ^^^^^^^^^^^^^^ = note: the matched value is of type `NonEmptyUnion1` -help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ _ if false => {} LL + NonEmptyUnion1 { .. } => todo!() @@ -232,7 +232,7 @@ note: `NonEmptyUnion2` defined here LL | union NonEmptyUnion2 { | ^^^^^^^^^^^^^^ = note: the matched value is of type `NonEmptyUnion2` -help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ _ if false => {} LL + NonEmptyUnion2 { .. } => todo!() @@ -252,7 +252,7 @@ LL | enum NonEmptyEnum1 { LL | Foo(bool), | ^^^ not covered = note: the matched value is of type `NonEmptyEnum1` -help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ _ if false => {} LL + Foo(_) => todo!() @@ -274,7 +274,7 @@ LL | Foo(bool), LL | Bar, | ^^^ not covered = note: the matched value is of type `NonEmptyEnum2` -help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms +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 | LL ~ _ if false => {} LL + Foo(_) | Bar => todo!() @@ -292,7 +292,7 @@ note: `NonEmptyEnum5` defined here LL | enum NonEmptyEnum5 { | ^^^^^^^^^^^^^ = note: the matched value is of type `NonEmptyEnum5` -help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown, or multiple match arms | LL ~ _ if false => {} LL + _ => todo!() diff --git a/src/test/ui/pattern/usefulness/empty-match.normal.stderr b/src/test/ui/pattern/usefulness/empty-match.normal.stderr index f8976960adc..d31ee0dbd14 100644 --- a/src/test/ui/pattern/usefulness/empty-match.normal.stderr +++ b/src/test/ui/pattern/usefulness/empty-match.normal.stderr @@ -47,7 +47,7 @@ LL | match_no_arms!(0u8); | ^^^ | = note: the matched value is of type `u8` - = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms + = help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern error[E0004]: non-exhaustive patterns: type `NonEmptyStruct1` is non-empty --> $DIR/empty-match.rs:79:20 @@ -61,7 +61,7 @@ note: `NonEmptyStruct1` defined here LL | struct NonEmptyStruct1; | ^^^^^^^^^^^^^^^ = note: the matched value is of type `NonEmptyStruct1` - = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms + = help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern error[E0004]: non-exhaustive patterns: type `NonEmptyStruct2` is non-empty --> $DIR/empty-match.rs:80:20 @@ -75,7 +75,7 @@ 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, possibly by adding wildcards or more match arms + = help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern error[E0004]: non-exhaustive patterns: type `NonEmptyUnion1` is non-empty --> $DIR/empty-match.rs:81:20 @@ -89,7 +89,7 @@ note: `NonEmptyUnion1` defined here LL | union NonEmptyUnion1 { | ^^^^^^^^^^^^^^ = note: the matched value is of type `NonEmptyUnion1` - = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms + = help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern error[E0004]: non-exhaustive patterns: type `NonEmptyUnion2` is non-empty --> $DIR/empty-match.rs:82:20 @@ -103,7 +103,7 @@ note: `NonEmptyUnion2` defined here LL | union NonEmptyUnion2 { | ^^^^^^^^^^^^^^ = note: the matched value is of type `NonEmptyUnion2` - = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms + = help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern error[E0004]: non-exhaustive patterns: `Foo(_)` not covered --> $DIR/empty-match.rs:83:20 @@ -119,7 +119,7 @@ LL | enum NonEmptyEnum1 { LL | Foo(bool), | ^^^ not covered = note: the matched value is of type `NonEmptyEnum1` - = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms + = help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern error[E0004]: non-exhaustive patterns: `Foo(_)` and `Bar` not covered --> $DIR/empty-match.rs:84:20 @@ -137,7 +137,7 @@ LL | Foo(bool), LL | Bar, | ^^^ not covered = note: the matched value is of type `NonEmptyEnum2` - = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms + = help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or multiple match arms error[E0004]: non-exhaustive patterns: `V1`, `V2`, `V3` and 2 more not covered --> $DIR/empty-match.rs:85:20 @@ -151,7 +151,7 @@ note: `NonEmptyEnum5` defined here LL | enum NonEmptyEnum5 { | ^^^^^^^^^^^^^ = note: the matched value is of type `NonEmptyEnum5` - = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms + = help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or multiple match arms error[E0004]: non-exhaustive patterns: `_` not covered --> $DIR/empty-match.rs:87:24 @@ -160,7 +160,7 @@ 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, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ _ if false => {} LL + _ => todo!() @@ -178,7 +178,7 @@ note: `NonEmptyStruct1` defined here LL | struct NonEmptyStruct1; | ^^^^^^^^^^^^^^^ = note: the matched value is of type `NonEmptyStruct1` -help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ _ if false => {} LL + NonEmptyStruct1 => todo!() @@ -196,7 +196,7 @@ 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, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ _ if false => {} LL + NonEmptyStruct2(_) => todo!() @@ -214,7 +214,7 @@ note: `NonEmptyUnion1` defined here LL | union NonEmptyUnion1 { | ^^^^^^^^^^^^^^ = note: the matched value is of type `NonEmptyUnion1` -help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ _ if false => {} LL + NonEmptyUnion1 { .. } => todo!() @@ -232,7 +232,7 @@ note: `NonEmptyUnion2` defined here LL | union NonEmptyUnion2 { | ^^^^^^^^^^^^^^ = note: the matched value is of type `NonEmptyUnion2` -help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ _ if false => {} LL + NonEmptyUnion2 { .. } => todo!() @@ -252,7 +252,7 @@ LL | enum NonEmptyEnum1 { LL | Foo(bool), | ^^^ not covered = note: the matched value is of type `NonEmptyEnum1` -help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ _ if false => {} LL + Foo(_) => todo!() @@ -274,7 +274,7 @@ LL | Foo(bool), LL | Bar, | ^^^ not covered = note: the matched value is of type `NonEmptyEnum2` -help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms +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 | LL ~ _ if false => {} LL + Foo(_) | Bar => todo!() @@ -292,7 +292,7 @@ note: `NonEmptyEnum5` defined here LL | enum NonEmptyEnum5 { | ^^^^^^^^^^^^^ = note: the matched value is of type `NonEmptyEnum5` -help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown, or multiple match arms | LL ~ _ if false => {} LL + _ => todo!() diff --git a/src/test/ui/pattern/usefulness/floats.stderr b/src/test/ui/pattern/usefulness/floats.stderr index bbeac5959f0..c926e50b358 100644 --- a/src/test/ui/pattern/usefulness/floats.stderr +++ b/src/test/ui/pattern/usefulness/floats.stderr @@ -5,7 +5,7 @@ LL | match 0.0 { | ^^^ pattern `_` not covered | = note: the matched value is of type `f64` -help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ 0.0..=1.0 => {} LL + _ => todo!() diff --git a/src/test/ui/pattern/usefulness/guards.stderr b/src/test/ui/pattern/usefulness/guards.stderr index 4a3b12d58fa..0c1563c160c 100644 --- a/src/test/ui/pattern/usefulness/guards.stderr +++ b/src/test/ui/pattern/usefulness/guards.stderr @@ -5,7 +5,7 @@ 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, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ 128 ..= 255 if true => {} LL + 128_u8..=u8::MAX => todo!() diff --git a/src/test/ui/pattern/usefulness/integer-ranges/exhaustiveness.stderr b/src/test/ui/pattern/usefulness/integer-ranges/exhaustiveness.stderr index 56de29cbd81..fec54e89d63 100644 --- a/src/test/ui/pattern/usefulness/integer-ranges/exhaustiveness.stderr +++ b/src/test/ui/pattern/usefulness/integer-ranges/exhaustiveness.stderr @@ -5,7 +5,7 @@ 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, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ match $s { $($t)+ => {} LL ~ u8::MAX => todo!() } @@ -18,7 +18,7 @@ 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, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ match $s { $($t)+ => {} LL ~ u8::MAX => todo!() } @@ -31,7 +31,7 @@ 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, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ match $s { $($t)+ => {} LL ~ 0_u8 => todo!() } @@ -44,7 +44,7 @@ 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, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ match $s { $($t)+ => {} LL ~ 42_u8 => todo!() } @@ -57,7 +57,7 @@ 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, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ match $s { $($t)+ => {} LL ~ i8::MAX => todo!() } @@ -70,7 +70,7 @@ 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, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ match $s { $($t)+ => {} LL ~ i8::MAX => todo!() } @@ -83,7 +83,7 @@ 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, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ match $s { $($t)+ => {} LL ~ i8::MIN => todo!() } @@ -96,7 +96,7 @@ 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, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ 1 ..= i8::MAX => {} LL + 0_i8 => todo!() @@ -109,7 +109,7 @@ 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, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ match $s { $($t)+ => {} LL ~ u128::MAX => todo!() } @@ -122,7 +122,7 @@ 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, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ match $s { $($t)+ => {} LL ~ 5_u128..=u128::MAX => todo!() } @@ -135,7 +135,7 @@ 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, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ match $s { $($t)+ => {} LL ~ 0_u128 => todo!() } @@ -148,7 +148,7 @@ 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, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ (0 ..= 255, true) => {} LL + (126_u8..=127_u8, false) => todo!() diff --git a/src/test/ui/pattern/usefulness/integer-ranges/pointer-sized-int.allow.stderr b/src/test/ui/pattern/usefulness/integer-ranges/pointer-sized-int.allow.stderr index 23aed9d1cd6..9f277fa1e18 100644 --- a/src/test/ui/pattern/usefulness/integer-ranges/pointer-sized-int.allow.stderr +++ b/src/test/ui/pattern/usefulness/integer-ranges/pointer-sized-int.allow.stderr @@ -5,7 +5,7 @@ LL | match 7usize {} | ^^^^^^ | = note: the matched value is of type `usize` -help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown | LL ~ match 7usize { LL + _ => todo!(), diff --git a/src/test/ui/pattern/usefulness/integer-ranges/pointer-sized-int.deny.stderr b/src/test/ui/pattern/usefulness/integer-ranges/pointer-sized-int.deny.stderr index 11a3bf5b177..fa4146a7ad8 100644 --- a/src/test/ui/pattern/usefulness/integer-ranges/pointer-sized-int.deny.stderr +++ b/src/test/ui/pattern/usefulness/integer-ranges/pointer-sized-int.deny.stderr @@ -7,7 +7,7 @@ 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, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ 0 ..= usize::MAX => {} LL + _ => todo!() @@ -22,7 +22,7 @@ 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, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ isize::MIN ..= isize::MAX => {} LL + _ => todo!() @@ -37,7 +37,7 @@ 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, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ match $s { $($t)+ => {} LL ~ _ => todo!() } @@ -52,7 +52,7 @@ 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, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ match $s { $($t)+ => {} LL ~ _ => todo!() } @@ -67,7 +67,7 @@ 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, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ match $s { $($t)+ => {} LL ~ _ => todo!() } @@ -80,7 +80,7 @@ LL | m!((0usize, true), (0..5, true) | (5..=usize::MAX, true) | (0..=usize:: | ^^^^^^^^^^^^^^ pattern `(_, _)` not covered | = note: the matched value is of type `(usize, bool)` -help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ match $s { $($t)+ => {} LL ~ (_, _) => todo!() } @@ -95,7 +95,7 @@ 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, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ match $s { $($t)+ => {} LL ~ _ => todo!() } @@ -110,7 +110,7 @@ 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, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ match $s { $($t)+ => {} LL ~ _ => todo!() } @@ -125,7 +125,7 @@ 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, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ match $s { $($t)+ => {} LL ~ _ => todo!() } @@ -138,7 +138,7 @@ 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, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ match $s { $($t)+ => {} LL ~ (_, _) => todo!() } @@ -153,7 +153,7 @@ 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, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ 1 ..= isize::MAX => {} LL + _ => todo!() @@ -166,7 +166,7 @@ LL | match 7usize {} | ^^^^^^ | = note: the matched value is of type `usize` -help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown | LL ~ match 7usize { LL + _ => todo!(), diff --git a/src/test/ui/pattern/usefulness/integer-ranges/precise_pointer_matching-message.stderr b/src/test/ui/pattern/usefulness/integer-ranges/precise_pointer_matching-message.stderr index efef39c636f..30492c98206 100644 --- a/src/test/ui/pattern/usefulness/integer-ranges/precise_pointer_matching-message.stderr +++ b/src/test/ui/pattern/usefulness/integer-ranges/precise_pointer_matching-message.stderr @@ -7,7 +7,7 @@ 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, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ 0..=usize::MAX => {} LL + _ => todo!() @@ -22,7 +22,7 @@ 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, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ isize::MIN..=isize::MAX => {} LL + _ => todo!() diff --git a/src/test/ui/pattern/usefulness/issue-15129.stderr b/src/test/ui/pattern/usefulness/issue-15129.stderr index 5ee2f6825ff..af60f3ff50b 100644 --- a/src/test/ui/pattern/usefulness/issue-15129.stderr +++ b/src/test/ui/pattern/usefulness/issue-15129.stderr @@ -5,7 +5,7 @@ LL | match (T::T1(()), V::V2(true)) { | ^^^^^^^^^^^^^^^^^^^^^^^^ patterns `(T1(()), V2(_))` and `(T2(()), V1(_))` not covered | = note: the matched value is of type `(T, V)` -help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms | LL ~ (T::T2(()), V::V2(b)) => (), LL ~ (T1(()), V2(_)) | (T2(()), V1(_)) => todo!(), diff --git a/src/test/ui/pattern/usefulness/issue-2111.stderr b/src/test/ui/pattern/usefulness/issue-2111.stderr index ae02d7f7dfc..01890b73cbd 100644 --- a/src/test/ui/pattern/usefulness/issue-2111.stderr +++ b/src/test/ui/pattern/usefulness/issue-2111.stderr @@ -5,7 +5,7 @@ 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, possibly by adding wildcards or more match arms +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 | LL ~ (Some(_), None) | (None, Some(_)) => {} LL + (None, None) | (Some(_), Some(_)) => todo!() diff --git a/src/test/ui/pattern/usefulness/issue-30240.stderr b/src/test/ui/pattern/usefulness/issue-30240.stderr index 1c25355b9c4..759fdeafe4e 100644 --- a/src/test/ui/pattern/usefulness/issue-30240.stderr +++ b/src/test/ui/pattern/usefulness/issue-30240.stderr @@ -5,7 +5,7 @@ LL | match "world" { | ^^^^^^^ pattern `&_` not covered | = note: the matched value is of type `&str` -help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ "hello" => {} LL + &_ => todo!() @@ -18,7 +18,7 @@ LL | match "world" { | ^^^^^^^ pattern `&_` not covered | = note: the matched value is of type `&str` -help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ "hello" => {} LL + &_ => todo!() diff --git a/src/test/ui/pattern/usefulness/issue-3096-1.stderr b/src/test/ui/pattern/usefulness/issue-3096-1.stderr index 0d59b8db467..d8884394f8e 100644 --- a/src/test/ui/pattern/usefulness/issue-3096-1.stderr +++ b/src/test/ui/pattern/usefulness/issue-3096-1.stderr @@ -5,7 +5,7 @@ LL | match () { } | ^^ | = note: the matched value is of type `()` -help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown | LL ~ match () { LL + _ => todo!(), diff --git a/src/test/ui/pattern/usefulness/issue-3096-2.stderr b/src/test/ui/pattern/usefulness/issue-3096-2.stderr index e0a769bc027..2df8911badc 100644 --- a/src/test/ui/pattern/usefulness/issue-3096-2.stderr +++ b/src/test/ui/pattern/usefulness/issue-3096-2.stderr @@ -5,7 +5,7 @@ LL | match x { } | ^ | = note: the matched value is of type `*const Bottom` -help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown | LL ~ match x { LL + _ => todo!(), diff --git a/src/test/ui/pattern/usefulness/issue-35609.stderr b/src/test/ui/pattern/usefulness/issue-35609.stderr index e5248ab985d..717bb53c327 100644 --- a/src/test/ui/pattern/usefulness/issue-35609.stderr +++ b/src/test/ui/pattern/usefulness/issue-35609.stderr @@ -5,7 +5,7 @@ LL | match (A, ()) { | ^^^^^^^ patterns `(B, _)`, `(C, _)`, `(D, _)` and 2 more not covered | = note: the matched value is of type `(Enum, ())` -help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown, or multiple match arms | LL ~ (A, _) => {} LL + _ => todo!() @@ -18,7 +18,7 @@ LL | match (A, A) { | ^^^^^^ patterns `(_, B)`, `(_, C)`, `(_, D)` and 2 more not covered | = note: the matched value is of type `(Enum, Enum)` -help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown, or multiple match arms | LL ~ (_, A) => {} LL + _ => todo!() @@ -31,7 +31,7 @@ LL | match ((A, ()), ()) { | ^^^^^^^^^^^^^ patterns `((B, _), _)`, `((C, _), _)`, `((D, _), _)` and 2 more not covered | = note: the matched value is of type `((Enum, ()), ())` -help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown, or multiple match arms | LL ~ ((A, ()), _) => {} LL + _ => todo!() @@ -44,7 +44,7 @@ LL | match ((A, ()), A) { | ^^^^^^^^^^^^ patterns `((B, _), _)`, `((C, _), _)`, `((D, _), _)` and 2 more not covered | = note: the matched value is of type `((Enum, ()), Enum)` -help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown, or multiple match arms | LL ~ ((A, ()), _) => {} LL + _ => todo!() @@ -57,7 +57,7 @@ LL | match ((A, ()), ()) { | ^^^^^^^^^^^^^ patterns `((B, _), _)`, `((C, _), _)`, `((D, _), _)` and 2 more not covered | = note: the matched value is of type `((Enum, ()), ())` -help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown, or multiple match arms | LL ~ ((A, _), _) => {} LL + _ => todo!() @@ -75,7 +75,7 @@ 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, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown, or multiple match arms | LL ~ S(A, _) => {} LL + _ => todo!() @@ -93,7 +93,7 @@ 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, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown, or multiple match arms | LL ~ Sd { x: A, y: _ } => {} LL + _ => todo!() @@ -117,7 +117,7 @@ LL | | Some(#[stable(feature = "rust1", since = "1.0.0")] T), LL | | } | |_^ = note: the matched value is of type `Option` -help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown, or multiple match arms | LL ~ None => (), LL + _ => todo!() diff --git a/src/test/ui/pattern/usefulness/issue-3601.stderr b/src/test/ui/pattern/usefulness/issue-3601.stderr index 84916504220..4e0adcc1ba2 100644 --- a/src/test/ui/pattern/usefulness/issue-3601.stderr +++ b/src/test/ui/pattern/usefulness/issue-3601.stderr @@ -13,7 +13,7 @@ LL | | #[unstable(feature = "allocator_api", issue = "32838")] A: Allocator LL | | >(Unique, A); | |________________^ = note: the matched value is of type `Box` -help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ box ElementKind::HTMLImageElement(ref d) if d.image.is_some() => { true } LL + box _ => todo!() diff --git a/src/test/ui/pattern/usefulness/issue-39362.stderr b/src/test/ui/pattern/usefulness/issue-39362.stderr index f0f93af216a..ca37af6fb80 100644 --- a/src/test/ui/pattern/usefulness/issue-39362.stderr +++ b/src/test/ui/pattern/usefulness/issue-39362.stderr @@ -12,7 +12,7 @@ LL | enum Foo { LL | Bar { bar: Bar, id: usize } | ^^^ not covered = note: the matched value is of type `Foo` -help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown, or multiple match arms | LL ~ Foo::Bar { bar: Bar::B, .. } => (), LL ~ _ => todo!(), diff --git a/src/test/ui/pattern/usefulness/issue-40221.stderr b/src/test/ui/pattern/usefulness/issue-40221.stderr index ca2ac71b1e4..c477e435335 100644 --- a/src/test/ui/pattern/usefulness/issue-40221.stderr +++ b/src/test/ui/pattern/usefulness/issue-40221.stderr @@ -12,7 +12,7 @@ LL | enum P { LL | C(PC), | ^ not covered = note: the matched value is of type `P` -help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ P::C(PC::Q) => (), LL ~ C(QA) => todo!(), diff --git a/src/test/ui/pattern/usefulness/issue-4321.stderr b/src/test/ui/pattern/usefulness/issue-4321.stderr index 19ee7aaf9be..29327317410 100644 --- a/src/test/ui/pattern/usefulness/issue-4321.stderr +++ b/src/test/ui/pattern/usefulness/issue-4321.stderr @@ -5,7 +5,7 @@ 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, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ (true, true) => "baz", LL + (true, false) => todo!() diff --git a/src/test/ui/pattern/usefulness/issue-50900.stderr b/src/test/ui/pattern/usefulness/issue-50900.stderr index 6d437de8cea..2bdbecabbbe 100644 --- a/src/test/ui/pattern/usefulness/issue-50900.stderr +++ b/src/test/ui/pattern/usefulness/issue-50900.stderr @@ -10,7 +10,7 @@ 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, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ Tag::ExifIFDPointer => {} LL + Tag(Exif, _) => todo!() diff --git a/src/test/ui/pattern/usefulness/issue-56379.stderr b/src/test/ui/pattern/usefulness/issue-56379.stderr index 9d0ba0564a1..f6261001c5e 100644 --- a/src/test/ui/pattern/usefulness/issue-56379.stderr +++ b/src/test/ui/pattern/usefulness/issue-56379.stderr @@ -16,7 +16,7 @@ LL | B(bool), LL | C(bool), | ^ not covered = note: the matched value is of type `Foo` -help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms +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 | LL ~ Foo::C(true) => {} LL + A(false) | B(false) | C(false) => todo!() diff --git a/src/test/ui/pattern/usefulness/issue-72377.stderr b/src/test/ui/pattern/usefulness/issue-72377.stderr index 396595b2635..20f002dd3db 100644 --- a/src/test/ui/pattern/usefulness/issue-72377.stderr +++ b/src/test/ui/pattern/usefulness/issue-72377.stderr @@ -5,7 +5,7 @@ LL | match (x, y) { | ^^^^^^ patterns `(A, Some(A))`, `(A, Some(B))`, `(B, Some(B))` and 2 more not covered | = note: the matched value is of type `(X, Option)` -help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown, or multiple match arms | LL ~ (X::A, Some(X::C)) | (X::C, Some(X::A)) => false, LL ~ _ => todo!(), diff --git a/src/test/ui/pattern/usefulness/issue-78123-non-exhaustive-reference.stderr b/src/test/ui/pattern/usefulness/issue-78123-non-exhaustive-reference.stderr index 5b080b14849..bf05d616d6e 100644 --- a/src/test/ui/pattern/usefulness/issue-78123-non-exhaustive-reference.stderr +++ b/src/test/ui/pattern/usefulness/issue-78123-non-exhaustive-reference.stderr @@ -11,7 +11,7 @@ LL | enum A {} | ^ = note: the matched value is of type `&A` = note: references are always considered inhabited -help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown | LL ~ match a { LL + _ => todo!(), diff --git a/src/test/ui/pattern/usefulness/match-arm-statics-2.stderr b/src/test/ui/pattern/usefulness/match-arm-statics-2.stderr index 892030c72ea..3326e6b85a4 100644 --- a/src/test/ui/pattern/usefulness/match-arm-statics-2.stderr +++ b/src/test/ui/pattern/usefulness/match-arm-statics-2.stderr @@ -5,7 +5,7 @@ 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, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ (false, true) => (), LL + (true, false) => todo!() @@ -33,7 +33,7 @@ LL | | Some(#[stable(feature = "rust1", since = "1.0.0")] T), LL | | } | |_- = note: the matched value is of type `Option>` -help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ None => (), LL + Some(Some(West)) => todo!() @@ -51,7 +51,7 @@ note: `Foo` defined here LL | struct Foo { | ^^^ = note: the matched value is of type `Foo` -help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ Foo { bar: Some(EAST), .. } => (), LL + Foo { bar: Some(North), baz: NewBool(true) } => todo!() diff --git a/src/test/ui/pattern/usefulness/match-byte-array-patterns-2.stderr b/src/test/ui/pattern/usefulness/match-byte-array-patterns-2.stderr index 4913e6e9c9f..a90f32f7aeb 100644 --- a/src/test/ui/pattern/usefulness/match-byte-array-patterns-2.stderr +++ b/src/test/ui/pattern/usefulness/match-byte-array-patterns-2.stderr @@ -5,7 +5,7 @@ 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, possibly by adding wildcards or more match arms +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 | LL ~ b"AAAA" => {} LL + &[0_u8..=64_u8, _, _, _] | &[66_u8..=u8::MAX, _, _, _] => todo!() @@ -18,7 +18,7 @@ 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, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown, or multiple match arms | LL ~ b"AAAA" => {} LL + _ => todo!() diff --git a/src/test/ui/pattern/usefulness/match-non-exhaustive.stderr b/src/test/ui/pattern/usefulness/match-non-exhaustive.stderr index 63fcd2a9638..08dde523a15 100644 --- a/src/test/ui/pattern/usefulness/match-non-exhaustive.stderr +++ b/src/test/ui/pattern/usefulness/match-non-exhaustive.stderr @@ -5,7 +5,7 @@ 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, possibly by adding wildcards or more match arms +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 | LL | match 0 { 1 => (), i32::MIN..=0_i32 | 2_i32..=i32::MAX => todo!() } | ++++++++++++++++++++++++++++++++++++++++++++++++ @@ -17,7 +17,7 @@ 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, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL | match 0 { 0 if false => (), _ => todo!() } | ++++++++++++++ diff --git a/src/test/ui/pattern/usefulness/match-privately-empty.stderr b/src/test/ui/pattern/usefulness/match-privately-empty.stderr index 8f8e87adb7a..88178d64291 100644 --- a/src/test/ui/pattern/usefulness/match-privately-empty.stderr +++ b/src/test/ui/pattern/usefulness/match-privately-empty.stderr @@ -17,7 +17,7 @@ LL | | Some(#[stable(feature = "rust1", since = "1.0.0")] T), LL | | } | |_- = note: the matched value is of type `Option` -help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ }) => {} LL + Some(Private { misc: true, .. }) => todo!() diff --git a/src/test/ui/pattern/usefulness/match-slice-patterns.stderr b/src/test/ui/pattern/usefulness/match-slice-patterns.stderr index 3b4fc754dd7..961dd590119 100644 --- a/src/test/ui/pattern/usefulness/match-slice-patterns.stderr +++ b/src/test/ui/pattern/usefulness/match-slice-patterns.stderr @@ -5,7 +5,7 @@ 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, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ &[.., Some(_), _] => {} LL ~ &[_, Some(_), .., None, _] => todo!(), diff --git a/src/test/ui/pattern/usefulness/non-exhaustive-defined-here.stderr b/src/test/ui/pattern/usefulness/non-exhaustive-defined-here.stderr index 9a2029cc257..8f5adccea80 100644 --- a/src/test/ui/pattern/usefulness/non-exhaustive-defined-here.stderr +++ b/src/test/ui/pattern/usefulness/non-exhaustive-defined-here.stderr @@ -16,7 +16,7 @@ LL | B, LL | C | ^ not covered = note: the matched value is of type `E` -help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms +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 | LL ~ E::A => {} LL + B | C => todo!() @@ -65,7 +65,7 @@ LL | B, LL | C | ^ not covered = note: the matched value is of type `&E` -help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms +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 | LL ~ E::A => {} LL + &B | &C => todo!() @@ -114,7 +114,7 @@ LL | B, LL | C | ^ not covered = note: the matched value is of type `&&mut &E` -help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms +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 | LL ~ E::A => {} LL + &&mut &B | &&mut &C => todo!() @@ -160,7 +160,7 @@ LL | enum Opt { LL | None, | ^^^^ not covered = note: the matched value is of type `Opt` -help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ Opt::Some(ref _x) => {} LL + None => todo!() diff --git a/src/test/ui/pattern/usefulness/non-exhaustive-match-nested.stderr b/src/test/ui/pattern/usefulness/non-exhaustive-match-nested.stderr index 312b9ad89cc..cbbd544f943 100644 --- a/src/test/ui/pattern/usefulness/non-exhaustive-match-nested.stderr +++ b/src/test/ui/pattern/usefulness/non-exhaustive-match-nested.stderr @@ -5,7 +5,7 @@ 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, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ (None, Ok(&[_, _, ..])) => "None, Ok(at least two elements)", LL + (Some(&[]), Err(_)) => todo!() @@ -23,7 +23,7 @@ note: `T` defined here LL | enum T { A(U), B } | - ^ not covered = note: the matched value is of type `T` -help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ T::B => { panic!("goodbye"); } LL + A(C) => todo!() diff --git a/src/test/ui/pattern/usefulness/non-exhaustive-match.stderr b/src/test/ui/pattern/usefulness/non-exhaustive-match.stderr index 15e967ae4da..e7fa6a7814f 100644 --- a/src/test/ui/pattern/usefulness/non-exhaustive-match.stderr +++ b/src/test/ui/pattern/usefulness/non-exhaustive-match.stderr @@ -10,7 +10,7 @@ note: `T` defined here LL | enum T { A, B } | - ^ not covered = note: the matched value is of type `T` -help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL | match x { T::B => { } A => todo!() } | ++++++++++++ @@ -22,7 +22,7 @@ LL | match true { | ^^^^ pattern `false` not covered | = note: the matched value is of type `bool` -help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ true => {} LL + false => todo!() @@ -47,7 +47,7 @@ LL | | Some(#[stable(feature = "rust1", since = "1.0.0")] T), LL | | } | |_- = note: the matched value is of type `Option` -help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ None => {} LL + Some(_) => todo!() @@ -60,7 +60,7 @@ 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, possibly by adding wildcards or more match arms +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 | LL ~ (_, _, 4) => {} LL + (_, _, i32::MIN..=3_i32) | (_, _, 5_i32..=i32::MAX) => todo!() @@ -73,7 +73,7 @@ LL | match (T::A, T::A) { | ^^^^^^^^^^^^ patterns `(A, A)` and `(B, B)` not covered | = note: the matched value is of type `(T, T)` -help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms | LL ~ (T::B, T::A) => {} LL + (A, A) | (B, B) => todo!() @@ -91,7 +91,7 @@ note: `T` defined here LL | enum T { A, B } | - ^ not covered = note: the matched value is of type `T` -help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ T::A => {} LL + B => todo!() @@ -104,7 +104,7 @@ LL | match *vec { | ^^^^ pattern `[]` not covered | = note: the matched value is of type `[Option]` -help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ [None] => {} LL + [] => todo!() @@ -117,7 +117,7 @@ LL | match *vec { | ^^^^ pattern `[_, _, _, _, ..]` not covered | = note: the matched value is of type `[f32]` -help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ [] => (), LL + [_, _, _, _, ..] => todo!() diff --git a/src/test/ui/pattern/usefulness/non-exhaustive-pattern-witness.stderr b/src/test/ui/pattern/usefulness/non-exhaustive-pattern-witness.stderr index 8883829aadf..b0cfd631fb0 100644 --- a/src/test/ui/pattern/usefulness/non-exhaustive-pattern-witness.stderr +++ b/src/test/ui/pattern/usefulness/non-exhaustive-pattern-witness.stderr @@ -10,7 +10,7 @@ note: `Foo` defined here LL | struct Foo { | ^^^ = note: the matched value is of type `Foo` -help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ Foo { first: false, second: Some([1, 2, 3, 4]) } => (), LL + Foo { first: false, second: Some([_, _, _, _]) } => todo!() @@ -30,7 +30,7 @@ LL | enum Color { LL | Red, | ^^^ not covered = note: the matched value is of type `Color` -help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ Color::Green => (), LL + Red => todo!() @@ -53,7 +53,7 @@ LL | North, East, South, West | | not covered | not covered = note: the matched value is of type `Direction` -help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms +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 | LL ~ Direction::North => (), LL + East | South | West => todo!() @@ -71,7 +71,7 @@ note: `ExcessiveEnum` defined here LL | enum ExcessiveEnum { | ^^^^^^^^^^^^^ = note: the matched value is of type `ExcessiveEnum` -help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown, or multiple match arms | LL ~ ExcessiveEnum::First => (), LL + _ => todo!() @@ -92,7 +92,7 @@ LL | enum Color { LL | CustomRGBA { a: bool, r: u8, g: u8, b: u8 } | ^^^^^^^^^^ not covered = note: the matched value is of type `Color` -help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ Color::CustomRGBA { a: false, r: _, g: _, b: _ } => (), LL + CustomRGBA { a: true, .. } => todo!() @@ -105,7 +105,7 @@ LL | match *x { | ^^ pattern `[Second(true), Second(false)]` not covered | = note: the matched value is of type `[Enum]` -help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ [_, _, ref tail @ .., _] => (), LL + [Second(true), Second(false)] => todo!() @@ -118,7 +118,7 @@ LL | match ((), false) { | ^^^^^^^^^^^ pattern `((), false)` not covered | = note: the matched value is of type `((), bool)` -help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ ((), true) => (), LL + ((), false) => todo!() diff --git a/src/test/ui/pattern/usefulness/slice-patterns-exhaustiveness.stderr b/src/test/ui/pattern/usefulness/slice-patterns-exhaustiveness.stderr index dd1f24fdb67..5d1e170ae6c 100644 --- a/src/test/ui/pattern/usefulness/slice-patterns-exhaustiveness.stderr +++ b/src/test/ui/pattern/usefulness/slice-patterns-exhaustiveness.stderr @@ -5,7 +5,7 @@ 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, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ [true, .., true] => {} LL + &[false, _] => todo!() @@ -18,7 +18,7 @@ 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, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ [true, .., true] => {} LL + &[false, ..] => todo!() @@ -31,7 +31,7 @@ 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, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ [true, .., true] => {} LL + &[false, ..] => todo!() @@ -44,7 +44,7 @@ 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, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ [.., false] => {} LL + &[false, true] => todo!() @@ -57,7 +57,7 @@ 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, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ [.., false] => {} LL + &[false, .., true] => todo!() @@ -70,7 +70,7 @@ 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, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ [.., false] => {} LL + &[false, .., true] => todo!() @@ -83,7 +83,7 @@ LL | match s { | ^ pattern `&[_, ..]` not covered | = note: the matched value is of type `&[bool]` -help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ [] => {} LL + &[_, ..] => todo!() @@ -96,7 +96,7 @@ LL | match s { | ^ pattern `&[_, _, ..]` not covered | = note: the matched value is of type `&[bool]` -help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ [_] => {} LL + &[_, _, ..] => todo!() @@ -109,7 +109,7 @@ LL | match s { | ^ pattern `&[false, ..]` not covered | = note: the matched value is of type `&[bool]` -help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ [true, ..] => {} LL + &[false, ..] => todo!() @@ -122,7 +122,7 @@ LL | match s { | ^ pattern `&[false, _, ..]` not covered | = note: the matched value is of type `&[bool]` -help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ [true, ..] => {} LL + &[false, _, ..] => todo!() @@ -135,7 +135,7 @@ LL | match s { | ^ pattern `&[_, .., false]` not covered | = note: the matched value is of type `&[bool]` -help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ [.., true] => {} LL + &[_, .., false] => todo!() @@ -148,7 +148,7 @@ LL | match s { | ^ pattern `&[_, _, .., true]` not covered | = note: the matched value is of type `&[bool]` -help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ [.., false] => {} LL + &[_, _, .., true] => todo!() @@ -161,7 +161,7 @@ LL | match s { | ^ pattern `&[true, _, .., _]` not covered | = note: the matched value is of type `&[bool]` -help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ [false, .., false] => {} LL + &[true, _, .., _] => todo!() @@ -174,7 +174,7 @@ LL | match s { | ^ patterns `&[]` and `&[_, _, ..]` not covered | = note: the matched value is of type `&[bool]` -help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms | LL ~ &[true] => {} LL + &[] | &[_, _, ..] => todo!() @@ -187,7 +187,7 @@ LL | match s { | ^ patterns `&[]` and `&[_, _, ..]` not covered | = note: the matched value is of type `&[bool]` -help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms | LL ~ CONST => {} LL + &[] | &[_, _, ..] => todo!() @@ -200,7 +200,7 @@ LL | match s { | ^ patterns `&[]` and `&[_, _, ..]` not covered | = note: the matched value is of type `&[bool]` -help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms | LL ~ &[false] => {} LL + &[] | &[_, _, ..] => todo!() @@ -213,7 +213,7 @@ LL | match s { | ^ patterns `&[]` and `&[_, _, ..]` not covered | = note: the matched value is of type `&[bool]` -help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms | LL ~ CONST => {} LL + &[] | &[_, _, ..] => todo!() @@ -226,7 +226,7 @@ LL | match s { | ^ pattern `&[_, _, ..]` not covered | = note: the matched value is of type `&[bool]` -help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ CONST => {} LL + &[_, _, ..] => todo!() @@ -239,7 +239,7 @@ LL | match s { | ^ pattern `&[false]` not covered | = note: the matched value is of type `&[bool]` -help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ &[_, _, ..] => {} LL + &[false] => todo!() @@ -252,7 +252,7 @@ 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, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ CONST1 => {} LL + &[false] => todo!() diff --git a/src/test/ui/pattern/usefulness/stable-gated-patterns.stderr b/src/test/ui/pattern/usefulness/stable-gated-patterns.stderr index 5956c6b6615..696ef9d8de9 100644 --- a/src/test/ui/pattern/usefulness/stable-gated-patterns.stderr +++ b/src/test/ui/pattern/usefulness/stable-gated-patterns.stderr @@ -18,7 +18,7 @@ LL | | Unstable, LL | | } | |_- = note: the matched value is of type `Foo` -help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms +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 | LL ~ Foo::Stable => {} LL + Stable2 | _ => todo!() @@ -42,7 +42,7 @@ LL | | Unstable, LL | | } | |_^ = note: the matched value is of type `Foo` -help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ Foo::Stable2 => {} LL + _ => todo!() diff --git a/src/test/ui/pattern/usefulness/struct-like-enum-nonexhaustive.stderr b/src/test/ui/pattern/usefulness/struct-like-enum-nonexhaustive.stderr index 596fb13e92b..6127fad3f7d 100644 --- a/src/test/ui/pattern/usefulness/struct-like-enum-nonexhaustive.stderr +++ b/src/test/ui/pattern/usefulness/struct-like-enum-nonexhaustive.stderr @@ -12,7 +12,7 @@ LL | enum A { LL | B { x: Option }, | ^ not covered = note: the matched value is of type `A` -help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ A::B { x: None } => {} LL + B { x: Some(_) } => todo!() diff --git a/src/test/ui/pattern/usefulness/tuple-struct-nonexhaustive.stderr b/src/test/ui/pattern/usefulness/tuple-struct-nonexhaustive.stderr index a1b233d3f98..fc0430d06fa 100644 --- a/src/test/ui/pattern/usefulness/tuple-struct-nonexhaustive.stderr +++ b/src/test/ui/pattern/usefulness/tuple-struct-nonexhaustive.stderr @@ -10,7 +10,7 @@ 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, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ Foo(2, b) => println!("{}", b) LL + Foo(_, _) => todo!() diff --git a/src/test/ui/pattern/usefulness/type_polymorphic_byte_str_literals.stderr b/src/test/ui/pattern/usefulness/type_polymorphic_byte_str_literals.stderr index 1f0bf5ccca5..acae605dae3 100644 --- a/src/test/ui/pattern/usefulness/type_polymorphic_byte_str_literals.stderr +++ b/src/test/ui/pattern/usefulness/type_polymorphic_byte_str_literals.stderr @@ -5,7 +5,7 @@ LL | match data { | ^^^^ pattern `&[_, ..]` not covered | = note: the matched value is of type `&[u8]` -help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ b"" => 1, LL ~ &[_, ..] => todo!(), @@ -18,7 +18,7 @@ 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, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown, or multiple match arms | LL ~ [_, _, _] => 1, LL ~ _ => todo!(), diff --git a/src/test/ui/pattern/usefulness/unstable-gated-patterns.stderr b/src/test/ui/pattern/usefulness/unstable-gated-patterns.stderr index 3f987fc2ef5..8487c9725da 100644 --- a/src/test/ui/pattern/usefulness/unstable-gated-patterns.stderr +++ b/src/test/ui/pattern/usefulness/unstable-gated-patterns.stderr @@ -17,7 +17,7 @@ LL | | Unstable, LL | | } | |_- = note: the matched value is of type `Foo` -help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ Foo::Stable2 => {} LL + Unstable => todo!() diff --git a/src/test/ui/rfc-2005-default-binding-mode/slice.stderr b/src/test/ui/rfc-2005-default-binding-mode/slice.stderr index df5b2000728..60c1f5420f6 100644 --- a/src/test/ui/rfc-2005-default-binding-mode/slice.stderr +++ b/src/test/ui/rfc-2005-default-binding-mode/slice.stderr @@ -5,7 +5,7 @@ LL | match sl { | ^^ pattern `&[]` not covered | = note: the matched value is of type `&[u8]` -help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ [first, remainder @ ..] => {} LL ~ &[] => todo!(), diff --git a/src/test/ui/rfc-2008-non-exhaustive/enum.stderr b/src/test/ui/rfc-2008-non-exhaustive/enum.stderr index 8809f13079c..5ef078c2005 100644 --- a/src/test/ui/rfc-2008-non-exhaustive/enum.stderr +++ b/src/test/ui/rfc-2008-non-exhaustive/enum.stderr @@ -10,7 +10,7 @@ note: `EmptyNonExhaustiveEnum` defined here LL | pub enum EmptyNonExhaustiveEnum {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: the matched value is of type `EmptyNonExhaustiveEnum`, which is marked as non-exhaustive -help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown | LL ~ match x { LL + _ => todo!(), @@ -33,7 +33,7 @@ LL | | Struct { field: u32 }, LL | | } | |_^ = note: the matched value is of type `NonExhaustiveEnum`, which is marked as non-exhaustive -help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ NonExhaustiveEnum::Struct { .. } => "third", LL + _ => todo!() @@ -55,7 +55,7 @@ LL | | Struct { field: u32 }, LL | | } | |_^ = note: the matched value is of type `NonExhaustiveEnum`, which is marked as non-exhaustive -help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ match enum_unit { LL + _ => todo!(), diff --git a/src/test/ui/rfc-2008-non-exhaustive/enum_same_crate_empty_match.stderr b/src/test/ui/rfc-2008-non-exhaustive/enum_same_crate_empty_match.stderr index 6da7950a7a0..1f20904483f 100644 --- a/src/test/ui/rfc-2008-non-exhaustive/enum_same_crate_empty_match.stderr +++ b/src/test/ui/rfc-2008-non-exhaustive/enum_same_crate_empty_match.stderr @@ -30,7 +30,7 @@ LL | LL | Struct { field: u32 } | ^^^^^^ not covered = note: the matched value is of type `NonExhaustiveEnum` -help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms +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 | LL ~ match NonExhaustiveEnum::Unit { LL + Unit | Tuple(_) | Struct { .. } => todo!(), @@ -57,7 +57,7 @@ LL | LL | Struct { field: u32 } | ^^^^^^ not covered = note: the matched value is of type `NormalEnum` -help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms +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 | LL ~ match NormalEnum::Unit { LL + Unit | Tuple(_) | Struct { .. } => todo!(), diff --git a/src/test/ui/rfc-2008-non-exhaustive/uninhabited/indirect_match.stderr b/src/test/ui/rfc-2008-non-exhaustive/uninhabited/indirect_match.stderr index ed9f3cf1982..2dc4eabb863 100644 --- a/src/test/ui/rfc-2008-non-exhaustive/uninhabited/indirect_match.stderr +++ b/src/test/ui/rfc-2008-non-exhaustive/uninhabited/indirect_match.stderr @@ -10,7 +10,7 @@ note: `IndirectUninhabitedEnum` defined here LL | pub struct IndirectUninhabitedEnum(UninhabitedEnum); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: the matched value is of type `IndirectUninhabitedEnum` -help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown | LL ~ match x { LL + _ => todo!(), @@ -29,7 +29,7 @@ note: `IndirectUninhabitedStruct` defined here LL | pub struct IndirectUninhabitedStruct(UninhabitedStruct); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: the matched value is of type `IndirectUninhabitedStruct` -help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown | LL ~ match x { LL + _ => todo!(), @@ -48,7 +48,7 @@ note: `IndirectUninhabitedTupleStruct` defined here LL | pub struct IndirectUninhabitedTupleStruct(UninhabitedTupleStruct); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: the matched value is of type `IndirectUninhabitedTupleStruct` -help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown | LL ~ match x { LL + _ => todo!(), @@ -67,7 +67,7 @@ note: `IndirectUninhabitedVariants` defined here LL | pub struct IndirectUninhabitedVariants(UninhabitedVariants); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: the matched value is of type `IndirectUninhabitedVariants` -help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown | LL ~ match x { LL + _ => todo!(), diff --git a/src/test/ui/rfc-2008-non-exhaustive/uninhabited/indirect_match_same_crate.stderr b/src/test/ui/rfc-2008-non-exhaustive/uninhabited/indirect_match_same_crate.stderr index f8751c89e14..c1219054140 100644 --- a/src/test/ui/rfc-2008-non-exhaustive/uninhabited/indirect_match_same_crate.stderr +++ b/src/test/ui/rfc-2008-non-exhaustive/uninhabited/indirect_match_same_crate.stderr @@ -10,7 +10,7 @@ note: `IndirectUninhabitedEnum` defined here LL | pub struct IndirectUninhabitedEnum(UninhabitedEnum); | ^^^^^^^^^^^^^^^^^^^^^^^ = note: the matched value is of type `IndirectUninhabitedEnum` -help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown | LL ~ match x { LL + _ => todo!(), @@ -29,7 +29,7 @@ note: `IndirectUninhabitedStruct` defined here LL | pub struct IndirectUninhabitedStruct(UninhabitedStruct); | ^^^^^^^^^^^^^^^^^^^^^^^^^ = note: the matched value is of type `IndirectUninhabitedStruct` -help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown | LL ~ match x { LL + _ => todo!(), @@ -48,7 +48,7 @@ note: `IndirectUninhabitedTupleStruct` defined here LL | pub struct IndirectUninhabitedTupleStruct(UninhabitedTupleStruct); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: the matched value is of type `IndirectUninhabitedTupleStruct` -help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown | LL ~ match x { LL + _ => todo!(), @@ -67,7 +67,7 @@ note: `IndirectUninhabitedVariants` defined here LL | pub struct IndirectUninhabitedVariants(UninhabitedVariants); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: the matched value is of type `IndirectUninhabitedVariants` -help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown | LL ~ match x { LL + _ => todo!(), diff --git a/src/test/ui/rfc-2008-non-exhaustive/uninhabited/indirect_match_with_exhaustive_patterns.stderr b/src/test/ui/rfc-2008-non-exhaustive/uninhabited/indirect_match_with_exhaustive_patterns.stderr index 828f57cad0f..f0cb13de3f7 100644 --- a/src/test/ui/rfc-2008-non-exhaustive/uninhabited/indirect_match_with_exhaustive_patterns.stderr +++ b/src/test/ui/rfc-2008-non-exhaustive/uninhabited/indirect_match_with_exhaustive_patterns.stderr @@ -10,7 +10,7 @@ note: `IndirectUninhabitedEnum` defined here LL | pub struct IndirectUninhabitedEnum(UninhabitedEnum); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: the matched value is of type `IndirectUninhabitedEnum` -help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown | LL ~ match x { LL + _ => todo!(), @@ -29,7 +29,7 @@ note: `IndirectUninhabitedStruct` defined here LL | pub struct IndirectUninhabitedStruct(UninhabitedStruct); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: the matched value is of type `IndirectUninhabitedStruct` -help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown | LL ~ match x { LL + _ => todo!(), @@ -48,7 +48,7 @@ note: `IndirectUninhabitedTupleStruct` defined here LL | pub struct IndirectUninhabitedTupleStruct(UninhabitedTupleStruct); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: the matched value is of type `IndirectUninhabitedTupleStruct` -help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown | LL ~ match x { LL + _ => todo!(), @@ -67,7 +67,7 @@ note: `IndirectUninhabitedVariants` defined here LL | pub struct IndirectUninhabitedVariants(UninhabitedVariants); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: the matched value is of type `IndirectUninhabitedVariants` -help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown | LL ~ match x { LL + _ => todo!(), diff --git a/src/test/ui/rfc-2008-non-exhaustive/uninhabited/match.stderr b/src/test/ui/rfc-2008-non-exhaustive/uninhabited/match.stderr index 82760df19d6..49febd9241d 100644 --- a/src/test/ui/rfc-2008-non-exhaustive/uninhabited/match.stderr +++ b/src/test/ui/rfc-2008-non-exhaustive/uninhabited/match.stderr @@ -11,7 +11,7 @@ LL | / pub enum UninhabitedEnum { LL | | } | |_^ = note: the matched value is of type `UninhabitedEnum`, which is marked as non-exhaustive -help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown | LL ~ match x { LL + _ => todo!(), @@ -32,7 +32,7 @@ LL | | _priv: !, LL | | } | |_^ = note: the matched value is of type `UninhabitedStruct` -help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown | LL ~ match x { LL + _ => todo!(), @@ -51,7 +51,7 @@ note: `UninhabitedTupleStruct` defined here LL | pub struct UninhabitedTupleStruct(!); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: the matched value is of type `UninhabitedTupleStruct` -help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown | LL ~ match x { LL + _ => todo!(), @@ -75,7 +75,7 @@ LL | | #[non_exhaustive] Struct { x: ! } LL | | } | |_- = note: the matched value is of type `UninhabitedVariants` -help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms +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 | LL ~ match x { LL + Tuple(_) | Struct { .. } => todo!(), diff --git a/src/test/ui/rfc-2008-non-exhaustive/uninhabited/match_same_crate.stderr b/src/test/ui/rfc-2008-non-exhaustive/uninhabited/match_same_crate.stderr index 4aea7da6b38..c89c70ae6cc 100644 --- a/src/test/ui/rfc-2008-non-exhaustive/uninhabited/match_same_crate.stderr +++ b/src/test/ui/rfc-2008-non-exhaustive/uninhabited/match_same_crate.stderr @@ -10,7 +10,7 @@ note: `UninhabitedStruct` defined here LL | pub struct UninhabitedStruct { | ^^^^^^^^^^^^^^^^^ = note: the matched value is of type `UninhabitedStruct` -help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown | LL ~ match x { LL + _ => todo!(), @@ -29,7 +29,7 @@ note: `UninhabitedTupleStruct` defined here LL | pub struct UninhabitedTupleStruct(!); | ^^^^^^^^^^^^^^^^^^^^^^ = note: the matched value is of type `UninhabitedTupleStruct` -help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown | LL ~ match x { LL + _ => todo!(), @@ -52,7 +52,7 @@ LL | #[non_exhaustive] Tuple(!), LL | #[non_exhaustive] Struct { x: ! } | ^^^^^^ not covered = note: the matched value is of type `UninhabitedVariants` -help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms +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 | LL ~ match x { LL + Tuple(_) | Struct { .. } => todo!(), diff --git a/src/test/ui/rfc-2008-non-exhaustive/uninhabited/match_with_exhaustive_patterns.stderr b/src/test/ui/rfc-2008-non-exhaustive/uninhabited/match_with_exhaustive_patterns.stderr index 7414cd8a058..e18c2678d32 100644 --- a/src/test/ui/rfc-2008-non-exhaustive/uninhabited/match_with_exhaustive_patterns.stderr +++ b/src/test/ui/rfc-2008-non-exhaustive/uninhabited/match_with_exhaustive_patterns.stderr @@ -11,7 +11,7 @@ LL | / pub enum UninhabitedEnum { LL | | } | |_^ = note: the matched value is of type `UninhabitedEnum`, which is marked as non-exhaustive -help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown | LL ~ match x { LL + _ => todo!(), @@ -32,7 +32,7 @@ LL | | _priv: !, LL | | } | |_^ = note: the matched value is of type `UninhabitedStruct` -help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown | LL ~ match x { LL + _ => todo!(), @@ -51,7 +51,7 @@ note: `UninhabitedTupleStruct` defined here LL | pub struct UninhabitedTupleStruct(!); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: the matched value is of type `UninhabitedTupleStruct` -help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown | LL ~ match x { LL + _ => todo!(), @@ -75,7 +75,7 @@ LL | | #[non_exhaustive] Struct { x: ! } LL | | } | |_- = note: the matched value is of type `UninhabitedVariants` -help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms +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 | LL ~ match x { LL + Tuple(_) | Struct { .. } => todo!(), diff --git a/src/test/ui/uninhabited/uninhabited-matches-feature-gated.stderr b/src/test/ui/uninhabited/uninhabited-matches-feature-gated.stderr index 26d02006bf6..d90075d82f4 100644 --- a/src/test/ui/uninhabited/uninhabited-matches-feature-gated.stderr +++ b/src/test/ui/uninhabited/uninhabited-matches-feature-gated.stderr @@ -17,7 +17,7 @@ LL | | Err(#[stable(feature = "rust1", since = "1.0.0")] E), LL | | } | |_- = note: the matched value is of type `Result` -help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ Ok(n) => n, LL ~ Err(_) => todo!(), @@ -36,7 +36,7 @@ LL | enum Void {} | ^^^^ = note: the matched value is of type `&Void` = note: references are always considered inhabited -help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown | LL ~ let _ = match x { LL + _ => todo!(), @@ -50,7 +50,7 @@ LL | let _ = match x {}; | ^ | = note: the matched value is of type `(Void,)` -help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown | LL ~ let _ = match x { LL + _ => todo!(), @@ -64,7 +64,7 @@ LL | let _ = match x {}; | ^ | = note: the matched value is of type `[Void; 1]` -help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown | LL ~ let _ = match x { LL + _ => todo!(), @@ -78,7 +78,7 @@ LL | let _ = match x { | ^ pattern `&[_, ..]` not covered | = note: the matched value is of type `&[Void]` -help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ &[] => (), LL ~ &[_, ..] => todo!(), @@ -103,7 +103,7 @@ LL | | Err(#[stable(feature = "rust1", since = "1.0.0")] E), LL | | } | |_- = note: the matched value is of type `Result` -help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ Ok(x) => x, LL ~ Err(_) => todo!(),