]> git.proxmox.com Git - rustc.git/blob - src/test/ui/pattern/usefulness/non-exhaustive-defined-here.stderr
New upstream version 1.61.0+dfsg1
[rustc.git] / src / test / ui / pattern / usefulness / non-exhaustive-defined-here.stderr
1 error[E0004]: non-exhaustive patterns: `B` and `C` not covered
2 --> $DIR/non-exhaustive-defined-here.rs:38:11
3 |
4 LL | match e1 {
5 | ^^ patterns `B` and `C` not covered
6 |
7 note: `E` defined here
8 --> $DIR/non-exhaustive-defined-here.rs:14:5
9 |
10 LL | enum E {
11 | -
12 ...
13 LL | B,
14 | ^ not covered
15 ...
16 LL | C
17 | ^ not covered
18 = note: the matched value is of type `E`
19 help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms
20 |
21 LL ~ E::A => {}
22 LL + B | C => todo!()
23 |
24
25 error[E0005]: refutable pattern in local binding: `B` and `C` not covered
26 --> $DIR/non-exhaustive-defined-here.rs:44:9
27 |
28 LL | let E::A = e;
29 | ^^^^ patterns `B` and `C` not covered
30 |
31 = note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant
32 = note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html
33 note: `E` defined here
34 --> $DIR/non-exhaustive-defined-here.rs:14:5
35 |
36 LL | enum E {
37 | -
38 ...
39 LL | B,
40 | ^ not covered
41 ...
42 LL | C
43 | ^ not covered
44 = note: the matched value is of type `E`
45 help: you might want to use `if let` to ignore the variants that aren't matched
46 |
47 LL | if let E::A = e { todo!() }
48 | ++ ~~~~~~~~~~~
49
50 error[E0004]: non-exhaustive patterns: `&B` and `&C` not covered
51 --> $DIR/non-exhaustive-defined-here.rs:52:11
52 |
53 LL | match e {
54 | ^ patterns `&B` and `&C` not covered
55 |
56 note: `E` defined here
57 --> $DIR/non-exhaustive-defined-here.rs:14:5
58 |
59 LL | enum E {
60 | -
61 ...
62 LL | B,
63 | ^ not covered
64 ...
65 LL | C
66 | ^ not covered
67 = note: the matched value is of type `&E`
68 help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms
69 |
70 LL ~ E::A => {}
71 LL + &B | &C => todo!()
72 |
73
74 error[E0005]: refutable pattern in local binding: `&B` and `&C` not covered
75 --> $DIR/non-exhaustive-defined-here.rs:58:9
76 |
77 LL | let E::A = e;
78 | ^^^^ patterns `&B` and `&C` not covered
79 |
80 = note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant
81 = note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html
82 note: `E` defined here
83 --> $DIR/non-exhaustive-defined-here.rs:14:5
84 |
85 LL | enum E {
86 | -
87 ...
88 LL | B,
89 | ^ not covered
90 ...
91 LL | C
92 | ^ not covered
93 = note: the matched value is of type `&E`
94 help: you might want to use `if let` to ignore the variants that aren't matched
95 |
96 LL | if let E::A = e { todo!() }
97 | ++ ~~~~~~~~~~~
98
99 error[E0004]: non-exhaustive patterns: `&&mut &B` and `&&mut &C` not covered
100 --> $DIR/non-exhaustive-defined-here.rs:66:11
101 |
102 LL | match e {
103 | ^ patterns `&&mut &B` and `&&mut &C` not covered
104 |
105 note: `E` defined here
106 --> $DIR/non-exhaustive-defined-here.rs:14:5
107 |
108 LL | enum E {
109 | -
110 ...
111 LL | B,
112 | ^ not covered
113 ...
114 LL | C
115 | ^ not covered
116 = note: the matched value is of type `&&mut &E`
117 help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms
118 |
119 LL ~ E::A => {}
120 LL + &&mut &B | &&mut &C => todo!()
121 |
122
123 error[E0005]: refutable pattern in local binding: `&&mut &B` and `&&mut &C` not covered
124 --> $DIR/non-exhaustive-defined-here.rs:72:9
125 |
126 LL | let E::A = e;
127 | ^^^^ patterns `&&mut &B` and `&&mut &C` not covered
128 |
129 = note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant
130 = note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html
131 note: `E` defined here
132 --> $DIR/non-exhaustive-defined-here.rs:14:5
133 |
134 LL | enum E {
135 | -
136 ...
137 LL | B,
138 | ^ not covered
139 ...
140 LL | C
141 | ^ not covered
142 = note: the matched value is of type `&&mut &E`
143 help: you might want to use `if let` to ignore the variants that aren't matched
144 |
145 LL | if let E::A = e { todo!() }
146 | ++ ~~~~~~~~~~~
147
148 error[E0004]: non-exhaustive patterns: `None` not covered
149 --> $DIR/non-exhaustive-defined-here.rs:92:11
150 |
151 LL | match e {
152 | ^ pattern `None` not covered
153 |
154 note: `Opt` defined here
155 --> $DIR/non-exhaustive-defined-here.rs:84:5
156 |
157 LL | enum Opt {
158 | ---
159 ...
160 LL | None,
161 | ^^^^ not covered
162 = note: the matched value is of type `Opt`
163 help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
164 |
165 LL ~ Opt::Some(ref _x) => {}
166 LL + None => todo!()
167 |
168
169 error[E0005]: refutable pattern in local binding: `None` not covered
170 --> $DIR/non-exhaustive-defined-here.rs:98:9
171 |
172 LL | let Opt::Some(ref _x) = e;
173 | ^^^^^^^^^^^^^^^^^ pattern `None` not covered
174 |
175 = note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant
176 = note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html
177 note: `Opt` defined here
178 --> $DIR/non-exhaustive-defined-here.rs:84:5
179 |
180 LL | enum Opt {
181 | ---
182 ...
183 LL | None,
184 | ^^^^ not covered
185 = note: the matched value is of type `Opt`
186 help: you might want to use `if let` to ignore the variant that isn't matched
187 |
188 LL | let _x = if let Opt::Some(ref _x) = e { _x } else { todo!() };
189 | +++++++++++ +++++++++++++++++++++++
190 help: alternatively, on nightly, you might want to use `#![feature(let_else)]` to handle the variant that isn't matched
191 |
192 LL | let Opt::Some(ref _x) = e else { todo!() };
193 | ++++++++++++++++
194
195 error: aborting due to 8 previous errors
196
197 Some errors have detailed explanations: E0004, E0005.
198 For more information about an error, try `rustc --explain E0004`.