@@ -5,14 +5,15 @@ LL | const a: u8 = 2;
5
5
| ----------- missing patterns are not covered because `a` is interpreted as a constant pattern, not a new variable
6
6
...
7
7
LL | let a = 4;
8
- | ^
9
- | |
10
- | patterns `0_u8..=1_u8` and `3_u8..=u8::MAX` not covered
11
- | help: introduce a variable instead: `a_var`
8
+ | ^ patterns `0_u8..=1_u8` and `3_u8..=u8::MAX` not covered
12
9
|
13
10
= note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant
14
11
= note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html
15
12
= note: the matched value is of type `u8`
13
+ help: introduce a variable instead
14
+ |
15
+ LL | let a_var = 4;
16
+ | ~~~~~
16
17
17
18
error[E0005]: refutable pattern in local binding
18
19
--> $DIR/const-pattern-irrefutable.rs:28:9
@@ -21,14 +22,15 @@ LL | pub const b: u8 = 2;
21
22
| --------------- missing patterns are not covered because `b` is interpreted as a constant pattern, not a new variable
22
23
...
23
24
LL | let c = 4;
24
- | ^
25
- | |
26
- | patterns `0_u8..=1_u8` and `3_u8..=u8::MAX` not covered
27
- | help: introduce a variable instead: `b_var`
25
+ | ^ patterns `0_u8..=1_u8` and `3_u8..=u8::MAX` not covered
28
26
|
29
27
= note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant
30
28
= note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html
31
29
= note: the matched value is of type `u8`
30
+ help: introduce a variable instead
31
+ |
32
+ LL | let b_var = 4;
33
+ | ~~~~~
32
34
33
35
error[E0005]: refutable pattern in local binding
34
36
--> $DIR/const-pattern-irrefutable.rs:32:9
@@ -37,14 +39,15 @@ LL | pub const d: (u8, u8) = (2, 1);
37
39
| --------------------- missing patterns are not covered because `d` is interpreted as a constant pattern, not a new variable
38
40
...
39
41
LL | let d = (4, 4);
40
- | ^
41
- | |
42
- | patterns `(0_u8..=1_u8, _)` and `(3_u8..=u8::MAX, _)` not covered
43
- | help: introduce a variable instead: `d_var`
42
+ | ^ patterns `(0_u8..=1_u8, _)` and `(3_u8..=u8::MAX, _)` not covered
44
43
|
45
44
= note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant
46
45
= note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html
47
46
= note: the matched value is of type `(u8, u8)`
47
+ help: introduce a variable instead
48
+ |
49
+ LL | let d_var = (4, 4);
50
+ | ~~~~~
48
51
49
52
error[E0005]: refutable pattern in local binding
50
53
--> $DIR/const-pattern-irrefutable.rs:36:9
@@ -53,10 +56,7 @@ LL | const e: S = S {
53
56
| ---------- missing patterns are not covered because `e` is interpreted as a constant pattern, not a new variable
54
57
...
55
58
LL | let e = S {
56
- | ^
57
- | |
58
- | pattern `S { foo: 1_u8..=u8::MAX }` not covered
59
- | help: introduce a variable instead: `e_var`
59
+ | ^ pattern `S { foo: 1_u8..=u8::MAX }` not covered
60
60
|
61
61
= note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant
62
62
= note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html
@@ -66,6 +66,10 @@ note: `S` defined here
66
66
LL | struct S {
67
67
| ^
68
68
= note: the matched value is of type `S`
69
+ help: introduce a variable instead
70
+ |
71
+ LL | let e_var = S {
72
+ | ~~~~~
69
73
70
74
error: aborting due to 4 previous errors
71
75
0 commit comments