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