File: const-pattern-irrefutable.stderr

package info (click to toggle)
rustc 1.85.0%2Bdfsg3-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental, sid, trixie
  • size: 893,396 kB
  • sloc: xml: 158,127; python: 35,830; javascript: 19,497; cpp: 19,002; sh: 17,245; ansic: 13,127; asm: 4,376; makefile: 1,051; perl: 29; lisp: 29; ruby: 19; sql: 11
file content (76 lines) | stat: -rw-r--r-- 2,984 bytes parent folder | download | duplicates (2)
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
error[E0005]: refutable pattern in local binding
  --> $DIR/const-pattern-irrefutable.rs:24: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:28: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 b_var = 4;
   |         ~~~~~

error[E0005]: refutable pattern in local binding
  --> $DIR/const-pattern-irrefutable.rs:32: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:36: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:15: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`.