The error-code map¶
Level: reference · the map
One line: The code in the red line is the one exact, searchable thing a stuck reader already has — and until this page nothing in the library could be searched by it. Here is every code the library teaches, and the lesson that explains it.
If you have a code on screen, it is in the table. The rest of this page is about the codes that mean too many things to be looked up that way.
Same rule as the other maps: order is presentation, so it lives here rather than in folder names — STRUCTS.md explains why in full, and STRINGS.md, OPTION.md and SHADOWING.md follow it too.
The six you will actually meet¶
The on column is how many lesson pages in this library have to mention the code — a fair proxy for how often you meet it, and the reason these six lead.
| code | rustc says | on | what it usually means here |
|---|---|---|---|
| E0277 ↗ | the trait bound is not satisfied | 38 | four unrelated struct mistakes share it, so the code is never the diagnosis — read the line under it |
| E0308 ↗ | mismatched types | 37 | the least diagnostic code in Rust: it is what you get when almost anything is wrong. Three lessons treat three unrelated causes — a + whose left side does not own its bytes, a shadow that changed type, and an if whose arms disagree over one stray ; |
| E0382 ↗ | use of moved value | 30 | let b = a; moved rather than copied. Copy vs Clone is the page: a struct is never Copy by accident |
| E0502 ↗ | cannot borrow as mutable | 18 | many readers or one writer. Borrowing — and the part that decides it is where the compiler thinks the borrow ended |
| E0282 ↗ | type annotations needed | 14 | it is asking which type, and for collect it is asking which collection. Type inference is the general case |
| E0599 ↗ | no method named … | 12 | one code over three unrelated mistakes — never written, not imported, not implemented — and the help: line tells them apart |
Notice what four of those six have in common: one code, several causes. That is the reason this page is a map to lessons rather than a glossary of codes — the code narrows the search, and the lesson finishes it.
Every code the library teaches¶
Mentioned, but not taught¶
Seven more codes appear once or twice in passing, without a lesson behind them. They are listed for completeness, and each links to rustc's own explanation:
E0080 ↗ on What a compiler does before your program runs, E0170 ↗ on A typo becomes a binding, E0283 ↗ on Type inference, E0405 ↗ on There is no Move trait, E0432 ↗ on A typo becomes a binding, E0493 ↗ on Vec methods, E0658 ↗ on unwrap_or: the default you already have
The two codes with no single home¶
The table above names one lesson per code, chosen as the page that treats it at most length. For two codes that choice is a tie, and the tie is telling rather than arbitrary.
E0308 is mismatched types — what rustc says when almost anything is wrong. It appears on 37 lesson pages — second only to E0277 — and the two that treat it most do so for entirely different reasons: Concatenating strings meets it as the near miss where + has a String on the right instead of a &str, and A name is not a place meets it when a shadow changes a binding's type. A third, if expressions, meets it when two branches disagree — usually over one stray ;. There is no single lesson to send you to, because there is no single mistake.
E0373 — closure may outlive the current function — ties between The move keyword, which is the concept, and Spawning a thread, which is where you meet it. Read the first if you want to know why, the second if you have a thread that will not compile.
How this page is kept honest¶
Every row was derived from the library rather than written from memory: the owning lesson for each code is the page that mentions it most, and the "also appears on" count is the number of other pages carrying it. All 74 code links were checked live. If a code moves to a better home, the count moves with it — so re-derive this table rather than editing a row by hand.
Sources¶
The linked explanations are rustc's own error index ↗, which is the authority for what each code means; this page claims only which lesson in this library explains it.