]> git.lizzy.rs Git - rust.git/blob - src/librustc_resolve/diagnostics.rs
99c29bbb8ef7268c7000d0eca1d42afa351e2d29
[rust.git] / src / librustc_resolve / diagnostics.rs
1 // Copyright 2014 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
4 //
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
10
11 #![allow(non_snake_case)]
12
13 // Error messages for EXXXX errors.  Each message should start and end with a
14 // new line, and be wrapped to 80 characters.  In vim you can `:set tw=80` and
15 // use `gq` to wrap paragraphs. Use `:set tw=0` to disable.
16 register_long_diagnostics! {
17
18 E0154: r##"
19 Imports (`use` statements) are not allowed after non-item statements, such as
20 variable declarations and expression statements.
21
22 Here is an example that demonstrates the error:
23
24 ```compile_fail
25 fn f() {
26     // Variable declaration before import
27     let x = 0;
28     use std::io::Read;
29     // ...
30 }
31 ```
32
33 The solution is to declare the imports at the top of the block, function, or
34 file.
35
36 Here is the previous example again, with the correct order:
37
38 ```
39 fn f() {
40     use std::io::Read;
41     let x = 0;
42     // ...
43 }
44 ```
45
46 See the Declaration Statements section of the reference for more information
47 about what constitutes an Item declaration and what does not:
48
49 https://doc.rust-lang.org/reference.html#statements
50 "##,
51
52 E0251: r##"
53 Two items of the same name cannot be imported without rebinding one of the
54 items under a new local name.
55
56 An example of this error:
57
58 ```compile_fail
59 use foo::baz;
60 use bar::*; // error, do `use foo::baz as quux` instead on the previous line
61
62 fn main() {}
63
64 mod foo {
65     pub struct baz;
66 }
67
68 mod bar {
69     pub mod baz {}
70 }
71 ```
72 "##,
73
74 E0252: r##"
75 Two items of the same name cannot be imported without rebinding one of the
76 items under a new local name.
77
78 An example of this error:
79
80 ```compile_fail
81 use foo::baz;
82 use bar::baz; // error, do `use bar::baz as quux` instead
83
84 fn main() {}
85
86 mod foo {
87     pub struct baz;
88 }
89
90 mod bar {
91     pub mod baz {}
92 }
93 ```
94 "##,
95
96 E0253: r##"
97 Attempt was made to import an unimportable value. This can happen when
98 trying to import a method from a trait. An example of this error:
99
100 ```compile_fail
101 mod foo {
102     pub trait MyTrait {
103         fn do_something();
104     }
105 }
106
107 use foo::MyTrait::do_something;
108 ```
109
110 It's invalid to directly import methods belonging to a trait or concrete type.
111 "##,
112
113 E0255: r##"
114 You can't import a value whose name is the same as another value defined in the
115 module.
116
117 An example of this error:
118
119 ```compile_fail
120 use bar::foo; // error, do `use bar::foo as baz` instead
121
122 fn foo() {}
123
124 mod bar {
125      pub fn foo() {}
126 }
127
128 fn main() {}
129 ```
130 "##,
131
132 E0256: r##"
133 You can't import a type or module when the name of the item being imported is
134 the same as another type or submodule defined in the module.
135
136 An example of this error:
137
138 ```compile_fail
139 use foo::Bar; // error
140
141 type Bar = u32;
142
143 mod foo {
144     pub mod Bar { }
145 }
146
147 fn main() {}
148 ```
149 "##,
150
151 E0259: r##"
152 The name chosen for an external crate conflicts with another external crate that
153 has been imported into the current module.
154
155 Wrong example:
156
157 ```compile_fail
158 extern crate a;
159 extern crate crate_a as a;
160 ```
161
162 The solution is to choose a different name that doesn't conflict with any
163 external crate imported into the current module.
164
165 Correct example:
166
167 ```ignore
168 extern crate a;
169 extern crate crate_a as other_name;
170 ```
171 "##,
172
173 E0260: r##"
174 The name for an item declaration conflicts with an external crate's name.
175
176 For instance:
177
178 ```ignore
179 extern crate abc;
180
181 struct abc;
182 ```
183
184 There are two possible solutions:
185
186 Solution #1: Rename the item.
187
188 ```ignore
189 extern crate abc;
190
191 struct xyz;
192 ```
193
194 Solution #2: Import the crate with a different name.
195
196 ```ignore
197 extern crate abc as xyz;
198
199 struct abc;
200 ```
201
202 See the Declaration Statements section of the reference for more information
203 about what constitutes an Item declaration and what does not:
204
205 https://doc.rust-lang.org/reference.html#statements
206 "##,
207
208 E0317: r##"
209 User-defined types or type parameters cannot shadow the primitive types.
210 This error indicates you tried to define a type, struct or enum with the same
211 name as an existing primitive type:
212
213 ```compile_fail
214 struct u8 {
215     // ...
216 }
217 ```
218
219 To fix this, simply name it something else.
220
221 Such an error may also occur if you define a type parameter which shadows a
222 primitive type. An example would be something like:
223
224 ```compile_fail
225 impl<u8> MyTrait for Option<u8> {
226     // ...
227 }
228 ```
229
230 In such a case, if you meant for `u8` to be a generic type parameter (i.e. any
231 type can be used in its place), use something like `T` instead:
232
233 ```ignore
234 impl<T> MyTrait for Option<T> {
235     // ...
236 }
237 ```
238
239 On the other hand, if you wished to refer to the specific type `u8`, remove it
240 from the type parameter list:
241
242 ```ignore
243 impl MyTrait for Option<u8> {
244     // ...
245 }
246
247 See the Types section of the reference for more information about the primitive
248 types:
249
250 https://doc.rust-lang.org/reference.html#types
251 "##,
252
253 E0364: r##"
254 Private items cannot be publicly re-exported.  This error indicates that
255 you attempted to `pub use` a type or value that was not itself public.
256
257 Here is an example that demonstrates the error:
258
259 ```compile_fail
260 mod foo {
261     const X: u32 = 1;
262 }
263
264 pub use foo::X;
265 ```
266
267 The solution to this problem is to ensure that the items that you are
268 re-exporting are themselves marked with `pub`:
269
270 ```ignore
271 mod foo {
272     pub const X: u32 = 1;
273 }
274
275 pub use foo::X;
276 ```
277
278 See the 'Use Declarations' section of the reference for more information
279 on this topic:
280
281 https://doc.rust-lang.org/reference.html#use-declarations
282 "##,
283
284 E0365: r##"
285 Private modules cannot be publicly re-exported.  This error indicates
286 that you attempted to `pub use` a module that was not itself public.
287
288 Here is an example that demonstrates the error:
289
290 ```compile_fail
291 mod foo {
292     pub const X: u32 = 1;
293 }
294
295 pub use foo as foo2;
296 ```
297
298 The solution to this problem is to ensure that the module that you are
299 re-exporting is itself marked with `pub`:
300
301 ```ignore
302 pub mod foo {
303     pub const X: u32 = 1;
304 }
305
306 pub use foo as foo2;
307 ```
308
309 See the 'Use Declarations' section of the reference for more information
310 on this topic:
311
312 https://doc.rust-lang.org/reference.html#use-declarations
313 "##,
314
315 E0401: r##"
316 Inner items do not inherit type parameters from the functions they are
317 embedded in. For example, this will not compile:
318
319 ```compile_fail
320 fn foo<T>(x: T) {
321     fn bar(y: T) { // T is defined in the "outer" function
322         // ..
323     }
324     bar(x);
325 }
326 ```
327
328 Nor will this:
329
330 ```compile_fail
331 fn foo<T>(x: T) {
332     type MaybeT = Option<T>;
333     // ...
334 }
335 ```
336
337 Or this:
338
339 ```compile_fail
340 fn foo<T>(x: T) {
341     struct Foo {
342         x: T,
343     }
344     // ...
345 }
346 ```
347
348 Items inside functions are basically just like top-level items, except
349 that they can only be used from the function they are in.
350
351 There are a couple of solutions for this.
352
353 If the item is a function, you may use a closure:
354
355 ```
356 fn foo<T>(x: T) {
357     let bar = |y: T| { // explicit type annotation may not be necessary
358         // ..
359     };
360     bar(x);
361 }
362 ```
363
364 For a generic item, you can copy over the parameters:
365
366 ```
367 fn foo<T>(x: T) {
368     fn bar<T>(y: T) {
369         // ..
370     }
371     bar(x);
372 }
373 ```
374
375 ```
376 fn foo<T>(x: T) {
377     type MaybeT<T> = Option<T>;
378 }
379 ```
380
381 Be sure to copy over any bounds as well:
382
383 ```
384 fn foo<T: Copy>(x: T) {
385     fn bar<T: Copy>(y: T) {
386         // ..
387     }
388     bar(x);
389 }
390 ```
391
392 ```
393 fn foo<T: Copy>(x: T) {
394     struct Foo<T: Copy> {
395         x: T,
396     }
397 }
398 ```
399
400 This may require additional type hints in the function body.
401
402 In case the item is a function inside an `impl`, defining a private helper
403 function might be easier:
404
405 ```ignore
406 impl<T> Foo<T> {
407     pub fn foo(&self, x: T) {
408         self.bar(x);
409     }
410
411     fn bar(&self, y: T) {
412         // ..
413     }
414 }
415 ```
416
417 For default impls in traits, the private helper solution won't work, however
418 closures or copying the parameters should still work.
419 "##,
420
421 E0403: r##"
422 Some type parameters have the same name. Example of erroneous code:
423
424 ```compile_fail
425 fn foo<T, T>(s: T, u: T) {} // error: the name `T` is already used for a type
426                             //        parameter in this type parameter list
427 ```
428
429 Please verify that none of the type parameterss are misspelled, and rename any
430 clashing parameters. Example:
431
432 ```
433 fn foo<T, Y>(s: T, u: Y) {} // ok!
434 ```
435 "##,
436
437 E0404: r##"
438 You tried to implement something which was not a trait on an object. Example of
439 erroneous code:
440
441 ```compile_fail
442 struct Foo;
443 struct Bar;
444
445 impl Foo for Bar {} // error: `Foo` is not a trait
446 ```
447
448 Please verify that you didn't misspell the trait's name or otherwise use the
449 wrong identifier. Example:
450
451 ```
452 trait Foo {
453     // some functions
454 }
455 struct Bar;
456
457 impl Foo for Bar { // ok!
458     // functions implementation
459 }
460 ```
461 "##,
462
463 E0405: r##"
464 An unknown trait was implemented. Example of erroneous code:
465
466 ```compile_fail
467 struct Foo;
468
469 impl SomeTrait for Foo {} // error: use of undeclared trait name `SomeTrait`
470 ```
471
472 Please verify that the name of the trait wasn't misspelled and ensure that it
473 was imported. Example:
474
475 ```ignore
476 // solution 1:
477 use some_file::SomeTrait;
478
479 // solution 2:
480 trait SomeTrait {
481     // some functions
482 }
483
484 struct Foo;
485
486 impl SomeTrait for Foo { // ok!
487     // implements functions
488 }
489 ```
490 "##,
491
492 E0407: r##"
493 A definition of a method not in the implemented trait was given in a trait
494 implementation. Example of erroneous code:
495
496 ```compile_fail
497 trait Foo {
498     fn a();
499 }
500
501 struct Bar;
502
503 impl Foo for Bar {
504     fn a() {}
505     fn b() {} // error: method `b` is not a member of trait `Foo`
506 }
507 ```
508
509 Please verify you didn't misspell the method name and you used the correct
510 trait. First example:
511
512 ```
513 trait Foo {
514     fn a();
515     fn b();
516 }
517
518 struct Bar;
519
520 impl Foo for Bar {
521     fn a() {}
522     fn b() {} // ok!
523 }
524 ```
525
526 Second example:
527
528 ```
529 trait Foo {
530     fn a();
531 }
532
533 struct Bar;
534
535 impl Foo for Bar {
536     fn a() {}
537 }
538
539 impl Bar {
540     fn b() {}
541 }
542 ```
543 "##,
544
545 E0411: r##"
546 The `Self` keyword was used outside an impl or a trait. Erroneous
547 code example:
548
549 ```compile_fail
550 <Self>::foo; // error: use of `Self` outside of an impl or trait
551 ```
552
553 The `Self` keyword represents the current type, which explains why it
554 can only be used inside an impl or a trait. It gives access to the
555 associated items of a type:
556
557 ```
558 trait Foo {
559     type Bar;
560 }
561
562 trait Baz : Foo {
563     fn bar() -> Self::Bar; // like this
564 }
565 ```
566
567 However, be careful when two types has a common associated type:
568
569 ```compile_fail
570 trait Foo {
571     type Bar;
572 }
573
574 trait Foo2 {
575     type Bar;
576 }
577
578 trait Baz : Foo + Foo2 {
579     fn bar() -> Self::Bar;
580     // error: ambiguous associated type `Bar` in bounds of `Self`
581 }
582 ```
583
584 This problem can be solved by specifying from which trait we want
585 to use the `Bar` type:
586
587 ```
588 trait Foo {
589     type Bar;
590 }
591
592 trait Foo2 {
593     type Bar;
594 }
595
596 trait Baz : Foo + Foo2 {
597     fn bar() -> <Self as Foo>::Bar; // ok!
598 }
599 ```
600 "##,
601
602 E0412: r##"
603 An undeclared type name was used. Example of erroneous codes:
604
605 ```compile_fail
606 impl Something {} // error: use of undeclared type name `Something`
607 // or:
608 trait Foo {
609     fn bar(N); // error: use of undeclared type name `N`
610 }
611 // or:
612 fn foo(x: T) {} // error: use of undeclared type name `T`
613 ```
614
615 To fix this error, please verify you didn't misspell the type name,
616 you did declare it or imported it into the scope. Examples:
617
618 ```
619 struct Something;
620
621 impl Something {} // ok!
622
623 // or:
624
625 trait Foo {
626     type N;
627
628     fn bar(Self::N); // ok!
629 }
630
631 // or:
632
633 fn foo<T>(x: T) {} // ok!
634 ```
635 "##,
636
637 E0413: r##"
638 A declaration shadows an enum variant or unit-like struct in scope.
639 Example of erroneous code:
640
641 ```compile_fail
642 struct Foo;
643
644 let Foo = 12i32; // error: declaration of `Foo` shadows an enum variant or
645                  //        unit-like struct in scope
646 ```
647
648 To fix this error, rename the variable such that it doesn't shadow any enum
649 variable or structure in scope. Example:
650
651 ```
652 struct Foo;
653
654 let foo = 12i32; // ok!
655 ```
656
657 Or:
658
659 ```
660 struct FooStruct;
661
662 let Foo = 12i32; // ok!
663 ```
664
665 The goal here is to avoid a conflict of names.
666 "##,
667
668 E0415: r##"
669 More than one function parameter have the same name. Example of erroneous
670 code:
671
672 ```compile_fail
673 fn foo(f: i32, f: i32) {} // error: identifier `f` is bound more than
674                           //        once in this parameter list
675 ```
676
677 Please verify you didn't misspell parameters' name. Example:
678
679 ```
680 fn foo(f: i32, g: i32) {} // ok!
681 ```
682 "##,
683
684 E0416: r##"
685 An identifier is bound more than once in a pattern. Example of erroneous
686 code:
687
688 ```compile_fail
689 match (1, 2) {
690     (x, x) => {} // error: identifier `x` is bound more than once in the
691                  //        same pattern
692 }
693 ```
694
695 Please verify you didn't misspell identifiers' name. Example:
696
697 ```
698 match (1, 2) {
699     (x, y) => {} // ok!
700 }
701 ```
702
703 Or maybe did you mean to unify? Consider using a guard:
704
705 ```ignore
706 match (A, B, C) {
707     (x, x2, see) if x == x2 => { /* A and B are equal, do one thing */ }
708     (y, z, see) => { /* A and B unequal; do another thing */ }
709 }
710 ```
711 "##,
712
713 E0417: r##"
714 A static variable was referenced in a pattern. Example of erroneous code:
715
716 ```compile_fail
717 static FOO : i32 = 0;
718
719 match 0 {
720     FOO => {} // error: static variables cannot be referenced in a
721               //        pattern, use a `const` instead
722     _ => {}
723 }
724 ```
725
726 The compiler needs to know the value of the pattern at compile time;
727 compile-time patterns can defined via const or enum items. Please verify
728 that the identifier is spelled correctly, and if so, use a const instead
729 of static to define it. Example:
730
731 ```
732 const FOO : i32 = 0;
733
734 match 0 {
735     FOO => {} // ok!
736     _ => {}
737 }
738 ```
739 "##,
740
741 E0419: r##"
742 An unknown enum variant, struct or const was used. Example of
743 erroneous code:
744
745 ```compile_fail
746 match 0 {
747     Something::Foo => {} // error: unresolved enum variant, struct
748                          //        or const `Foo`
749 }
750 ```
751
752 Please verify you didn't misspell it and the enum variant, struct or const has
753 been declared and imported into scope. Example:
754
755 ```
756 enum Something {
757     Foo,
758     NotFoo,
759 }
760
761 match Something::NotFoo {
762     Something::Foo => {} // ok!
763     _ => {}
764 }
765 ```
766 "##,
767
768 E0422: r##"
769 You are trying to use an identifier that is either undefined or not a
770 struct. For instance:
771
772 ``` compile_fail
773 fn main () {
774     let x = Foo { x: 1, y: 2 };
775 }
776 ```
777
778 In this case, `Foo` is undefined, so it inherently isn't anything, and
779 definitely not a struct.
780
781 ```compile_fail
782 fn main () {
783     let foo = 1;
784     let x = foo { x: 1, y: 2 };
785 }
786 ```
787
788 In this case, `foo` is defined, but is not a struct, so Rust can't use
789 it as one.
790 "##,
791
792 E0423: r##"
793 A `struct` variant name was used like a function name. Example of
794 erroneous code:
795
796 ```compile_fail
797 struct Foo { a: bool};
798
799 let f = Foo();
800 // error: `Foo` is a struct variant name, but this expression uses
801 //        it like a function name
802 ```
803
804 Please verify you didn't misspell the name of what you actually wanted
805 to use here. Example:
806
807 ```
808 fn Foo() -> u32 { 0 }
809
810 let f = Foo(); // ok!
811 ```
812 "##,
813
814 E0424: r##"
815 The `self` keyword was used in a static method. Example of erroneous code:
816
817 ```compile_fail
818 struct Foo;
819
820 impl Foo {
821     fn bar(self) {}
822
823     fn foo() {
824         self.bar(); // error: `self` is not available in a static method.
825     }
826 }
827 ```
828
829 Please check if the method's argument list should have contained `self`,
830 `&self`, or `&mut self` (in case you didn't want to create a static
831 method), and add it if so. Example:
832
833 ```
834 struct Foo;
835
836 impl Foo {
837     fn bar(self) {}
838
839     fn foo(self) {
840         self.bar(); // ok!
841     }
842 }
843 ```
844 "##,
845
846 E0425: r##"
847 An unresolved name was used. Example of erroneous codes:
848
849 ```compile_fail
850 something_that_doesnt_exist::foo;
851 // error: unresolved name `something_that_doesnt_exist::foo`
852
853 // or:
854 trait Foo {
855     fn bar() {
856         Self; // error: unresolved name `Self`
857     }
858 }
859
860 // or:
861 let x = unknown_variable;  // error: unresolved name `unknown_variable`
862 ```
863
864 Please verify that the name wasn't misspelled and ensure that the
865 identifier being referred to is valid for the given situation. Example:
866
867 ```
868 enum something_that_does_exist {
869     Foo,
870 }
871 ```
872
873 Or:
874
875 ```
876 mod something_that_does_exist {
877     pub static foo : i32 = 0i32;
878 }
879
880 something_that_does_exist::foo; // ok!
881 ```
882
883 Or:
884
885 ```
886 let unknown_variable = 12u32;
887 let x = unknown_variable; // ok!
888 ```
889 "##,
890
891 E0426: r##"
892 An undeclared label was used. Example of erroneous code:
893
894 ```compile_fail
895 loop {
896     break 'a; // error: use of undeclared label `'a`
897 }
898 ```
899
900 Please verify you spelt or declare the label correctly. Example:
901
902 ```
903 'a: loop {
904     break 'a; // ok!
905 }
906 ```
907 "##,
908
909 E0428: r##"
910 A type or module has been defined more than once. Example of erroneous
911 code:
912
913 ```compile_fail
914 struct Bar;
915 struct Bar; // error: duplicate definition of value `Bar`
916 ```
917
918 Please verify you didn't misspell the type/module's name or remove/rename the
919 duplicated one. Example:
920
921 ```
922 struct Bar;
923 struct Bar2; // ok!
924 ```
925 "##,
926
927 E0430: r##"
928 The `self` import appears more than once in the list. Erroneous code example:
929
930 ```compile_fail
931 use something::{self, self}; // error: `self` import can only appear once in
932                              //        the list
933 ```
934
935 Please verify you didn't misspell the import name or remove the duplicated
936 `self` import. Example:
937
938 ```ignore
939 use something::self; // ok!
940 ```
941 "##,
942
943 E0431: r##"
944 `self` import was made. Erroneous code example:
945
946 ```compile_fail
947 use {self}; // error: `self` import can only appear in an import list with a
948             //        non-empty prefix
949 ```
950
951 You cannot import the current module into itself, please remove this import
952 or verify you didn't misspell it.
953 "##,
954
955 E0432: r##"
956 An import was unresolved. Erroneous code example:
957
958 ```compile_fail
959 use something::Foo; // error: unresolved import `something::Foo`.
960 ```
961
962 Please verify you didn't misspell the import name or the import does exist
963 in the module from where you tried to import it. Example:
964
965 ```ignore
966 use something::Foo; // ok!
967
968 mod something {
969     pub struct Foo;
970 }
971 ```
972
973 Or, if you tried to use a module from an external crate, you may have missed
974 the `extern crate` declaration:
975
976 ```ignore
977 extern crate homura; // Required to use the `homura` crate
978
979 use homura::Madoka;
980 ```
981 "##,
982
983 E0433: r##"
984 Invalid import. Example of erroneous code:
985
986 ```compile_fail
987 use something_which_doesnt_exist;
988 // error: unresolved import `something_which_doesnt_exist`
989 ```
990
991 Please verify you didn't misspell the import's name.
992 "##,
993
994 E0435: r##"
995 A non-constant value was used to initialise a constant. Example of erroneous
996 code:
997
998 ```compile_fail
999 let foo = 42u32;
1000 const FOO : u32 = foo; // error: attempt to use a non-constant value in a
1001                        //        constant
1002 ```
1003
1004 To fix this error, please replace the value with a constant. Example:
1005
1006 ```
1007 const FOO : u32 = 42u32; // ok!
1008 ```
1009
1010 Or:
1011
1012 ```
1013 const OTHER_FOO : u32 = 42u32;
1014 const FOO : u32 = OTHER_FOO; // ok!
1015 ```
1016 "##,
1017
1018 E0437: r##"
1019 Trait implementations can only implement associated types that are members of
1020 the trait in question. This error indicates that you attempted to implement
1021 an associated type whose name does not match the name of any associated type
1022 in the trait.
1023
1024 Here is an example that demonstrates the error:
1025
1026 ```compile_fail
1027 trait Foo {}
1028
1029 impl Foo for i32 {
1030     type Bar = bool;
1031 }
1032 ```
1033
1034 The solution to this problem is to remove the extraneous associated type:
1035
1036 ```
1037 trait Foo {}
1038
1039 impl Foo for i32 {}
1040 ```
1041 "##,
1042
1043 E0438: r##"
1044 Trait implementations can only implement associated constants that are
1045 members of the trait in question. This error indicates that you
1046 attempted to implement an associated constant whose name does not
1047 match the name of any associated constant in the trait.
1048
1049 Here is an example that demonstrates the error:
1050
1051 ```compile_fail
1052 #![feature(associated_consts)]
1053
1054 trait Foo {}
1055
1056 impl Foo for i32 {
1057     const BAR: bool = true;
1058 }
1059 ```
1060
1061 The solution to this problem is to remove the extraneous associated constant:
1062
1063 ```
1064 trait Foo {}
1065
1066 impl Foo for i32 {}
1067 ```
1068 "##
1069
1070 }
1071
1072 register_diagnostics! {
1073 //  E0153, unused error code
1074 //  E0157, unused error code
1075     E0254, // import conflicts with imported crate in this module
1076 //  E0257,
1077 //  E0258,
1078     E0402, // cannot use an outer type parameter in this context
1079     E0406, // undeclared associated type
1080     E0408, // variable from pattern #1 is not bound in pattern #
1081     E0409, // variable is bound with different mode in pattern # than in
1082            // pattern #1
1083     E0410, // variable from pattern is not bound in pattern 1
1084     E0414, // only irrefutable patterns allowed here
1085     E0418, // is not an enum variant, struct or const
1086     E0420, // is not an associated const
1087     E0421, // unresolved associated const
1088     E0427, // cannot use `ref` binding mode with ...
1089     E0429, // `self` imports are only allowed within a { } list
1090     E0434, // can't capture dynamic environment in a fn item
1091 }