rustc_error_codes/
lib.rs

1//! This library is used to gather all error codes into one place, to make
2//! their maintenance easier.
3
4// tidy-alphabetical-start
5#![deny(rustdoc::invalid_codeblock_attributes)]
6// tidy-alphabetical-end
7
8// This higher-order macro defines the error codes that are in use. It is used
9// in the `rustc_errors` crate. Removed error codes are listed in the comment
10// below.
11//
12// /!\ IMPORTANT /!\
13//
14// Error code explanation are defined in `error_codes/EXXXX.md` files. They must follow the RFC
15// 1567 available here:
16// https://rust-lang.github.io/rfcs/1567-long-error-codes-explanation-normalization.html
17//
18// Also, the contents of this macro is checked by tidy (in `check_error_codes_docs`). If you change
19// the macro syntax you will need to change tidy as well.
20//
21// Both columns are necessary because it's not possible in Rust to create a new identifier such as
22// `E0123` from an integer literal such as `0123`, unfortunately.
23//
24// Do *not* remove entries from this list. Instead, just add a note th the corresponding markdown
25// file saying that this error is not emitted by the compiler any more (see E0001.md for an
26// example), and remove all code examples that do not build any more.
27#[macro_export]
28macro_rules! error_codes {
29    ($macro:path) => (
30        $macro!(
31E0001: 0001,
32E0002: 0002,
33E0004: 0004,
34E0005: 0005,
35E0007: 0007,
36E0009: 0009,
37E0010: 0010,
38E0013: 0013,
39E0014: 0014,
40E0015: 0015,
41E0023: 0023,
42E0025: 0025,
43E0026: 0026,
44E0027: 0027,
45E0029: 0029,
46E0030: 0030,
47E0033: 0033,
48E0034: 0034,
49E0038: 0038,
50E0040: 0040,
51E0044: 0044,
52E0045: 0045,
53E0046: 0046,
54E0049: 0049,
55E0050: 0050,
56E0053: 0053,
57E0054: 0054,
58E0055: 0055,
59E0057: 0057,
60E0059: 0059,
61E0060: 0060,
62E0061: 0061,
63E0062: 0062,
64E0063: 0063,
65E0067: 0067,
66E0069: 0069,
67E0070: 0070,
68E0071: 0071,
69E0072: 0072,
70E0073: 0073,
71E0074: 0074,
72E0075: 0075,
73E0076: 0076,
74E0077: 0077,
75E0080: 0080,
76E0081: 0081,
77E0084: 0084,
78E0087: 0087,
79E0088: 0088,
80E0089: 0089,
81E0090: 0090,
82E0091: 0091,
83E0092: 0092,
84E0093: 0093,
85E0094: 0094,
86E0106: 0106,
87E0107: 0107,
88E0109: 0109,
89E0110: 0110,
90E0116: 0116,
91E0117: 0117,
92E0118: 0118,
93E0119: 0119,
94E0120: 0120,
95E0121: 0121,
96E0124: 0124,
97E0128: 0128,
98E0130: 0130,
99E0131: 0131,
100E0132: 0132,
101E0133: 0133,
102E0136: 0136,
103E0137: 0137,
104E0138: 0138,
105E0139: 0139,
106E0152: 0152,
107E0154: 0154,
108E0158: 0158,
109E0161: 0161,
110E0162: 0162,
111E0164: 0164,
112E0165: 0165,
113E0170: 0170,
114E0178: 0178,
115E0183: 0183,
116E0184: 0184,
117E0185: 0185,
118E0186: 0186,
119E0191: 0191,
120E0192: 0192,
121E0193: 0193,
122E0195: 0195,
123E0197: 0197,
124E0198: 0198,
125E0199: 0199,
126E0200: 0200,
127E0201: 0201,
128E0203: 0203,
129E0204: 0204,
130E0205: 0205,
131E0206: 0206,
132E0207: 0207,
133E0208: 0208,
134E0210: 0210,
135E0211: 0211,
136E0212: 0212,
137E0214: 0214,
138E0220: 0220,
139E0221: 0221,
140E0222: 0222,
141E0223: 0223,
142E0224: 0224,
143E0225: 0225,
144E0226: 0226,
145E0227: 0227,
146E0228: 0228,
147E0229: 0229,
148E0230: 0230,
149E0231: 0231,
150E0232: 0232,
151E0243: 0243,
152E0244: 0244,
153E0251: 0251,
154E0252: 0252,
155E0253: 0253,
156E0254: 0254,
157E0255: 0255,
158E0256: 0256,
159E0259: 0259,
160E0260: 0260,
161E0261: 0261,
162E0262: 0262,
163E0263: 0263,
164E0264: 0264,
165E0267: 0267,
166E0268: 0268,
167E0271: 0271,
168E0275: 0275,
169E0276: 0276,
170E0277: 0277,
171E0281: 0281,
172E0282: 0282,
173E0283: 0283,
174E0284: 0284,
175E0297: 0297,
176E0301: 0301,
177E0302: 0302,
178E0303: 0303,
179E0307: 0307,
180E0308: 0308,
181E0309: 0309,
182E0310: 0310,
183E0311: 0311,
184E0312: 0312,
185E0316: 0316,
186E0317: 0317,
187E0320: 0320,
188E0321: 0321,
189E0322: 0322,
190E0323: 0323,
191E0324: 0324,
192E0325: 0325,
193E0326: 0326,
194E0328: 0328,
195E0329: 0329,
196E0364: 0364,
197E0365: 0365,
198E0366: 0366,
199E0367: 0367,
200E0368: 0368,
201E0369: 0369,
202E0370: 0370,
203E0371: 0371,
204E0373: 0373,
205E0374: 0374,
206E0375: 0375,
207E0376: 0376,
208E0377: 0377,
209E0378: 0378,
210E0379: 0379,
211E0380: 0380,
212E0381: 0381,
213E0382: 0382,
214E0383: 0383,
215E0384: 0384,
216E0386: 0386,
217E0387: 0387,
218E0388: 0388,
219E0389: 0389,
220E0390: 0390,
221E0391: 0391,
222E0392: 0392,
223E0393: 0393,
224E0398: 0398,
225E0399: 0399,
226E0401: 0401,
227E0403: 0403,
228E0404: 0404,
229E0405: 0405,
230E0407: 0407,
231E0408: 0408,
232E0409: 0409,
233E0411: 0411,
234E0412: 0412,
235E0415: 0415,
236E0416: 0416,
237E0422: 0422,
238E0423: 0423,
239E0424: 0424,
240E0425: 0425,
241E0426: 0426,
242E0428: 0428,
243E0429: 0429,
244E0430: 0430,
245E0431: 0431,
246E0432: 0432,
247E0433: 0433,
248E0434: 0434,
249E0435: 0435,
250E0436: 0436,
251E0437: 0437,
252E0438: 0438,
253E0439: 0439,
254E0445: 0445,
255E0446: 0446,
256E0447: 0447,
257E0448: 0448,
258E0449: 0449,
259E0451: 0451,
260E0452: 0452,
261E0453: 0453,
262E0454: 0454,
263E0455: 0455,
264E0457: 0457,
265E0458: 0458,
266E0459: 0459,
267E0460: 0460,
268E0461: 0461,
269E0462: 0462,
270E0463: 0463,
271E0464: 0464,
272E0466: 0466,
273E0468: 0468,
274E0469: 0469,
275E0472: 0472,
276E0476: 0476,
277E0477: 0477,
278E0478: 0478,
279E0482: 0482,
280E0491: 0491,
281E0492: 0492,
282E0493: 0493,
283E0495: 0495,
284E0496: 0496,
285E0497: 0497,
286E0498: 0498,
287E0499: 0499,
288E0500: 0500,
289E0501: 0501,
290E0502: 0502,
291E0503: 0503,
292E0504: 0504,
293E0505: 0505,
294E0506: 0506,
295E0507: 0507,
296E0508: 0508,
297E0509: 0509,
298E0510: 0510,
299E0511: 0511,
300E0512: 0512,
301E0514: 0514,
302E0515: 0515,
303E0516: 0516,
304E0517: 0517,
305E0518: 0518,
306E0519: 0519,
307E0520: 0520,
308E0521: 0521,
309E0522: 0522,
310E0523: 0523,
311E0524: 0524,
312E0525: 0525,
313E0527: 0527,
314E0528: 0528,
315E0529: 0529,
316E0530: 0530,
317E0531: 0531,
318E0532: 0532,
319E0533: 0533,
320E0534: 0534,
321E0535: 0535,
322E0536: 0536,
323E0537: 0537,
324E0538: 0538,
325E0539: 0539,
326E0541: 0541,
327E0542: 0542,
328E0543: 0543,
329E0544: 0544,
330E0545: 0545,
331E0546: 0546,
332E0547: 0547,
333E0549: 0549,
334E0550: 0550,
335E0551: 0551,
336E0552: 0552,
337E0554: 0554,
338E0556: 0556,
339E0557: 0557,
340E0559: 0559,
341E0560: 0560,
342E0561: 0561,
343E0562: 0562,
344E0565: 0565,
345E0566: 0566,
346E0567: 0567,
347E0568: 0568,
348E0569: 0569,
349E0570: 0570,
350E0571: 0571,
351E0572: 0572,
352E0573: 0573,
353E0574: 0574,
354E0575: 0575,
355E0576: 0576,
356E0577: 0577,
357E0578: 0578,
358E0579: 0579,
359E0580: 0580,
360E0581: 0581,
361E0582: 0582,
362E0583: 0583,
363E0584: 0584,
364E0585: 0585,
365E0586: 0586,
366E0587: 0587,
367E0588: 0588,
368E0589: 0589,
369E0590: 0590,
370E0591: 0591,
371E0592: 0592,
372E0593: 0593,
373E0594: 0594,
374E0595: 0595,
375E0596: 0596,
376E0597: 0597,
377E0599: 0599,
378E0600: 0600,
379E0601: 0601,
380E0602: 0602,
381E0603: 0603,
382E0604: 0604,
383E0605: 0605,
384E0606: 0606,
385E0607: 0607,
386E0608: 0608,
387E0609: 0609,
388E0610: 0610,
389E0614: 0614,
390E0615: 0615,
391E0616: 0616,
392E0617: 0617,
393E0618: 0618,
394E0619: 0619,
395E0620: 0620,
396E0621: 0621,
397E0622: 0622, // REMOVED: rustc-intrinsic ABI was removed
398E0623: 0623,
399E0624: 0624,
400E0625: 0625,
401E0626: 0626,
402E0627: 0627,
403E0628: 0628,
404E0631: 0631,
405E0632: 0632,
406E0633: 0633,
407E0634: 0634,
408E0635: 0635,
409E0636: 0636,
410E0637: 0637,
411E0638: 0638,
412E0639: 0639,
413E0640: 0640,
414E0641: 0641,
415E0642: 0642,
416E0643: 0643,
417E0644: 0644,
418E0646: 0646,
419E0647: 0647,
420E0648: 0648,
421E0657: 0657,
422E0658: 0658,
423E0659: 0659,
424E0660: 0660,
425E0661: 0661,
426E0662: 0662,
427E0663: 0663,
428E0664: 0664,
429E0665: 0665,
430E0666: 0666,
431E0667: 0667,
432E0668: 0668,
433E0669: 0669,
434E0670: 0670,
435E0671: 0671,
436E0687: 0687,
437E0688: 0688,
438E0689: 0689,
439E0690: 0690,
440E0691: 0691,
441E0692: 0692,
442E0693: 0693,
443E0695: 0695,
444E0696: 0696,
445E0697: 0697,
446E0698: 0698,
447E0699: 0699, // REMOVED: merged into generic inference var error
448E0700: 0700,
449E0701: 0701,
450E0703: 0703,
451E0704: 0704,
452E0705: 0705,
453E0706: 0706,
454E0708: 0708,
455E0710: 0710,
456E0712: 0712,
457E0713: 0713,
458E0714: 0714,
459E0715: 0715,
460E0716: 0716,
461E0711: 0711,
462E0717: 0717,
463E0718: 0718,
464E0719: 0719,
465E0720: 0720,
466E0722: 0722,
467E0724: 0724,
468E0725: 0725,
469E0726: 0726,
470E0727: 0727,
471E0728: 0728,
472E0729: 0729,
473E0730: 0730,
474E0731: 0731,
475E0732: 0732,
476E0733: 0733,
477E0734: 0734,
478E0735: 0735,
479E0736: 0736,
480E0737: 0737,
481E0739: 0739,
482E0740: 0740,
483E0741: 0741,
484E0742: 0742,
485E0743: 0743,
486E0744: 0744,
487E0745: 0745,
488E0746: 0746,
489E0747: 0747,
490E0748: 0748,
491E0749: 0749,
492E0750: 0750,
493E0751: 0751,
494E0752: 0752,
495E0753: 0753,
496E0754: 0754,
497E0755: 0755,
498E0756: 0756,
499E0757: 0757,
500E0758: 0758,
501E0759: 0759,
502E0760: 0760,
503E0761: 0761,
504E0762: 0762,
505E0763: 0763,
506E0764: 0764,
507E0765: 0765,
508E0766: 0766,
509E0767: 0767,
510E0768: 0768,
511E0769: 0769,
512E0770: 0770,
513E0771: 0771,
514E0772: 0772,
515E0773: 0773,
516E0774: 0774,
517E0775: 0775,
518E0776: 0776,
519E0777: 0777,
520E0778: 0778,
521E0779: 0779,
522E0780: 0780,
523E0781: 0781,
524E0782: 0782,
525E0783: 0783,
526E0784: 0784,
527E0785: 0785,
528E0786: 0786,
529E0787: 0787,
530E0788: 0788,
531E0789: 0789,
532E0790: 0790,
533E0791: 0791,
534E0792: 0792,
535E0793: 0793,
536E0794: 0794,
537E0795: 0795,
538E0796: 0796,
539E0797: 0797,
540E0798: 0798,
541E0799: 0799,
542E0800: 0800,
543E0801: 0801,
544E0802: 0802,
545E0803: 0803,
546E0804: 0804,
547E0805: 0805,
548        );
549    )
550}
551
552// Undocumented removed error codes. Note that many removed error codes are kept in the list above
553// and marked as no-longer emitted with a note in the markdown file (see E0001 for an example).
554//  E0006, // merged with E0005
555//  E0008, // cannot bind by-move into a pattern guard
556//  E0019, // merged into E0015
557//  E0035, // merged into E0087/E0089
558//  E0036, // merged into E0087/E0089
559//  E0068,
560//  E0085,
561//  E0086,
562//  E0101, // replaced with E0282
563//  E0102, // replaced with E0282
564//  E0103,
565//  E0104,
566//  E0122, // bounds in type aliases are ignored, turned into proper lint
567//  E0123,
568//  E0127,
569//  E0129,
570//  E0134,
571//  E0135,
572//  E0141,
573//  E0153, // unused error code
574//  E0157, // unused error code
575//  E0159, // use of trait `{}` as struct constructor
576//  E0163, // merged into E0071
577//  E0167,
578//  E0168,
579//  E0172, // non-trait found in a type sum, moved to resolve
580//  E0173, // manual implementations of unboxed closure traits are experimental
581//  E0174,
582//  E0182, // merged into E0229
583//  E0187, // cannot infer the kind of the closure
584//  E0188, // can not cast an immutable reference to a mutable pointer
585//  E0189, // deprecated: can only cast a boxed pointer to a boxed object
586//  E0190, // deprecated: can only cast a &-pointer to an &-object
587//  E0194, // merged into E0403
588//  E0196, // cannot determine a type for this closure
589//  E0209, // builtin traits can only be implemented on structs or enums
590//  E0213, // associated types are not accepted in this context
591//  E0215, // angle-bracket notation is not stable with `Fn`
592//  E0216, // parenthetical notation is only stable with `Fn`
593//  E0217, // ambiguous associated type, defined in multiple supertraits
594//  E0218, // no associated type defined
595//  E0219, // associated type defined in higher-ranked supertrait
596//  E0233,
597//  E0234,
598//  E0235, // structure constructor specifies a structure of type but
599//  E0236, // no lang item for range syntax
600//  E0237, // no lang item for range syntax
601//  E0238, // parenthesized parameters may only be used with a trait
602//  E0239, // `next` method of `Iterator` trait has unexpected type
603//  E0240,
604//  E0241,
605//  E0242,
606//  E0245, // not a trait
607//  E0246, // invalid recursive type
608//  E0247,
609//  E0248, // value used as a type, now reported earlier during resolution
610//         // as E0412
611//  E0249,
612//  E0257,
613//  E0258,
614//  E0272, // on_unimplemented #0
615//  E0273, // on_unimplemented #1
616//  E0274, // on_unimplemented #2
617//  E0278, // requirement is not satisfied
618//  E0279,
619//  E0280, // changed to ICE
620//  E0285, // overflow evaluation builtin bounds
621//  E0296, // replaced with a generic attribute input check
622//  E0298, // cannot compare constants
623//  E0299, // mismatched types between arms
624//  E0300, // unexpanded macro
625//  E0304, // expected signed integer constant
626//  E0305, // expected constant
627//  E0313, // removed: found unreachable
628//  E0314, // closure outlives stack frame
629//  E0315, // cannot invoke closure outside of its lifetime
630//  E0319, // trait impls for defaulted traits allowed just for structs/enums
631//  E0372, // coherence not dyn-compatible
632//  E0385, // {} in an aliasable location
633//  E0402, // cannot use an outer type parameter in this context
634//  E0406, // merged into 420
635//  E0410, // merged into 408
636//  E0413, // merged into 530
637//  E0414, // merged into 530
638//  E0417, // merged into 532
639//  E0418, // merged into 532
640//  E0419, // merged into 531
641//  E0420, // merged into 532
642//  E0421, // merged into 531
643//  E0427, // merged into 530
644//  E0445, // merged into 446 and type privacy lints
645//  E0456, // plugin `..` is not available for triple `..`
646//  E0465, // removed: merged with E0464
647//  E0467, // removed
648//  E0470, // removed
649//  E0471, // constant evaluation error (in pattern)
650//  E0473, // dereference of reference outside its lifetime
651//  E0474, // captured variable `..` does not outlive the enclosing closure
652//  E0475, // index of slice outside its lifetime
653//  E0479, // the type `..` (provided as the value of a type parameter) is...
654//  E0480, // lifetime of method receiver does not outlive the method call
655//  E0481, // lifetime of function argument does not outlive the function call
656//  E0483, // lifetime of operand does not outlive the operation
657//  E0484, // reference is not valid at the time of borrow
658//  E0485, // automatically reference is not valid at the time of borrow
659//  E0486, // type of expression contains references that are not valid during..
660//  E0487, // unsafe use of destructor: destructor might be called while...
661//  E0488, // lifetime of variable does not enclose its declaration
662//  E0489, // type/lifetime parameter not in scope here
663//  E0490, // removed: unreachable
664//  E0526, // shuffle indices are not constant
665//  E0540, // multiple rustc_deprecated attributes
666//  E0548, // replaced with a generic attribute input check
667//  E0553, // multiple rustc_const_unstable attributes
668//  E0555, // replaced with a generic attribute input check
669//  E0558, // replaced with a generic attribute input check
670//  E0563, // cannot determine a type for this `impl Trait` removed in 6383de15
671//  E0564, // only named lifetimes are allowed in `impl Trait`,
672//         // but `{}` was found in the type `{}`
673//  E0598, // lifetime of {} is too short to guarantee its contents can be...
674//  E0611, // merged into E0616
675//  E0612, // merged into E0609
676//  E0613, // Removed (merged with E0609)
677//  E0629, // missing 'feature' (rustc_const_unstable)
678//  E0630, // rustc_const_unstable attribute must be paired with stable/unstable
679//         // attribute
680//  E0645, // trait aliases not finished
681//  E0694, // an unknown tool name found in scoped attributes
682//  E0702, // replaced with a generic attribute input check
683//  E0707, // multiple elided lifetimes used in arguments of `async fn`
684//  E0709, // multiple different lifetimes used in arguments of `async fn`
685//  E0721, // `await` keyword
686//  E0722, // replaced with a generic attribute input check
687//  E0723, // unstable feature in `const` context
688//  E0738, // Removed; errored on `#[track_caller] fn`s in `extern "Rust" { ... }`.
689//  E0744, // merged into E0728
690//  E0776, // Removed; `#[cmse_nonsecure_entry]` is now `extern "cmse-nonsecure-entry"`
691//  E0796, // unused error code. We use `static_mut_refs` lint instead.