File tree 1 file changed +26
-1
lines changed
1 file changed +26
-1
lines changed Original file line number Diff line number Diff line change @@ -191,6 +191,32 @@ loop {
191
191
}
192
192
"## ,
193
193
194
+ E0170 : r##"
195
+ Enum variants are qualified by default. For example, given this type:
196
+
197
+ enum Method {
198
+ GET,
199
+ POST
200
+ }
201
+
202
+ you would match it using:
203
+
204
+ match m {
205
+ Method::GET => ...
206
+ Method::POST => ...
207
+ }
208
+
209
+ If you don't qualify the names, the code will bind new variables named "GET" and
210
+ "POST" instead. This behavior is likely not what you want, so rustc warns when
211
+ that happens.
212
+
213
+ Qualified names are good practice, and most code works well with them. But if
214
+ you prefer them unqualified, you can import the variants into scope:
215
+
216
+ use Method::*;
217
+ enum Method { GET, POST }
218
+ "## ,
219
+
194
220
E0297 : r##"
195
221
Patterns used to bind names must be irrefutable. That is, they must guarantee
196
222
that a name will be extracted in all cases. Instead of pattern matching the
@@ -296,7 +322,6 @@ register_diagnostics! {
296
322
E0137 ,
297
323
E0138 ,
298
324
E0139 ,
299
- E0170 ,
300
325
E0261 , // use of undeclared lifetime name
301
326
E0262 , // illegal lifetime parameter name
302
327
E0263 , // lifetime name declared twice in same scope
You can’t perform that action at this time.
0 commit comments