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
Point at const when intended binding fall-through pattern is a const
```
error[E0004]: non-exhaustive patterns: `i32::MIN..=3_i32` and `5_i32..=i32::MAX` not covered
--> $DIR/intended-binding-pattern-is-const.rs:2:11
|
LL | match 1 {
| ^ patterns `i32::MIN..=3_i32` and `5_i32..=i32::MAX` not covered
LL | x => {}
| - this pattern doesn't introduce a new catch-all binding, but rather pattern matches against the value of constant `x`
|
= note: the matched value is of type `i32`
note: constant `x` defined here
--> $DIR/intended-binding-pattern-is-const.rs:7:5
|
LL | const x: i32 = 4;
| ^^^^^^^^^^^^
help: if you meant to introduce a binding, use a different name
|
LL | x_var => {}
| ++++
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms
|
LL | x => {}, i32::MIN..=3_i32 | 5_i32..=i32::MAX => todo!()
| ++++++++++++++++++++++++++++++++++++++++++++++++
```
| ^ patterns `i32::MIN..=3_i32` and `5_i32..=i32::MAX` not covered
6
+
...
7
+
LL | x => {}
8
+
| - this pattern doesn't introduce a new catch-all binding, but rather pattern matches against the value of constant `x`
9
+
|
10
+
= note: the matched value is of type `i32`
11
+
note: constant `x` defined here
12
+
--> $DIR/intended-binding-pattern-is-const.rs:9:5
13
+
|
14
+
LL | const x: i32 = 4;
15
+
| ^^^^^^^^^^^^
16
+
help: if you meant to introduce a binding, use a different name
17
+
|
18
+
LL | x_var => {}
19
+
| ++++
20
+
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
21
+
|
22
+
LL | x => {}, i32::MIN..=3_i32 | 5_i32..=i32::MAX => todo!()
0 commit comments