You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix incorrect suggestion for never patterns with bodies or guard
When encountering an unreachable match arm, (correctly) suggest removing the entire arm:
```
error: a never pattern is always unreachable
--> $DIR/ICE-130779-never-arm-no-oatherwise-block.rs:10:20
|
LL | ! if true => {}
| ^^ this will never be executed
|
help: remove the unreachable match arm
|
LL - ! if true => {}
|
```
Noticed in #137343 (comment).
Copy file name to clipboardExpand all lines: tests/ui/closures/2229_closure_analysis/match/issue-88331.stderr
+2-2
Original file line number
Diff line number
Diff line change
@@ -13,7 +13,7 @@ LL | pub struct Opcode(pub u8);
13
13
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms
Copy file name to clipboardExpand all lines: tests/ui/pattern/usefulness/issue-15129.stderr
+1-1
Original file line number
Diff line number
Diff line change
@@ -8,7 +8,7 @@ LL | match (T::T1(()), V::V2(true)) {
8
8
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms
Copy file name to clipboardExpand all lines: tests/ui/pattern/usefulness/issue-85222-types-containing-non-exhaustive-types.stderr
+8-8
Original file line number
Diff line number
Diff line change
@@ -9,7 +9,7 @@ LL | match 0 {
9
9
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
10
10
|
11
11
LL ~ 1..=usize::MAX => (),
12
-
LL ~ usize::MAX.. => todo!(),
12
+
LL + usize::MAX.. => todo!()
13
13
|
14
14
15
15
error[E0004]: non-exhaustive patterns: `(usize::MAX.., _)` not covered
@@ -23,7 +23,7 @@ LL | match (0usize, 0usize) {
23
23
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
24
24
|
25
25
LL ~ (1..=usize::MAX, 1..=usize::MAX) => (),
26
-
LL ~ (usize::MAX.., _) => todo!(),
26
+
LL + (usize::MAX.., _) => todo!()
27
27
|
28
28
29
29
error[E0004]: non-exhaustive patterns: `(..isize::MIN, _)` and `(isize::MAX.., _)` not covered
@@ -37,7 +37,7 @@ LL | match (0isize, 0usize) {
37
37
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms
error[E0004]: non-exhaustive patterns: `Some(_)` not covered
@@ -74,7 +74,7 @@ note: `Option<usize>` defined here
74
74
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
75
75
|
76
76
LL ~ None => (),
77
-
LL ~ Some(usize::MAX..) => todo!(),
77
+
LL + Some(usize::MAX..) => todo!()
78
78
|
79
79
80
80
error[E0004]: non-exhaustive patterns: `Some(Some(Some(usize::MAX..)))` not covered
@@ -97,7 +97,7 @@ note: `Option<Option<Option<usize>>>` defined here
97
97
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
98
98
|
99
99
LL ~ None => (),
100
-
LL ~ Some(Some(Some(usize::MAX..))) => todo!(),
100
+
LL + Some(Some(Some(usize::MAX..))) => todo!()
101
101
|
102
102
103
103
error[E0004]: non-exhaustive patterns: `A { a: usize::MAX.. }` not covered
@@ -116,7 +116,7 @@ LL | struct A<T> {
116
116
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
117
117
|
118
118
LL ~ A { a: 1..=usize::MAX } => (),
119
-
LL ~ A { a: usize::MAX.. } => todo!(),
119
+
LL + A { a: usize::MAX.. } => todo!()
120
120
|
121
121
122
122
error[E0004]: non-exhaustive patterns: `B(..isize::MIN, _)` and `B(isize::MAX.., _)` not covered
@@ -135,7 +135,7 @@ LL | struct B<T, U>(T, U);
135
135
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms
Copy file name to clipboardExpand all lines: tests/ui/pattern/usefulness/non-exhaustive-pattern-witness.stderr
+7-7
Original file line number
Diff line number
Diff line change
@@ -13,7 +13,7 @@ LL | struct Foo {
13
13
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms
error[E0004]: non-exhaustive patterns: `Color::Red` not covered
@@ -33,7 +33,7 @@ LL | Red,
33
33
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
34
34
|
35
35
LL ~ Color::Green => (),
36
-
LL ~ Color::Red => todo!(),
36
+
LL + Color::Red => todo!()
37
37
|
38
38
39
39
error[E0004]: non-exhaustive patterns: `Direction::East`, `Direction::South` and `Direction::West` not covered
@@ -58,7 +58,7 @@ LL | West,
58
58
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms
Copy file name to clipboardExpand all lines: tests/ui/pattern/usefulness/slice_of_empty.normal.stderr
+2-2
Original file line number
Diff line number
Diff line change
@@ -9,7 +9,7 @@ LL | match nevers {
9
9
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
10
10
|
11
11
LL ~ &[] => (),
12
-
LL ~ &[_, ..] => todo!(),
12
+
LL + &[_, ..] => todo!()
13
13
|
14
14
15
15
error[E0004]: non-exhaustive patterns: `&[]` and `&[_, _, ..]` not covered
@@ -22,7 +22,7 @@ LL | match nevers {
22
22
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms
0 commit comments