@@ -5,14 +5,15 @@ LL | const a: u8 = 2;
55 | ----------- missing patterns are not covered because `a` is interpreted as a constant pattern, not a new variable
66...
77LL | 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
129 |
1310 = note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant
1411 = note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html
1512 = note: the matched value is of type `u8`
13+ help: introduce a variable instead
14+ |
15+ LL | let a_var = 4;
16+ | ~~~~~
1617
1718error[E0005]: refutable pattern in local binding
1819 --> $DIR/const-pattern-irrefutable.rs:28:9
@@ -21,14 +22,15 @@ LL | pub const b: u8 = 2;
2122 | --------------- missing patterns are not covered because `b` is interpreted as a constant pattern, not a new variable
2223...
2324LL | 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
2826 |
2927 = note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant
3028 = note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html
3129 = note: the matched value is of type `u8`
30+ help: introduce a variable instead
31+ |
32+ LL | let b_var = 4;
33+ | ~~~~~
3234
3335error[E0005]: refutable pattern in local binding
3436 --> $DIR/const-pattern-irrefutable.rs:32:9
@@ -37,14 +39,15 @@ LL | pub const d: (u8, u8) = (2, 1);
3739 | --------------------- missing patterns are not covered because `d` is interpreted as a constant pattern, not a new variable
3840...
3941LL | 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
4443 |
4544 = note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant
4645 = note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html
4746 = note: the matched value is of type `(u8, u8)`
47+ help: introduce a variable instead
48+ |
49+ LL | let d_var = (4, 4);
50+ | ~~~~~
4851
4952error[E0005]: refutable pattern in local binding
5053 --> $DIR/const-pattern-irrefutable.rs:36:9
@@ -53,10 +56,7 @@ LL | const e: S = S {
5356 | ---------- missing patterns are not covered because `e` is interpreted as a constant pattern, not a new variable
5457...
5558LL | 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
6060 |
6161 = note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant
6262 = note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html
@@ -66,6 +66,10 @@ note: `S` defined here
6666LL | struct S {
6767 | ^
6868 = note: the matched value is of type `S`
69+ help: introduce a variable instead
70+ |
71+ LL | let e_var = S {
72+ | ~~~~~
6973
7074error: aborting due to 4 previous errors
7175
0 commit comments