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