fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #103046 - JanBeh:PR_clarify_cmp_terminology, r=workingjubilee3bcad65fbf6

master
4.7 KiB113 linesraw
1error[E0005]: refutable pattern in local binding
2  --> $DIR/bad-pattern.rs:13:13
3   |
4LL |         let 0 = v1;
5   |             ^ pattern `1_u32..=u32::MAX` not covered
6   |
7   = note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant
8   = note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html
9   = note: the matched value is of type `u32`
10help: you might want to use `if let` to ignore the variant that isn't matched
11   |
12LL |         if let 0 = v1 { todo!() };
13   |         ++            +++++++++++
14help: alternatively, you could prepend the pattern with an underscore to define a new named variable; identifiers cannot begin with digits
15   |
16LL |         let _0 = v1;
17   |             +
18
19error[E0005]: refutable pattern in local binding
20  --> $DIR/bad-pattern.rs:14:14
21   |
22LL |         let (0 | 1) = v1;
23   |              ^^^^^ pattern `2_u32..=u32::MAX` not covered
24   |
25   = note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant
26   = note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html
27   = note: the matched value is of type `u32`
28help: you might want to use `if let` to ignore the variant that isn't matched
29   |
30LL |         if let (0 | 1) = v1 { todo!() };
31   |         ++                  +++++++++++
32
33error[E0005]: refutable pattern in local binding
34  --> $DIR/bad-pattern.rs:15:13
35   |
36LL |         let 1.. = v1;
37   |             ^^^ pattern `0_u32` not covered
38   |
39   = note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant
40   = note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html
41   = note: the matched value is of type `u32`
42help: you might want to use `if let` to ignore the variant that isn't matched
43   |
44LL |         if let 1.. = v1 { todo!() };
45   |         ++              +++++++++++
46
47error[E0005]: refutable pattern in local binding
48  --> $DIR/bad-pattern.rs:16:13
49   |
50LL |         let [0, 0, 0, 0] = v2;
51   |             ^^^^^^^^^^^^ pattern `[1_u32..=u32::MAX, _, _, _]` not covered
52   |
53   = note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant
54   = note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html
55   = note: the matched value is of type `[u32; 4]`
56help: you might want to use `if let` to ignore the variant that isn't matched
57   |
58LL |         if let [0, 0, 0, 0] = v2 { todo!() };
59   |         ++                       +++++++++++
60
61error[E0005]: refutable pattern in local binding
62  --> $DIR/bad-pattern.rs:17:13
63   |
64LL |         let [0] = v4;
65   |             ^^^ patterns `&[]` and `&[_, _, ..]` not covered
66   |
67   = note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant
68   = note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html
69   = note: the matched value is of type `&[u32]`
70help: you might want to use `if let` to ignore the variants that aren't matched
71   |
72LL |         if let [0] = v4 { todo!() };
73   |         ++              +++++++++++
74
75error[E0005]: refutable pattern in local binding
76  --> $DIR/bad-pattern.rs:18:13
77   |
78LL |         let Refutable::A = v3;
79   |             ^^^^^^^^^^^^ pattern `Refutable::B` not covered
80   |
81   = note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant
82   = note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html
83note: `Refutable` defined here
84  --> $DIR/bad-pattern.rs:4:6
85   |
86LL | enum Refutable {
87   |      ^^^^^^^^^
88LL |     A,
89LL |     B,
90   |     - not covered
91   = note: the matched value is of type `Refutable`
92help: you might want to use `if let` to ignore the variant that isn't matched
93   |
94LL |         if let Refutable::A = v3 { todo!() };
95   |         ++                       +++++++++++
96
97error[E0005]: refutable pattern in local binding
98  --> $DIR/bad-pattern.rs:19:13
99   |
100LL |         let PAT = v1;
101   |             ^^^
102   |             |
103   |             pattern `1_u32..=u32::MAX` not covered
104   |             missing patterns are not covered because `PAT` is interpreted as a constant pattern, not a new variable
105   |             help: introduce a variable instead: `PAT_var`
106   |
107   = note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant
108   = note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html
109   = note: the matched value is of type `u32`
110
111error: aborting due to 7 previous errors
112
113For more information about this error, try `rustc --explain E0005`.