@@ -397,6 +397,115 @@ 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
+ The compiler needs to know the value of the pattern at compile time;
414
+ compile-time patterns can defined via const or enum items. Please verify
415
+ that the identifier is spelled correctly, and if so, use a const instead
416
+ of static to define it. Example:
417
+
418
+ ```
419
+ const FOO : i32 = 0;
420
+
421
+ match 0 {
422
+ FOO => {} // ok!
423
+ _ => {}
424
+ }
425
+ ```
426
+ "## ,
427
+
428
+ E0424 : r##"
429
+ The `self` keyword was used in a static method. Example of erroneous code:
430
+
431
+ ```
432
+ struct Foo;
433
+
434
+ impl Foo {
435
+ fn bar(self) {}
436
+
437
+ fn foo() {
438
+ self.bar(); // error: `self` is not available in a static method.
439
+ }
440
+ }
441
+ ```
442
+
443
+ Please check if the method's argument list should have contained `self`,
444
+ `&self`, or `&mut self` (in case you didn't want to create a static
445
+ method), and add it if so. Example:
446
+
447
+ ```
448
+ struct Foo;
449
+
450
+ impl Foo {
451
+ fn bar(self) {}
452
+
453
+ fn foo(self) {
454
+ self.bar(); // ok!
455
+ }
456
+ }
457
+ ```
458
+ "## ,
459
+
460
+ E0425 : r##"
461
+ An unresolved name was used. Example of erroneous codes:
462
+
463
+ ```
464
+ something_that_doesnt_exist::foo;
465
+ // error: unresolved name `something_that_doesnt_exist::foo`
466
+
467
+ // or:
468
+ trait Foo {
469
+ fn bar() {
470
+ Self; // error: unresolved name `Self`
471
+ }
472
+ }
473
+ ```
474
+
475
+ Please verify you didn't misspell the name or that you're not using an
476
+ invalid object. Example:
477
+
478
+ ```
479
+ enum something_that_does_exist {
480
+ foo
481
+ }
482
+ // or:
483
+ mod something_that_does_exist {
484
+ pub static foo : i32 = 0i32;
485
+ }
486
+
487
+ something_that_does_exist::foo; // ok!
488
+ ```
489
+ "## ,
490
+
491
+ E0426 : r##"
492
+ An undeclared label was used. Example of erroneous code:
493
+
494
+ ```
495
+ loop {
496
+ break 'a; // error: use of undeclared label `'a`
497
+ }
498
+ ```
499
+
500
+ Please verify you spelt or declare the label correctly. Example:
501
+
502
+ ```
503
+ 'a: loop {
504
+ break 'a; // ok!
505
+ }
506
+ ```
507
+ "## ,
508
+
400
509
E0428 : r##"
401
510
A type or module has been defined more than once. Example of erroneous
402
511
code:
@@ -415,6 +524,53 @@ struct Bar2; // ok!
415
524
```
416
525
"## ,
417
526
527
+ E0430 : r##"
528
+ The `self` import appears more than once in the list. Erroneous code example:
529
+
530
+ ```
531
+ use something::{self, self}; // error: `self` import can only appear once in
532
+ // the list
533
+ ```
534
+
535
+ Please verify you didn't misspell the import name or remove the duplicated
536
+ `self` import. Example:
537
+
538
+ ```
539
+ use something::self; // ok!
540
+ ```
541
+ "## ,
542
+
543
+ E0431 : r##"
544
+ `self` import was made. Erroneous code example:
545
+
546
+ ```
547
+ use {self}; // error: `self` import can only appear in an import list with a
548
+ // non-empty prefix
549
+ ```
550
+
551
+ You cannot import the current module into itself, please remove this import
552
+ or verify you didn't misspell it.
553
+ "## ,
554
+
555
+ E0432 : r##"
556
+ An import was unresolved. Erroneous code example:
557
+
558
+ ```
559
+ use something::Foo; // error: unresolved import `something::Foo`.
560
+ ```
561
+
562
+ Please verify you didn't misspell the import name or the import does exist
563
+ in the module from where you tried to import it. Example:
564
+
565
+ ```
566
+ use something::Foo; // ok!
567
+
568
+ mod something {
569
+ pub struct Foo;
570
+ }
571
+ ```
572
+ "## ,
573
+
418
574
E0433 : r##"
419
575
Invalid import. Example of erroneous code:
420
576
@@ -499,24 +655,15 @@ register_diagnostics! {
499
655
E0414 , // only irrefutable patterns allowed here
500
656
E0415 , // identifier is bound more than once in this parameter list
501
657
E0416 , // identifier is bound more than once in the same pattern
502
- E0417 , // static variables cannot be referenced in a pattern, use a
503
- // `const` instead
504
658
E0418 , // is not an enum variant, struct or const
505
659
E0419 , // unresolved enum variant, struct or const
506
660
E0420 , // is not an associated const
507
661
E0421 , // unresolved associated const
508
662
E0422 , // does not name a structure
509
663
E0423 , // is a struct variant name, but this expression uses it like a
510
664
// function name
511
- E0424 , // `self` is not available in a static method.
512
- E0425 , // unresolved name
513
- E0426 , // use of undeclared label
514
665
E0427 , // cannot use `ref` binding mode with ...
515
666
E0429 , // `self` imports are only allowed within a { } list
516
- E0430 , // `self` import can only appear once in the list
517
- E0431 , // `self` import can only appear in an import list with a non-empty
518
- // prefix
519
- E0432 , // unresolved import
520
667
E0434 , // can't capture dynamic environment in a fn item
521
668
E0435 , // attempt to use a non-constant value in a constant
522
669
}
0 commit comments