about summary refs log tree commit diff
path: root/tests/ui/consts/const-pattern-irrefutable.stderr
blob: f52ebc313339c268cf63d02b846f9ec549e683c3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
error[E0005]: refutable pattern in local binding
  --> $DIR/const-pattern-irrefutable.rs:26:9
   |
LL | const a: u8 = 2;
   | ----------- missing patterns are not covered because `a` is interpreted as a constant pattern, not a new variable
...
LL |     let a = 4;
   |         ^ patterns `0_u8..=1_u8` and `3_u8..=u8::MAX` not covered
   |
   = note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant
   = note: for more information, visit https://doc.rust-lang.org/book/ch19-02-refutability.html
   = note: the matched value is of type `u8`
help: introduce a variable instead
   |
LL |     let a_var = 4;
   |          ++++

error[E0005]: refutable pattern in local binding
  --> $DIR/const-pattern-irrefutable.rs:30:9
   |
LL |     pub const b: u8 = 2;
   |     --------------- missing patterns are not covered because `b` is interpreted as a constant pattern, not a new variable
...
LL |     let c = 4;
   |         ^ patterns `0_u8..=1_u8` and `3_u8..=u8::MAX` not covered
   |
   = note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant
   = note: for more information, visit https://doc.rust-lang.org/book/ch19-02-refutability.html
   = note: the matched value is of type `u8`
help: introduce a variable instead
   |
LL -     let c = 4;
LL +     let b_var = 4;
   |

error[E0005]: refutable pattern in local binding
  --> $DIR/const-pattern-irrefutable.rs:34:9
   |
LL |     pub const d: (u8, u8) = (2, 1);
   |     --------------------- missing patterns are not covered because `d` is interpreted as a constant pattern, not a new variable
...
LL |     let d = (4, 4);
   |         ^ patterns `(0_u8..=1_u8, _)` and `(3_u8..=u8::MAX, _)` not covered
   |
   = note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant
   = note: for more information, visit https://doc.rust-lang.org/book/ch19-02-refutability.html
   = note: the matched value is of type `(u8, u8)`
help: introduce a variable instead
   |
LL |     let d_var = (4, 4);
   |          ++++

error[E0005]: refutable pattern in local binding
  --> $DIR/const-pattern-irrefutable.rs:38:9
   |
LL | const e: S = S {
   | ---------- missing patterns are not covered because `e` is interpreted as a constant pattern, not a new variable
...
LL |     let e = S {
   |         ^ pattern `S { foo: 1_u8..=u8::MAX }` not covered
   |
   = note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant
   = note: for more information, visit https://doc.rust-lang.org/book/ch19-02-refutability.html
note: `S` defined here
  --> $DIR/const-pattern-irrefutable.rs:17:8
   |
LL | struct S {
   |        ^
   = note: the matched value is of type `S`
help: introduce a variable instead
   |
LL |     let e_var = S {
   |          ++++

error: aborting due to 4 previous errors

For more information about this error, try `rustc --explain E0005`.