diff options
| author | Esteban Kuber <esteban@kuber.com.ar> | 2021-12-16 02:14:17 +0000 |
|---|---|---|
| committer | Esteban Kuber <esteban@kuber.com.ar> | 2022-03-08 00:18:24 +0000 |
| commit | 2383858f34989f7c6c87da857bd038f5ce0a66b0 (patch) | |
| tree | fae94544bea7a6888068b41bb51c1983aeceb813 | |
| parent | 02a3830f245d84672db133208c73756eb8778964 (diff) | |
| download | rust-2383858f34989f7c6c87da857bd038f5ce0a66b0.tar.gz rust-2383858f34989f7c6c87da857bd038f5ce0a66b0.zip | |
When finding a match expr with a single arm that requires more, suggest it
Given
```rust
match Some(42) {
Some(0) => {}
}
```
suggest
```rust
match Some(42) {
Some(0) => {}
None | Some(_) => todo!(),
}
```
31 files changed, 805 insertions, 159 deletions
diff --git a/compiler/rustc_mir_build/src/thir/pattern/check_match.rs b/compiler/rustc_mir_build/src/thir/pattern/check_match.rs index cb057e428c4..f1c2ec08c3c 100644 --- a/compiler/rustc_mir_build/src/thir/pattern/check_match.rs +++ b/compiler/rustc_mir_build/src/thir/pattern/check_match.rs @@ -589,6 +589,21 @@ fn non_exhaustive_match<'p, 'tcx>( ), )); } + [only] => { + let pre_indentation = if let (Some(snippet), true) = ( + sm.indentation_before(only.span), + sm.is_multiline(sp.shrink_to_hi().with_hi(only.span.lo())), + ) { + format!("\n{}", snippet) + } else { + " ".to_string() + }; + let comma = if matches!(only.body.kind, hir::ExprKind::Block(..)) { "" } else { "," }; + suggestion = Some(( + only.span.shrink_to_hi(), + format!("{}{}{} => todo!()", comma, pre_indentation, pattern), + )); + } _ => {} } 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 feb371d4ed6..5e66d1318fb 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 @@ -8,7 +8,11 @@ LL | move |i| match msg_type { | ^^^^^^^^ patterns `Opcode(0_u8)` and `Opcode(2_u8..=u8::MAX)` not covered | = note: the matched value is of type `Opcode` - = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms + | +LL ~ Opcode::OP1 => unimplemented!(), +LL ~ Opcode(0_u8) | Opcode(2_u8..=u8::MAX) => todo!(), + | error[E0004]: non-exhaustive patterns: `Opcode2(Opcode(0_u8))` and `Opcode2(Opcode(2_u8..=u8::MAX))` not covered --> $DIR/issue-88331.rs:27:20 @@ -20,7 +24,11 @@ LL | move |i| match msg_type { | ^^^^^^^^ patterns `Opcode2(Opcode(0_u8))` and `Opcode2(Opcode(2_u8..=u8::MAX))` not covered | = note: the matched value is of type `Opcode2` - = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms + | +LL ~ Opcode2::OP2=> unimplemented!(), +LL ~ Opcode2(Opcode(0_u8)) | Opcode2(Opcode(2_u8..=u8::MAX)) => todo!(), + | error: aborting due to 2 previous errors 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 7d21dfe1aad..4e5fdbc3d5f 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 @@ -11,7 +11,10 @@ LL | let _b = || { match l1 { L1::A => () } }; | ^^ pattern `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, possibly by adding wildcards or more match arms + | +LL | let _b = || { match l1 { L1::A => (), B => todo!() } }; + | ++++++++++++++ error[E0004]: non-exhaustive patterns: type `E1` is non-empty --> $DIR/non-exhaustive-match.rs:37:25 diff --git a/src/test/ui/error-codes/E0004.stderr b/src/test/ui/error-codes/E0004.stderr index 96f80aeb40c..67f6abdbc54 100644 --- a/src/test/ui/error-codes/E0004.stderr +++ b/src/test/ui/error-codes/E0004.stderr @@ -12,7 +12,11 @@ LL | match x { | ^ pattern `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, possibly by adding wildcards or more match arms + | +LL ~ Terminator::TalkToMyHand => {} +LL + HastaLaVistaBaby => todo!() + | error: aborting due to previous error 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 560e8f3460b..945afffee37 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,11 @@ 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, possibly by adding wildcards or more match arms + | +LL ~ 0..=usize::MAX => {} +LL + _ => todo!() + | error[E0004]: non-exhaustive patterns: `_` not covered --> $DIR/feature-gate-precise_pointer_size_matching.rs:10:11 @@ -18,7 +22,11 @@ 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, possibly by adding wildcards or more match arms + | +LL ~ isize::MIN..=isize::MAX => {} +LL + _ => todo!() + | error: aborting due to 2 previous errors 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 1edd63c116f..1cf267cf99a 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,11 @@ 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, possibly by adding wildcards or more match arms + | +LL ~ match $s { $($t)+ => {} +LL ~ _ => todo!() } + | error[E0004]: non-exhaustive patterns: `_` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:17:8 @@ -14,7 +18,11 @@ 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, possibly by adding wildcards or more match arms + | +LL ~ match $s { $($t)+ => {} +LL ~ _ => todo!() } + | error[E0004]: non-exhaustive patterns: `'\u{10ffff}'` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:26:8 @@ -23,7 +31,11 @@ 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, possibly by adding wildcards or more match arms + | +LL ~ match $s { $($t)+ => {} +LL ~ '\u{10ffff}' => todo!() } + | error[E0004]: non-exhaustive patterns: `'\u{10fffe}'..='\u{10ffff}'` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:27:8 @@ -32,7 +44,11 @@ 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, possibly by adding wildcards or more match arms + | +LL ~ match $s { $($t)+ => {} +LL ~ '\u{10fffe}'..='\u{10ffff}' => todo!() } + | error[E0004]: non-exhaustive patterns: `'\u{0}'` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:28:8 @@ -41,7 +57,11 @@ 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, possibly by adding wildcards or more match arms + | +LL ~ match $s { $($t)+ => {} +LL ~ '\u{0}' => todo!() } + | error[E0004]: non-exhaustive patterns: `'\u{10ffff}'` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:29:8 @@ -50,7 +70,11 @@ 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, possibly by adding wildcards or more match arms + | +LL ~ match $s { $($t)+ => {} +LL ~ '\u{10ffff}' => todo!() } + | error[E0004]: non-exhaustive patterns: `'b'` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:30:8 @@ -59,7 +83,11 @@ 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, possibly by adding wildcards or more match arms + | +LL ~ match $s { $($t)+ => {} +LL ~ 'b' => todo!() } + | error[E0004]: non-exhaustive patterns: `'b'` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:31:8 @@ -68,7 +96,11 @@ 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, possibly by adding wildcards or more match arms + | +LL ~ match $s { $($t)+ => {} +LL ~ 'b' => todo!() } + | error[E0004]: non-exhaustive patterns: `u8::MAX` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:41:12 @@ -77,7 +109,11 @@ 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, possibly by adding wildcards or more match arms + | +LL ~ match $s { $($t)+ => {} +LL ~ u8::MAX => todo!() } + | error[E0004]: non-exhaustive patterns: `254_u8..=u8::MAX` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:42:12 @@ -86,7 +122,11 @@ 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, possibly by adding wildcards or more match arms + | +LL ~ match $s { $($t)+ => {} +LL ~ 254_u8..=u8::MAX => todo!() } + | error[E0004]: non-exhaustive patterns: `0_u8` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:43:12 @@ -95,7 +135,11 @@ 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, possibly by adding wildcards or more match arms + | +LL ~ match $s { $($t)+ => {} +LL ~ 0_u8 => todo!() } + | error[E0004]: non-exhaustive patterns: `u8::MAX` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:44:12 @@ -104,7 +148,11 @@ 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, possibly by adding wildcards or more match arms + | +LL ~ match $s { $($t)+ => {} +LL ~ u8::MAX => todo!() } + | error[E0004]: non-exhaustive patterns: `43_u8` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:45:12 @@ -113,7 +161,11 @@ 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, possibly by adding wildcards or more match arms + | +LL ~ match $s { $($t)+ => {} +LL ~ 43_u8 => todo!() } + | error[E0004]: non-exhaustive patterns: `43_u8` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:46:12 @@ -122,7 +174,11 @@ 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, possibly by adding wildcards or more match arms + | +LL ~ match $s { $($t)+ => {} +LL ~ 43_u8 => todo!() } + | error[E0004]: non-exhaustive patterns: `u16::MAX` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:54:12 @@ -131,7 +187,11 @@ 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, possibly by adding wildcards or more match arms + | +LL ~ match $s { $($t)+ => {} +LL ~ u16::MAX => todo!() } + | error[E0004]: non-exhaustive patterns: `65534_u16..=u16::MAX` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:55:12 @@ -140,7 +200,11 @@ 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, possibly by adding wildcards or more match arms + | +LL ~ match $s { $($t)+ => {} +LL ~ 65534_u16..=u16::MAX => todo!() } + | error[E0004]: non-exhaustive patterns: `0_u16` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:56:12 @@ -149,7 +213,11 @@ 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, possibly by adding wildcards or more match arms + | +LL ~ match $s { $($t)+ => {} +LL ~ 0_u16 => todo!() } + | error[E0004]: non-exhaustive patterns: `u16::MAX` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:57:12 @@ -158,7 +226,11 @@ 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, possibly by adding wildcards or more match arms + | +LL ~ match $s { $($t)+ => {} +LL ~ u16::MAX => todo!() } + | error[E0004]: non-exhaustive patterns: `43_u16` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:58:12 @@ -167,7 +239,11 @@ 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, possibly by adding wildcards or more match arms + | +LL ~ match $s { $($t)+ => {} +LL ~ 43_u16 => todo!() } + | error[E0004]: non-exhaustive patterns: `43_u16` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:59:12 @@ -176,7 +252,11 @@ 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, possibly by adding wildcards or more match arms + | +LL ~ match $s { $($t)+ => {} +LL ~ 43_u16 => todo!() } + | error[E0004]: non-exhaustive patterns: `u32::MAX` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:67:12 @@ -185,7 +265,11 @@ 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, possibly by adding wildcards or more match arms + | +LL ~ match $s { $($t)+ => {} +LL ~ u32::MAX => todo!() } + | error[E0004]: non-exhaustive patterns: `4294967294_u32..=u32::MAX` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:68:12 @@ -194,7 +278,11 @@ 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, possibly by adding wildcards or more match arms + | +LL ~ match $s { $($t)+ => {} +LL ~ 4294967294_u32..=u32::MAX => todo!() } + | error[E0004]: non-exhaustive patterns: `0_u32` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:69:12 @@ -203,7 +291,11 @@ 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, possibly by adding wildcards or more match arms + | +LL ~ match $s { $($t)+ => {} +LL ~ 0_u32 => todo!() } + | error[E0004]: non-exhaustive patterns: `u32::MAX` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:70:12 @@ -212,7 +304,11 @@ 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, possibly by adding wildcards or more match arms + | +LL ~ match $s { $($t)+ => {} +LL ~ u32::MAX => todo!() } + | error[E0004]: non-exhaustive patterns: `43_u32` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:71:12 @@ -221,7 +317,11 @@ 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, possibly by adding wildcards or more match arms + | +LL ~ match $s { $($t)+ => {} +LL ~ 43_u32 => todo!() } + | error[E0004]: non-exhaustive patterns: `43_u32` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:72:12 @@ -230,7 +330,11 @@ 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, possibly by adding wildcards or more match arms + | +LL ~ match $s { $($t)+ => {} +LL ~ 43_u32 => todo!() } + | error[E0004]: non-exhaustive patterns: `u64::MAX` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:80:12 @@ -239,7 +343,11 @@ 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, possibly by adding wildcards or more match arms + | +LL ~ match $s { $($t)+ => {} +LL ~ u64::MAX => todo!() } + | error[E0004]: non-exhaustive patterns: `18446744073709551614_u64..=u64::MAX` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:81:12 @@ -248,7 +356,11 @@ 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, possibly by adding wildcards or more match arms + | +LL ~ match $s { $($t)+ => {} +LL ~ 18446744073709551614_u64..=u64::MAX => todo!() } + | error[E0004]: non-exhaustive patterns: `0_u64` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:82:12 @@ -257,7 +369,11 @@ 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, possibly by adding wildcards or more match arms + | +LL ~ match $s { $($t)+ => {} +LL ~ 0_u64 => todo!() } + | error[E0004]: non-exhaustive patterns: `u64::MAX` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:83:12 @@ -266,7 +382,11 @@ 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, possibly by adding wildcards or more match arms + | +LL ~ match $s { $($t)+ => {} +LL ~ u64::MAX => todo!() } + | error[E0004]: non-exhaustive patterns: `43_u64` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:84:12 @@ -275,7 +395,11 @@ 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, possibly by adding wildcards or more match arms + | +LL ~ match $s { $($t)+ => {} +LL ~ 43_u64 => todo!() } + | error[E0004]: non-exhaustive patterns: `43_u64` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:85:12 @@ -284,7 +408,11 @@ 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, possibly by adding wildcards or more match arms + | +LL ~ match $s { $($t)+ => {} +LL ~ 43_u64 => todo!() } + | error[E0004]: non-exhaustive patterns: `u128::MAX` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:93:12 @@ -293,7 +421,11 @@ 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, possibly by adding wildcards or more match arms + | +LL ~ match $s { $($t)+ => {} +LL ~ u128::MAX => todo!() } + | error[E0004]: non-exhaustive patterns: `340282366920938463463374607431768211454_u128..=u128::MAX` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:94:12 @@ -302,7 +434,11 @@ 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, possibly by adding wildcards or more match arms + | +LL ~ match $s { $($t)+ => {} +LL ~ 340282366920938463463374607431768211454_u128..=u128::MAX => todo!() } + | error[E0004]: non-exhaustive patterns: `0_u128` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:95:12 @@ -311,7 +447,11 @@ 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, possibly by adding wildcards or more match arms + | +LL ~ match $s { $($t)+ => {} +LL ~ 0_u128 => todo!() } + | error[E0004]: non-exhaustive patterns: `u128::MAX` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:96:12 @@ -320,7 +460,11 @@ 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, possibly by adding wildcards or more match arms + | +LL ~ match $s { $($t)+ => {} +LL ~ u128::MAX => todo!() } + | error[E0004]: non-exhaustive patterns: `43_u128` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:97:12 @@ -329,7 +473,11 @@ 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, possibly by adding wildcards or more match arms + | +LL ~ match $s { $($t)+ => {} +LL ~ 43_u128 => todo!() } + | error[E0004]: non-exhaustive patterns: `43_u128` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:98:12 @@ -338,7 +486,11 @@ 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, possibly by adding wildcards or more match arms + | +LL ~ match $s { $($t)+ => {} +LL ~ 43_u128 => todo!() } + | error[E0004]: non-exhaustive patterns: `i8::MAX` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:109:12 @@ -347,7 +499,11 @@ 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, possibly by adding wildcards or more match arms + | +LL ~ match $s { $($t)+ => {} +LL ~ i8::MAX => todo!() } + | error[E0004]: non-exhaustive patterns: `126_i8..=i8::MAX` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:110:12 @@ -356,7 +512,11 @@ 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, possibly by adding wildcards or more match arms + | +LL ~ match $s { $($t)+ => {} +LL ~ 126_i8..=i8::MAX => todo!() } + | error[E0004]: non-exhaustive patterns: `i8::MIN` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:111:12 @@ -365,7 +525,11 @@ 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, possibly by adding wildcards or more match arms + | +LL ~ match $s { $($t)+ => {} +LL ~ i8::MIN => todo!() } + | error[E0004]: non-exhaustive patterns: `i8::MAX` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:112:12 @@ -374,7 +538,11 @@ 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, possibly by adding wildcards or more match arms + | +LL ~ match $s { $($t)+ => {} +LL ~ i8::MAX => todo!() } + | error[E0004]: non-exhaustive patterns: `43_i8` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:113:12 @@ -383,7 +551,11 @@ 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, possibly by adding wildcards or more match arms + | +LL ~ match $s { $($t)+ => {} +LL ~ 43_i8 => todo!() } + | error[E0004]: non-exhaustive patterns: `43_i8` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:114:12 @@ -392,7 +564,11 @@ 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, possibly by adding wildcards or more match arms + | +LL ~ match $s { $($t)+ => {} +LL ~ 43_i8 => todo!() } + | error[E0004]: non-exhaustive patterns: `i16::MAX` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:122:12 @@ -401,7 +577,11 @@ 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, possibly by adding wildcards or more match arms + | +LL ~ match $s { $($t)+ => {} +LL ~ i16::MAX => todo!() } + | error[E0004]: non-exhaustive patterns: `32766_i16..=i16::MAX` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:123:12 @@ -410,7 +590,11 @@ 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, possibly by adding wildcards or more match arms + | +LL ~ match $s { $($t)+ => {} +LL ~ 32766_i16..=i16::MAX => todo!() } + | error[E0004]: non-exhaustive patterns: `i16::MIN` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:124:12 @@ -419,7 +603,11 @@ 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, possibly by adding wildcards or more match arms + | +LL ~ match $s { $($t)+ => {} +LL ~ i16::MIN => todo!() } + | error[E0004]: non-exhaustive patterns: `i16::MAX` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:125:12 @@ -428,7 +616,11 @@ 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, possibly by adding wildcards or more match arms + | +LL ~ match $s { $($t)+ => {} +LL ~ i16::MAX => todo!() } + | error[E0004]: non-exhaustive patterns: `43_i16` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:126:12 @@ -437,7 +629,11 @@ 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, possibly by adding wildcards or more match arms + | +LL ~ match $s { $($t)+ => {} +LL ~ 43_i16 => todo!() } + | error[E0004]: non-exhaustive patterns: `43_i16` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:127:12 @@ -446,7 +642,11 @@ 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, possibly by adding wildcards or more match arms + | +LL ~ match $s { $($t)+ => {} +LL ~ 43_i16 => todo!() } + | error[E0004]: non-exhaustive patterns: `i32::MAX` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:135:12 @@ -455,7 +655,11 @@ 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, possibly by adding wildcards or more match arms + | +LL ~ match $s { $($t)+ => {} +LL ~ i32::MAX => todo!() } + | error[E0004]: non-exhaustive patterns: `2147483646_i32..=i32::MAX` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:136:12 @@ -464,7 +668,11 @@ 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, possibly by adding wildcards or more match arms + | +LL ~ match $s { $($t)+ => {} +LL ~ 2147483646_i32..=i32::MAX => todo!() } + | error[E0004]: non-exhaustive patterns: `i32::MIN` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:137:12 @@ -473,7 +681,11 @@ 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, possibly by adding wildcards or more match arms + | +LL ~ match $s { $($t)+ => {} +LL ~ i32::MIN => todo!() } + | error[E0004]: non-exhaustive patterns: `i32::MAX` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:138:12 @@ -482,7 +694,11 @@ 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, possibly by adding wildcards or more match arms + | +LL ~ match $s { $($t)+ => {} +LL ~ i32::MAX => todo!() } + | error[E0004]: non-exhaustive patterns: `43_i32` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:139:12 @@ -491,7 +707,11 @@ 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, possibly by adding wildcards or more match arms + | +LL ~ match $s { $($t)+ => {} +LL ~ 43_i32 => todo!() } + | error[E0004]: non-exhaustive patterns: `43_i32` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:140:12 @@ -500,7 +720,11 @@ 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, possibly by adding wildcards or more match arms + | +LL ~ match $s { $($t)+ => {} +LL ~ 43_i32 => todo!() } + | error[E0004]: non-exhaustive patterns: `i64::MAX` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:148:12 @@ -509,7 +733,11 @@ 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, possibly by adding wildcards or more match arms + | +LL ~ match $s { $($t)+ => {} +LL ~ i64::MAX => todo!() } + | error[E0004]: non-exhaustive patterns: `9223372036854775806_i64..=i64::MAX` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:149:12 @@ -518,7 +746,11 @@ 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, possibly by adding wildcards or more match arms + | +LL ~ match $s { $($t)+ => {} +LL ~ 9223372036854775806_i64..=i64::MAX => todo!() } + | error[E0004]: non-exhaustive patterns: `i64::MIN` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:150:12 @@ -527,7 +759,11 @@ 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, possibly by adding wildcards or more match arms + | +LL ~ match $s { $($t)+ => {} +LL ~ i64::MIN => todo!() } + | error[E0004]: non-exhaustive patterns: `i64::MAX` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:151:12 @@ -536,7 +772,11 @@ 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, possibly by adding wildcards or more match arms + | +LL ~ match $s { $($t)+ => {} +LL ~ i64::MAX => todo!() } + | error[E0004]: non-exhaustive patterns: `43_i64` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:152:12 @@ -545,7 +785,11 @@ 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, possibly by adding wildcards or more match arms + | +LL ~ match $s { $($t)+ => {} +LL ~ 43_i64 => todo!() } + | error[E0004]: non-exhaustive patterns: `43_i64` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:153:12 @@ -554,7 +798,11 @@ 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, possibly by adding wildcards or more match arms + | +LL ~ match $s { $($t)+ => {} +LL ~ 43_i64 => todo!() } + | error[E0004]: non-exhaustive patterns: `i128::MAX` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:161:12 @@ -563,7 +811,11 @@ 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, possibly by adding wildcards or more match arms + | +LL ~ match $s { $($t)+ => {} +LL ~ i128::MAX => todo!() } + | error[E0004]: non-exhaustive patterns: `170141183460469231731687303715884105726_i128..=i128::MAX` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:162:12 @@ -572,7 +824,11 @@ 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, possibly by adding wildcards or more match arms + | +LL ~ match $s { $($t)+ => {} +LL ~ 170141183460469231731687303715884105726_i128..=i128::MAX => todo!() } + | error[E0004]: non-exhaustive patterns: `i128::MIN` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:163:12 @@ -581,7 +837,11 @@ 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, possibly by adding wildcards or more match arms + | +LL ~ match $s { $($t)+ => {} +LL ~ i128::MIN => todo!() } + | error[E0004]: non-exhaustive patterns: `i128::MAX` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:164:12 @@ -590,7 +850,11 @@ 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, possibly by adding wildcards or more match arms + | +LL ~ match $s { $($t)+ => {} +LL ~ i128::MAX => todo!() } + | error[E0004]: non-exhaustive patterns: `43_i128` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:165:12 @@ -599,7 +863,11 @@ 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, possibly by adding wildcards or more match arms + | +LL ~ match $s { $($t)+ => {} +LL ~ 43_i128 => todo!() } + | error[E0004]: non-exhaustive patterns: `43_i128` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:166:12 @@ -608,7 +876,11 @@ 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, possibly by adding wildcards or more match arms + | +LL ~ match $s { $($t)+ => {} +LL ~ 43_i128 => todo!() } + | error: aborting due to 68 previous errors diff --git a/src/test/ui/match/match_non_exhaustive.stderr b/src/test/ui/match/match_non_exhaustive.stderr index 3ae922fb9da..24e37d0851a 100644 --- a/src/test/ui/match/match_non_exhaustive.stderr +++ b/src/test/ui/match/match_non_exhaustive.stderr @@ -11,7 +11,10 @@ LL | match l { L::A => () }; | ^ pattern `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, possibly by adding wildcards or more match arms + | +LL | match l { L::A => (), B => todo!() }; + | ++++++++++++++ error[E0004]: non-exhaustive patterns: type `E1` is non-empty --> $DIR/match_non_exhaustive.rs:28:11 diff --git a/src/test/ui/or-patterns/exhaustiveness-non-exhaustive.stderr b/src/test/ui/or-patterns/exhaustiveness-non-exhaustive.stderr index 3e9180b0e6e..c99a6fd2533 100644 --- a/src/test/ui/or-patterns/exhaustiveness-non-exhaustive.stderr +++ b/src/test/ui/or-patterns/exhaustiveness-non-exhaustive.stderr @@ -5,7 +5,11 @@ LL | match (0u8, 0u8) { | ^^^^^^^^^^ pattern `(2_u8..=u8::MAX, _)` not covered | = note: the matched value is of type `(u8, u8)` - = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms + | +LL ~ (0 | 1, 2 | 3) => {} +LL + (2_u8..=u8::MAX, _) => todo!() + | error[E0004]: non-exhaustive patterns: `((4_u8..=u8::MAX))` not covered --> $DIR/exhaustiveness-non-exhaustive.rs:9:11 @@ -14,7 +18,11 @@ LL | match ((0u8,),) { | ^^^^^^^^^ pattern `((4_u8..=u8::MAX))` not covered | = note: the matched value is of type `((u8,),)` - = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms + | +LL ~ ((0 | 1,) | (2 | 3,),) => {} +LL + ((4_u8..=u8::MAX)) => todo!() + | error[E0004]: non-exhaustive patterns: `(Some(2_u8..=u8::MAX))` not covered --> $DIR/exhaustiveness-non-exhaustive.rs:13:11 @@ -23,7 +31,11 @@ LL | match (Some(0u8),) { | ^^^^^^^^^^^^ pattern `(Some(2_u8..=u8::MAX))` not covered | = note: the matched value is of type `(Option<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, possibly by adding wildcards or more match arms + | +LL ~ (None | Some(0 | 1),) => {} +LL + (Some(2_u8..=u8::MAX)) => todo!() + | error: aborting due to 3 previous errors 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 0d03b0e8277..c38e3088d2e 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,11 @@ LL | match 0 { | ^ patterns `i32::MIN..=-1_i32` and `3_i32..=i32::MAX` not covered | = note: the matched value is of type `i32` - = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms + | +LL ~ 0 | (1 | 2) => {} +LL + i32::MIN..=-1_i32 | 3_i32..=i32::MAX => todo!() + | error: aborting due to 2 previous errors 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 2acaf3401b6..a93d6bd57b6 100644 --- a/src/test/ui/pattern/usefulness/doc-hidden-non-exhaustive.stderr +++ b/src/test/ui/pattern/usefulness/doc-hidden-non-exhaustive.stderr @@ -33,7 +33,11 @@ LL | B, | - 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, possibly by adding wildcards or more match arms + | +LL ~ Foo::A => {} +LL + B | _ => todo!() + | error[E0004]: non-exhaustive patterns: `Some(B)` and `Some(_)` not covered --> $DIR/doc-hidden-non-exhaustive.rs:25:11 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 59e126d8937..7235ef3fd90 100644 --- a/src/test/ui/pattern/usefulness/empty-match.exhaustive_patterns.stderr +++ b/src/test/ui/pattern/usefulness/empty-match.exhaustive_patterns.stderr @@ -155,7 +155,11 @@ 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, possibly by adding wildcards or more match arms + | +LL ~ _ if false => {} +LL + _ => todo!() + | error[E0004]: non-exhaustive patterns: `NonEmptyStruct1` not covered --> $DIR/empty-match.rs:88:24 @@ -167,7 +171,11 @@ LL | match_guarded_arm!(NonEmptyStruct1); | ^^^^^^^^^^^^^^^ pattern `NonEmptyStruct1` not covered | = note: the matched value is of type `NonEmptyStruct1` - = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms + | +LL ~ _ if false => {} +LL + NonEmptyStruct1 => todo!() + | error[E0004]: non-exhaustive patterns: `NonEmptyStruct2(_)` not covered --> $DIR/empty-match.rs:89:24 @@ -179,7 +187,11 @@ LL | match_guarded_arm!(NonEmptyStruct2(true)); | ^^^^^^^^^^^^^^^^^^^^^ pattern `NonEmptyStruct2(_)` not covered | = note: the matched value is of type `NonEmptyStruct2` - = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms + | +LL ~ _ if false => {} +LL + NonEmptyStruct2(_) => todo!() + | error[E0004]: non-exhaustive patterns: `NonEmptyUnion1 { .. }` not covered --> $DIR/empty-match.rs:90:24 @@ -193,7 +205,11 @@ LL | match_guarded_arm!((NonEmptyUnion1 { foo: () })); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ pattern `NonEmptyUnion1 { .. }` not covered | = note: the matched value is of type `NonEmptyUnion1` - = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms + | +LL ~ _ if false => {} +LL + NonEmptyUnion1 { .. } => todo!() + | error[E0004]: non-exhaustive patterns: `NonEmptyUnion2 { .. }` not covered --> $DIR/empty-match.rs:91:24 @@ -208,7 +224,11 @@ LL | match_guarded_arm!((NonEmptyUnion2 { foo: () })); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ pattern `NonEmptyUnion2 { .. }` not covered | = note: the matched value is of type `NonEmptyUnion2` - = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms + | +LL ~ _ if false => {} +LL + NonEmptyUnion2 { .. } => todo!() + | error[E0004]: non-exhaustive patterns: `Foo(_)` not covered --> $DIR/empty-match.rs:92:24 @@ -223,7 +243,11 @@ LL | match_guarded_arm!(NonEmptyEnum1::Foo(true)); | ^^^^^^^^^^^^^^^^^^^^^^^^ pattern `Foo(_)` 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, possibly by adding wildcards or more match arms + | +LL ~ _ if false => {} +LL + Foo(_) => todo!() + | error[E0004]: non-exhaustive patterns: `Foo(_)` and `Bar` not covered --> $DIR/empty-match.rs:93:24 @@ -240,7 +264,11 @@ LL | match_guarded_arm!(NonEmptyEnum2::Foo(true)); | ^^^^^^^^^^^^^^^^^^^^^^^^ patterns `Foo(_)` and `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, possibly by adding wildcards or more match arms + | +LL ~ _ if false => {} +LL + Foo(_) | Bar => todo!() + | error[E0004]: non-exhaustive patterns: `V1`, `V2`, `V3` and 2 more not covered --> $DIR/empty-match.rs:94:24 @@ -254,7 +282,11 @@ LL | match_guarded_arm!(NonEmptyEnum5::V1); | ^^^^^^^^^^^^^^^^^ patterns `V1`, `V2`, `V3` and 2 more not covered | = note: the matched value is of type `NonEmptyEnum5` - = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms + | +LL ~ _ if false => {} +LL + _ => todo!() + | error: aborting due to 22 previous errors diff --git a/src/test/ui/pattern/usefulness/empty-match.normal.stderr b/src/test/ui/pattern/usefulness/empty-match.normal.stderr index 59e126d8937..7235ef3fd90 100644 --- a/src/test/ui/pattern/usefulness/empty-match.normal.stderr +++ b/src/test/ui/pattern/usefulness/empty-match.normal.stderr @@ -155,7 +155,11 @@ 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, possibly by adding wildcards or more match arms + | +LL ~ _ if false => {} +LL + _ => todo!() + | error[E0004]: non-exhaustive patterns: `NonEmptyStruct1` not covered --> $DIR/empty-match.rs:88:24 @@ -167,7 +171,11 @@ LL | match_guarded_arm!(NonEmptyStruct1); | ^^^^^^^^^^^^^^^ pattern `NonEmptyStruct1` not covered | = note: the matched value is of type `NonEmptyStruct1` - = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms + | +LL ~ _ if false => {} +LL + NonEmptyStruct1 => todo!() + | error[E0004]: non-exhaustive patterns: `NonEmptyStruct2(_)` not covered --> $DIR/empty-match.rs:89:24 @@ -179,7 +187,11 @@ LL | match_guarded_arm!(NonEmptyStruct2(true)); | ^^^^^^^^^^^^^^^^^^^^^ pattern `NonEmptyStruct2(_)` not covered | = note: the matched value is of type `NonEmptyStruct2` - = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms + | +LL ~ _ if false => {} +LL + NonEmptyStruct2(_) => todo!() + | error[E0004]: non-exhaustive patterns: `NonEmptyUnion1 { .. }` not covered --> $DIR/empty-match.rs:90:24 @@ -193,7 +205,11 @@ LL | match_guarded_arm!((NonEmptyUnion1 { foo: () })); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ pattern `NonEmptyUnion1 { .. }` not covered | = note: the matched value is of type `NonEmptyUnion1` - = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms + | +LL ~ _ if false => {} +LL + NonEmptyUnion1 { .. } => todo!() + | error[E0004]: non-exhaustive patterns: `NonEmptyUnion2 { .. }` not covered --> $DIR/empty-match.rs:91:24 @@ -208,7 +224,11 @@ LL | match_guarded_arm!((NonEmptyUnion2 { foo: () })); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ pattern `NonEmptyUnion2 { .. }` not covered | = note: the matched value is of type `NonEmptyUnion2` - = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms + | +LL ~ _ if false => {} +LL + NonEmptyUnion2 { .. } => todo!() + | error[E0004]: non-exhaustive patterns: `Foo(_)` not covered --> $DIR/empty-match.rs:92:24 @@ -223,7 +243,11 @@ LL | match_guarded_arm!(NonEmptyEnum1::Foo(true)); | ^^^^^^^^^^^^^^^^^^^^^^^^ pattern `Foo(_)` 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, possibly by adding wildcards or more match arms + | +LL ~ _ if false => {} +LL + Foo(_) => todo!() + | error[E0004]: non-exhaustive patterns: `Foo(_)` and `Bar` not covered --> $DIR/empty-match.rs:93:24 @@ -240,7 +264,11 @@ LL | match_guarded_arm!(NonEmptyEnum2::Foo(true)); | ^^^^^^^^^^^^^^^^^^^^^^^^ patterns `Foo(_)` and `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, possibly by adding wildcards or more match arms + | +LL ~ _ if false => {} +LL + Foo(_) | Bar => todo!() + | error[E0004]: non-exhaustive patterns: `V1`, `V2`, `V3` and 2 more not covered --> $DIR/empty-match.rs:94:24 @@ -254,7 +282,11 @@ LL | match_guarded_arm!(NonEmptyEnum5::V1); | ^^^^^^^^^^^^^^^^^ patterns `V1`, `V2`, `V3` and 2 more not covered | = note: the matched value is of type `NonEmptyEnum5` - = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms + | +LL ~ _ if false => {} +LL + _ => todo!() + | error: aborting due to 22 previous errors diff --git a/src/test/ui/pattern/usefulness/floats.stderr b/src/test/ui/pattern/usefulness/floats.stderr index a2ffdf82205..bbeac5959f0 100644 --- a/src/test/ui/pattern/usefulness/floats.stderr +++ b/src/test/ui/pattern/usefulness/floats.stderr @@ -5,7 +5,11 @@ LL | match 0.0 { | ^^^ pattern `_` not covered | = note: the matched value is of type `f64` - = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms + | +LL ~ 0.0..=1.0 => {} +LL + _ => todo!() + | error: unreachable pattern --> $DIR/floats.rs:16:7 diff --git a/src/test/ui/pattern/usefulness/integer-ranges/exhaustiveness.stderr b/src/test/ui/pattern/usefulness/integer-ranges/exhaustiveness.stderr index e1506c96f3d..8734d0f04ac 100644 --- a/src/test/ui/pattern/usefulness/integer-ranges/exhaustiveness.stderr +++ b/src/test/ui/pattern/usefulness/integer-ranges/exhaustiveness.stderr @@ -5,7 +5,11 @@ 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, possibly by adding wildcards or more match arms + | +LL ~ match $s { $($t)+ => {} +LL ~ u8::MAX => todo!() } + | error[E0004]: non-exhaustive patterns: `u8::MAX` not covered --> $DIR/exhaustiveness.rs:48:8 @@ -14,7 +18,11 @@ 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, possibly by adding wildcards or more match arms + | +LL ~ match $s { $($t)+ => {} +LL ~ u8::MAX => todo!() } + | error[E0004]: non-exhaustive patterns: `0_u8` not covered --> $DIR/exhaustiveness.rs:49:8 @@ -23,7 +31,11 @@ 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, possibly by adding wildcards or more match arms + | +LL ~ match $s { $($t)+ => {} +LL ~ 0_u8 => todo!() } + | error[E0004]: non-exhaustive patterns: `42_u8` not covered --> $DIR/exhaustiveness.rs:50:8 @@ -32,7 +44,11 @@ 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, possibly by adding wildcards or more match arms + | +LL ~ match $s { $($t)+ => {} +LL ~ 42_u8 => todo!() } + | error[E0004]: non-exhaustive patterns: `i8::MAX` not covered --> $DIR/exhaustiveness.rs:51:8 @@ -41,7 +57,11 @@ 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, possibly by adding wildcards or more match arms + | +LL ~ match $s { $($t)+ => {} +LL ~ i8::MAX => todo!() } + | error[E0004]: non-exhaustive patterns: `i8::MAX` not covered --> $DIR/exhaustiveness.rs:52:8 @@ -50,7 +70,11 @@ 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, possibly by adding wildcards or more match arms + | +LL ~ match $s { $($t)+ => {} +LL ~ i8::MAX => todo!() } + | error[E0004]: non-exhaustive patterns: `i8::MIN` not covered --> $DIR/exhaustiveness.rs:53:8 @@ -59,7 +83,11 @@ 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, possibly by adding wildcards or more match arms + | +LL ~ match $s { $($t)+ => {} +LL ~ i8::MIN => todo!() } + | error[E0004]: non-exhaustive patterns: `0_i8` not covered --> $DIR/exhaustiveness.rs:54:11 @@ -77,7 +105,11 @@ 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, possibly by adding wildcards or more match arms + | +LL ~ match $s { $($t)+ => {} +LL ~ u128::MAX => todo!() } + | error[E0004]: non-exhaustive patterns: `5_u128..=u128::MAX` not covered --> $DIR/exhaustiveness.rs:60:8 @@ -86,7 +118,11 @@ 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, possibly by adding wildcards or more match arms + | +LL ~ match $s { $($t)+ => {} +LL ~ 5_u128..=u128::MAX => todo!() } + | error[E0004]: non-exhaustive patterns: `0_u128` not covered --> $DIR/exhaustiveness.rs:61:8 @@ -95,7 +131,11 @@ 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, possibly by adding wildcards or more match arms + | +LL ~ match $s { $($t)+ => {} +LL ~ 0_u128 => todo!() } + | error[E0004]: non-exhaustive patterns: `(126_u8..=127_u8, false)` not covered --> $DIR/exhaustiveness.rs:69:11 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 0eac0d2a1b4..574c9849dbb 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,11 @@ 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, possibly by adding wildcards or more match arms + | +LL ~ 0 ..= usize::MAX => {} +LL + _ => todo!() + | error[E0004]: non-exhaustive patterns: `_` not covered --> $DIR/pointer-sized-int.rs:17:11 @@ -18,7 +22,11 @@ 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, possibly by adding wildcards or more match arms + | +LL ~ isize::MIN ..= isize::MAX => {} +LL + _ => todo!() + | error[E0004]: non-exhaustive patterns: `_` not covered --> $DIR/pointer-sized-int.rs:22:8 @@ -29,7 +37,11 @@ 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, possibly by adding wildcards or more match arms + | +LL ~ match $s { $($t)+ => {} +LL ~ _ => todo!() } + | error[E0004]: non-exhaustive patterns: `_` not covered --> $DIR/pointer-sized-int.rs:24:8 @@ -40,7 +52,11 @@ 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, possibly by adding wildcards or more match arms + | +LL ~ match $s { $($t)+ => {} +LL ~ _ => todo!() } + | error[E0004]: non-exhaustive patterns: `_` not covered --> $DIR/pointer-sized-int.rs:26:8 @@ -51,7 +67,11 @@ 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, possibly by adding wildcards or more match arms + | +LL ~ match $s { $($t)+ => {} +LL ~ _ => todo!() } + | error[E0004]: non-exhaustive patterns: `(_, _)` not covered --> $DIR/pointer-sized-int.rs:28:8 @@ -60,7 +80,11 @@ 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, possibly by adding wildcards or more match arms + | +LL ~ match $s { $($t)+ => {} +LL ~ (_, _) => todo!() } + | error[E0004]: non-exhaustive patterns: `_` not covered --> $DIR/pointer-sized-int.rs:31:8 @@ -71,7 +95,11 @@ 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, possibly by adding wildcards or more match arms + | +LL ~ match $s { $($t)+ => {} +LL ~ _ => todo!() } + | error[E0004]: non-exhaustive patterns: `_` not covered --> $DIR/pointer-sized-int.rs:33:8 @@ -82,7 +110,11 @@ 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, possibly by adding wildcards or more match arms + | +LL ~ match $s { $($t)+ => {} +LL ~ _ => todo!() } + | error[E0004]: non-exhaustive patterns: `_` not covered --> $DIR/pointer-sized-int.rs:35:8 @@ -93,7 +125,11 @@ 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, possibly by adding wildcards or more match arms + | +LL ~ match $s { $($t)+ => {} +LL ~ _ => todo!() } + | error[E0004]: non-exhaustive patterns: `(_, _)` not covered --> $DIR/pointer-sized-int.rs:37:8 @@ -102,7 +138,11 @@ 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, possibly by adding wildcards or more match arms + | +LL ~ match $s { $($t)+ => {} +LL ~ (_, _) => todo!() } + | error[E0004]: non-exhaustive patterns: `_` not covered --> $DIR/pointer-sized-int.rs:41:11 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 21fc7cd29b1..efef39c636f 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,11 @@ 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, possibly by adding wildcards or more match arms + | +LL ~ 0..=usize::MAX => {} +LL + _ => todo!() + | error[E0004]: non-exhaustive patterns: `_` not covered --> $DIR/precise_pointer_matching-message.rs:11:11 @@ -18,7 +22,11 @@ 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, possibly by adding wildcards or more match arms + | +LL ~ isize::MIN..=isize::MAX => {} +LL + _ => todo!() + | error: aborting due to 2 previous errors diff --git a/src/test/ui/pattern/usefulness/issue-30240.stderr b/src/test/ui/pattern/usefulness/issue-30240.stderr index c289b68b4c3..e3c4d3ff785 100644 --- a/src/test/ui/pattern/usefulness/issue-30240.stderr +++ b/src/test/ui/pattern/usefulness/issue-30240.stderr @@ -5,7 +5,11 @@ 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, possibly by adding wildcards or more match arms + | +LL ~ "hello" => {} +LL + &_ => todo!() + | error[E0004]: non-exhaustive patterns: `&_` not covered --> $DIR/issue-30240.rs:6:11 diff --git a/src/test/ui/pattern/usefulness/issue-35609.stderr b/src/test/ui/pattern/usefulness/issue-35609.stderr index bea11157c63..87ae74c2040 100644 --- a/src/test/ui/pattern/usefulness/issue-35609.stderr +++ b/src/test/ui/pattern/usefulness/issue-35609.stderr @@ -5,7 +5,11 @@ 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, possibly by adding wildcards or more match arms + | +LL ~ (A, _) => {} +LL + _ => todo!() + | error[E0004]: non-exhaustive patterns: `(_, B)`, `(_, C)`, `(_, D)` and 2 more not covered --> $DIR/issue-35609.rs:14:11 @@ -14,7 +18,11 @@ 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, possibly by adding wildcards or more match arms + | +LL ~ (_, A) => {} +LL + _ => todo!() + | error[E0004]: non-exhaustive patterns: `((B, _), _)`, `((C, _), _)`, `((D, _), _)` and 2 more not covered --> $DIR/issue-35609.rs:18:11 @@ -23,7 +31,11 @@ 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, possibly by adding wildcards or more match arms + | +LL ~ ((A, ()), _) => {} +LL + _ => todo!() + | error[E0004]: non-exhaustive patterns: `((B, _), _)`, `((C, _), _)`, `((D, _), _)` and 2 more not covered --> $DIR/issue-35609.rs:22:11 @@ -32,7 +44,11 @@ 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, possibly by adding wildcards or more match arms + | +LL ~ ((A, ()), _) => {} +LL + _ => todo!() + | error[E0004]: non-exhaustive patterns: `((B, _), _)`, `((C, _), _)`, `((D, _), _)` and 2 more not covered --> $DIR/issue-35609.rs:26:11 @@ -41,7 +57,11 @@ 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, possibly by adding wildcards or more match arms + | +LL ~ ((A, _), _) => {} +LL + _ => todo!() + | error[E0004]: non-exhaustive patterns: `S(B, _)`, `S(C, _)`, `S(D, _)` and 2 more not covered --> $DIR/issue-35609.rs:31:11 @@ -53,7 +73,11 @@ LL | match S(A, ()) { | ^^^^^^^^ patterns `S(B, _)`, `S(C, _)`, `S(D, _)` and 2 more not covered | = note: the matched value is of type `S` - = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms + | +LL ~ S(A, _) => {} +LL + _ => todo!() + | error[E0004]: non-exhaustive patterns: `Sd { x: B, .. }`, `Sd { x: C, .. }`, `Sd { x: D, .. }` and 2 more not covered --> $DIR/issue-35609.rs:35:11 @@ -65,7 +89,11 @@ LL | match (Sd { x: A, y: () }) { | ^^^^^^^^^^^^^^^^^^^^ patterns `Sd { x: B, .. }`, `Sd { x: C, .. }`, `Sd { x: D, .. }` and 2 more not covered | = note: the matched value is of type `Sd` - = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms + | +LL ~ Sd { x: A, y: _ } => {} +LL + _ => todo!() + | error[E0004]: non-exhaustive patterns: `Some(B)`, `Some(C)`, `Some(D)` and 2 more not covered --> $DIR/issue-35609.rs:39:11 diff --git a/src/test/ui/pattern/usefulness/issue-3601.stderr b/src/test/ui/pattern/usefulness/issue-3601.stderr index 7224270b613..e69f1dcc253 100644 --- a/src/test/ui/pattern/usefulness/issue-3601.stderr +++ b/src/test/ui/pattern/usefulness/issue-3601.stderr @@ -5,7 +5,11 @@ LL | box NodeKind::Element(ed) => match ed.kind { | ^^^^^^^ pattern `box _` not covered | = note: the matched value is of type `Box<ElementKind>` - = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms + | +LL ~ box ElementKind::HTMLImageElement(ref d) if d.image.is_some() => { true } +LL + box _ => todo!() + | error: aborting due to previous error diff --git a/src/test/ui/pattern/usefulness/issue-40221.stderr b/src/test/ui/pattern/usefulness/issue-40221.stderr index 03d507b5af7..6e450a72d75 100644 --- a/src/test/ui/pattern/usefulness/issue-40221.stderr +++ b/src/test/ui/pattern/usefulness/issue-40221.stderr @@ -11,7 +11,11 @@ LL | match proto { | ^^^^^ pattern `C(QA)` 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, possibly by adding wildcards or more match arms + | +LL ~ P::C(PC::Q) => (), +LL ~ C(QA) => todo!(), + | error: aborting due to previous error diff --git a/src/test/ui/pattern/usefulness/issue-50900.stderr b/src/test/ui/pattern/usefulness/issue-50900.stderr index 885e31df1e5..8612607fa8b 100644 --- a/src/test/ui/pattern/usefulness/issue-50900.stderr +++ b/src/test/ui/pattern/usefulness/issue-50900.stderr @@ -8,7 +8,11 @@ LL | match Tag::ExifIFDPointer { | ^^^^^^^^^^^^^^^^^^^ pattern `Tag(Exif, _)` not covered | = note: the matched value is of type `Tag` - = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms + | +LL ~ Tag::ExifIFDPointer => {} +LL + Tag(Exif, _) => todo!() + | error: aborting due to previous error 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 f89b41bb6d8..4913e6e9c9f 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,11 @@ LL | match buf { | ^^^ patterns `&[0_u8..=64_u8, _, _, _]` and `&[66_u8..=u8::MAX, _, _, _]` not covered | = note: the matched value is of type `&[u8; 4]` - = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms + | +LL ~ b"AAAA" => {} +LL + &[0_u8..=64_u8, _, _, _] | &[66_u8..=u8::MAX, _, _, _] => todo!() + | error[E0004]: non-exhaustive patterns: `&[]`, `&[_]`, `&[_, _]` and 2 more not covered --> $DIR/match-byte-array-patterns-2.rs:10:11 @@ -14,7 +18,11 @@ LL | match buf { | ^^^ patterns `&[]`, `&[_]`, `&[_, _]` and 2 more not covered | = note: the matched value is of type `&[u8]` - = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms + | +LL ~ b"AAAA" => {} +LL + _ => todo!() + | error: aborting due to 2 previous errors diff --git a/src/test/ui/pattern/usefulness/match-non-exhaustive.stderr b/src/test/ui/pattern/usefulness/match-non-exhaustive.stderr index 8d693f9cfcc..63fcd2a9638 100644 --- a/src/test/ui/pattern/usefulness/match-non-exhaustive.stderr +++ b/src/test/ui/pattern/usefulness/match-non-exhaustive.stderr @@ -5,7 +5,10 @@ LL | match 0 { 1 => () } | ^ patterns `i32::MIN..=0_i32` and `2_i32..=i32::MAX` not covered | = note: the matched value is of type `i32` - = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms + | +LL | match 0 { 1 => (), i32::MIN..=0_i32 | 2_i32..=i32::MAX => todo!() } + | ++++++++++++++++++++++++++++++++++++++++++++++++ error[E0004]: non-exhaustive patterns: `_` not covered --> $DIR/match-non-exhaustive.rs:3:11 @@ -14,7 +17,10 @@ LL | match 0 { 0 if false => () } | ^ pattern `_` not covered | = note: the matched value is of type `i32` - = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms + | +LL | match 0 { 0 if false => (), _ => todo!() } + | ++++++++++++++ error: aborting due to 2 previous errors 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 8f71184223c..275b0d3ec24 100644 --- a/src/test/ui/pattern/usefulness/non-exhaustive-defined-here.stderr +++ b/src/test/ui/pattern/usefulness/non-exhaustive-defined-here.stderr @@ -20,7 +20,11 @@ LL | match e1 { | ^^ patterns `B` and `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, possibly by adding wildcards or more match arms + | +LL ~ E::A => {} +LL + B | C => todo!() + | error[E0005]: refutable pattern in local binding: `B` and `C` not covered --> $DIR/non-exhaustive-defined-here.rs:36:9 @@ -73,7 +77,11 @@ LL | match e { | ^ patterns `&B` and `&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, possibly by adding wildcards or more match arms + | +LL ~ E::A => {} +LL + &B | &C => todo!() + | error[E0005]: refutable pattern in local binding: `&B` and `&C` not covered --> $DIR/non-exhaustive-defined-here.rs:44:9 @@ -126,7 +134,11 @@ LL | match e { | ^ patterns `&&mut &B` and `&&mut &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, possibly by adding wildcards or more match arms + | +LL ~ E::A => {} +LL + &&mut &B | &&mut &C => todo!() + | error[E0005]: refutable pattern in local binding: `&&mut &B` and `&&mut &C` not covered --> $DIR/non-exhaustive-defined-here.rs:52:9 @@ -174,7 +186,11 @@ LL | match e { | ^ pattern `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, possibly by adding wildcards or more match arms + | +LL ~ Opt::Some(ref _x) => {} +LL + None => todo!() + | error[E0005]: refutable pattern in local binding: `None` not covered --> $DIR/non-exhaustive-defined-here.rs:69:9 diff --git a/src/test/ui/pattern/usefulness/non-exhaustive-match.stderr b/src/test/ui/pattern/usefulness/non-exhaustive-match.stderr index 1728c5f1321..14370915b85 100644 --- a/src/test/ui/pattern/usefulness/non-exhaustive-match.stderr +++ b/src/test/ui/pattern/usefulness/non-exhaustive-match.stderr @@ -11,7 +11,10 @@ LL | match x { T::B => { } } | ^ pattern `A` 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, possibly by adding wildcards or more match arms + | +LL | match x { T::B => { } A => todo!() } + | ++++++++++++ error[E0004]: non-exhaustive patterns: `false` not covered --> $DIR/non-exhaustive-match.rs:8:11 @@ -20,7 +23,11 @@ LL | match true { | ^^^^ pattern `false` not covered | = note: the matched value is of type `bool` - = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms + | +LL ~ true => {} +LL + false => todo!() + | error[E0004]: non-exhaustive patterns: `Some(_)` not covered --> $DIR/non-exhaustive-match.rs:11:11 @@ -34,7 +41,11 @@ LL | Some(#[stable(feature = "rust1", since = "1.0.0")] T), | ---- not covered | = note: the matched value is of type `Option<i32>` - = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms + | +LL ~ None => {} +LL + Some(_) => todo!() + | error[E0004]: non-exhaustive patterns: `(_, _, i32::MIN..=3_i32)` and `(_, _, 5_i32..=i32::MAX)` not covered --> $DIR/non-exhaustive-match.rs:14:11 @@ -43,7 +54,11 @@ LL | match (2, 3, 4) { | ^^^^^^^^^ patterns `(_, _, i32::MIN..=3_i32)` and `(_, _, 5_i32..=i32::MAX)` not covered | = note: the matched value is of type `(i32, i32, i32)` - = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms + | +LL ~ (_, _, 4) => {} +LL + (_, _, i32::MIN..=3_i32) | (_, _, 5_i32..=i32::MAX) => todo!() + | error[E0004]: non-exhaustive patterns: `(A, A)` and `(B, B)` not covered --> $DIR/non-exhaustive-match.rs:18:11 @@ -67,7 +82,11 @@ LL | match T::A { | ^^^^ pattern `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, possibly by adding wildcards or more match arms + | +LL ~ T::A => {} +LL + B => todo!() + | error[E0004]: non-exhaustive patterns: `[]` not covered --> $DIR/non-exhaustive-match.rs:33:11 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 7b4f9336799..2cf0b320e15 100644 --- a/src/test/ui/pattern/usefulness/non-exhaustive-pattern-witness.stderr +++ b/src/test/ui/pattern/usefulness/non-exhaustive-pattern-witness.stderr @@ -46,7 +46,11 @@ LL | match Direction::North { | ^^^^^^^^^^^^^^^^ patterns `East`, `South` and `West` 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, possibly by adding wildcards or more match arms + | +LL ~ Direction::North => (), +LL + East | South | West => todo!() + | error[E0004]: non-exhaustive patterns: `Second`, `Third`, `Fourth` and 8 more not covered --> $DIR/non-exhaustive-pattern-witness.rs:46:11 @@ -60,7 +64,11 @@ LL | match ExcessiveEnum::First { | ^^^^^^^^^^^^^^^^^^^^ patterns `Second`, `Third`, `Fourth` and 8 more not covered | = note: the matched value is of type `ExcessiveEnum` - = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms + | +LL ~ ExcessiveEnum::First => (), +LL + _ => todo!() + | error[E0004]: non-exhaustive patterns: `CustomRGBA { a: true, .. }` not covered --> $DIR/non-exhaustive-pattern-witness.rs:54:11 @@ -95,7 +103,11 @@ LL | match ((), false) { | ^^^^^^^^^^^ pattern `((), false)` not covered | = note: the matched value is of type `((), bool)` - = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms + | +LL ~ ((), true) => (), +LL + ((), false) => todo!() + | error: aborting due to 7 previous errors diff --git a/src/test/ui/pattern/usefulness/slice-patterns-exhaustiveness.stderr b/src/test/ui/pattern/usefulness/slice-patterns-exhaustiveness.stderr index 601e0712ed3..1f6d305b344 100644 --- a/src/test/ui/pattern/usefulness/slice-patterns-exhaustiveness.stderr +++ b/src/test/ui/pattern/usefulness/slice-patterns-exhaustiveness.stderr @@ -5,7 +5,11 @@ LL | match s2 { | ^^ pattern `&[false, _]` not covered | = note: the matched value is of type `&[bool; 2]` - = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms + | +LL ~ [true, .., true] => {} +LL + &[false, _] => todo!() + | error[E0004]: non-exhaustive patterns: `&[false, ..]` not covered --> $DIR/slice-patterns-exhaustiveness.rs:12:11 @@ -14,7 +18,11 @@ LL | match s3 { | ^^ pattern `&[false, ..]` not covered | = note: the matched value is of type `&[bool; 3]` - = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms + | +LL ~ [true, .., true] => {} +LL + &[false, ..] => todo!() + | error[E0004]: non-exhaustive patterns: `&[false, ..]` not covered --> $DIR/slice-patterns-exhaustiveness.rs:16:11 @@ -23,7 +31,11 @@ LL | match s10 { | ^^^ pattern `&[false, ..]` not covered | = note: the matched value is of type `&[bool; 10]` - = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms + | +LL ~ [true, .., true] => {} +LL + &[false, ..] => todo!() + | error[E0004]: non-exhaustive patterns: `&[false, true]` not covered --> $DIR/slice-patterns-exhaustiveness.rs:25:11 @@ -59,7 +71,11 @@ 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, possibly by adding wildcards or more match arms + | +LL ~ [] => {} +LL + &[_, ..] => todo!() + | error[E0004]: non-exhaustive patterns: `&[_, _, ..]` not covered --> $DIR/slice-patterns-exhaustiveness.rs:46:11 @@ -122,7 +138,11 @@ LL | match s { | ^ patterns `&[]` and `&[_, _, ..]` not covered | = note: the matched value is of type `&[bool]` - = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms + | +LL ~ &[true] => {} +LL + &[] | &[_, _, ..] => todo!() + | error[E0004]: non-exhaustive patterns: `&[]` and `&[_, _, ..]` not covered --> $DIR/slice-patterns-exhaustiveness.rs:89:11 @@ -131,7 +151,11 @@ LL | match s { | ^ patterns `&[]` and `&[_, _, ..]` not covered | = note: the matched value is of type `&[bool]` - = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms + | +LL ~ CONST => {} +LL + &[] | &[_, _, ..] => todo!() + | error[E0004]: non-exhaustive patterns: `&[]` and `&[_, _, ..]` not covered --> $DIR/slice-patterns-exhaustiveness.rs:93:11 @@ -176,7 +200,11 @@ LL | match s1 { | ^^ pattern `&[false]` not covered | = note: the matched value is of type `&[bool; 1]` - = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms + | +LL ~ CONST1 => {} +LL + &[false] => todo!() + | error: aborting due to 20 previous errors diff --git a/src/test/ui/pattern/usefulness/stable-gated-patterns.stderr b/src/test/ui/pattern/usefulness/stable-gated-patterns.stderr index 994fa6d206e..5897bb4177a 100644 --- a/src/test/ui/pattern/usefulness/stable-gated-patterns.stderr +++ b/src/test/ui/pattern/usefulness/stable-gated-patterns.stderr @@ -10,7 +10,11 @@ LL | Stable2, | ------- 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, possibly by adding wildcards or more match arms + | +LL ~ Foo::Stable => {} +LL + Stable2 | _ => todo!() + | error[E0004]: non-exhaustive patterns: `_` not covered --> $DIR/stable-gated-patterns.rs:13:11 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 5b9dc8e7ffc..b83865d90c7 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,11 @@ 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, possibly by adding wildcards or more match arms + | +LL ~ b"" => 1, +LL ~ &[_, ..] => todo!(), + | error[E0004]: non-exhaustive patterns: `&[]`, `&[_]`, `&[_, _]` and 1 more not covered --> $DIR/type_polymorphic_byte_str_literals.rs:23:11 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 5e3dfafee19..df5b2000728 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,11 @@ 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, possibly by adding wildcards or more match arms + | +LL ~ [first, remainder @ ..] => {} +LL ~ &[] => todo!(), + | error: aborting due to previous error diff --git a/src/test/ui/uninhabited/uninhabited-matches-feature-gated.stderr b/src/test/ui/uninhabited/uninhabited-matches-feature-gated.stderr index 6cdc6999a09..0811753cb0d 100644 --- a/src/test/ui/uninhabited/uninhabited-matches-feature-gated.stderr +++ b/src/test/ui/uninhabited/uninhabited-matches-feature-gated.stderr @@ -10,7 +10,11 @@ LL | Err(#[stable(feature = "rust1", since = "1.0.0")] E), | --- not covered | = note: the matched value is of type `Result<u32, &Void>` - = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms + | +LL ~ Ok(n) => n, +LL ~ Err(_) => todo!(), + | error[E0004]: non-exhaustive patterns: type `&Void` is non-empty --> $DIR/uninhabited-matches-feature-gated.rs:15:19 @@ -65,7 +69,11 @@ 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, possibly by adding wildcards or more match arms + | +LL ~ &[] => (), +LL ~ &[_, ..] => todo!(), + | error[E0004]: non-exhaustive patterns: `Err(_)` not covered --> $DIR/uninhabited-matches-feature-gated.rs:32:19 @@ -79,7 +87,11 @@ LL | Err(#[stable(feature = "rust1", since = "1.0.0")] E), | --- not covered | = note: the matched value is of type `Result<u32, Void>` - = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms +help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms + | +LL ~ Ok(x) => x, +LL ~ Err(_) => todo!(), + | error[E0005]: refutable pattern in local binding: `Err(_)` not covered --> $DIR/uninhabited-matches-feature-gated.rs:37:9 |
