File tree Expand file tree Collapse file tree 1 file changed +27
-2
lines changed Expand file tree Collapse file tree 1 file changed +27
-2
lines changed Original file line number Diff line number Diff line change @@ -397,6 +397,33 @@ impl Bar {
397
397
```
398
398
"## ,
399
399
400
+ E0417 : r##"
401
+ A static variable was referenced in a pattern. Example of erroneous code:
402
+
403
+ ```
404
+ static FOO : i32 = 0;
405
+
406
+ match 0 {
407
+ FOO => {} // error: static variables cannot be referenced in a
408
+ // pattern, use a `const` instead
409
+ _ => {}
410
+ }
411
+ ```
412
+
413
+ Compiler needs to know the pattern value at compile's time, which is
414
+ not possible with a `static` variable. So please verify you didn't
415
+ misspell the variable's name or use a `const` instead. Example:
416
+
417
+ ```
418
+ const FOO : i32 = 0;
419
+
420
+ match 0 {
421
+ FOO => {} // ok!
422
+ _ => {}
423
+ }
424
+ ```
425
+ "## ,
426
+
400
427
E0428 : r##"
401
428
A type or module has been defined more than once. Example of erroneous
402
429
code:
@@ -448,8 +475,6 @@ register_diagnostics! {
448
475
E0414 , // only irrefutable patterns allowed here
449
476
E0415 , // identifier is bound more than once in this parameter list
450
477
E0416 , // identifier is bound more than once in the same pattern
451
- E0417 , // static variables cannot be referenced in a pattern, use a
452
- // `const` instead
453
478
E0418 , // is not an enum variant, struct or const
454
479
E0419 , // unresolved enum variant, struct or const
455
480
E0420 , // is not an associated const
You can’t perform that action at this time.
0 commit comments