Skip to content

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

code the lesson that explains it also appears on
E0004 ↗ Six kinds of zero 8 other pages
E0005 ↗ Irrefutable patterns 1 other page
E0015 ↗ const and static
E0038 ↗ Static vs dynamic dispatch 1 other page
E0040 ↗ Drop, and what RAII buys 1 other page
E0046 ↗ When the impl does not match the trait
E0050 ↗ When the impl does not match the trait
E0053 ↗ When the impl does not match the trait
E0063 ↗ When a struct refuses
E0072 ↗ Box 3 other pages
E0106 ↗ Lifetime annotations 6 other pages
E0117 ↗ From and Into
E0119 ↗ When a struct refuses 2 other pages
E0133 ↗ What unsafe turns off
E0184 ↗ Copy vs Clone 1 other page
E0185 ↗ When the impl does not match the trait
E0186 ↗ When the impl does not match the trait
E0204 ↗ Copy vs Clone
E0214 ↗ A type is not a constructor
E0252 ↗ Bringing names in with use
E0276 ↗ When the impl does not match the trait
E0277 ↗ When a struct refuses 37 other pages
E0282 ↗ Type inference 13 other pages
E0284 ↗ What a type annotation does 1 other page
E0308 ↗ Concatenating strings — but see below 36 other pages
E0317 ↗ A block is an expression
E0368 ↗ Concatenating strings 1 other page
E0369 ↗ Concatenating strings 4 other pages
E0373 ↗ The move keyword — but see below 2 other pages
E0381 ↗ A type is not a constructor 4 other pages
E0382 ↗ Copy vs Clone 29 other pages
E0384 ↗ Variables 2 other pages
E0392 ↗ Phantom types 3 other pages
E0407 ↗ When the impl does not match the trait
E0408 ↗ One arm, many values
E0423 ↗ A type is not a constructor 2 other pages
E0425 ↗ A block is an expression 4 other pages
E0428 ↗ One module per file
E0433 ↗ A throwaway that needs a crate: three commands, and the message that means you skipped them
E0434 ↗ What a closure is
E0435 ↗ What a compiler does before your program runs
E0449 ↗ When the impl does not match the trait
E0451 ↗ Modules and visibility
E0499 ↗ What unsafe turns off 5 other pages
E0502 ↗ Borrowing: &T, &mut T, and where a borrow ends 17 other pages
E0505 ↗ A shadow does not drop 2 other pages
E0506 ↗ A name is not a place 1 other page
E0507 ↗ Transforms instead of match 5 other pages
E0509 ↗ The drop flag
E0515 ↗ Collect the iterator into a Vec 6 other pages
E0585 ↗ Comments that compile
E0593 ↗ unwrap_or_else: the fallback that is built only if it is needed
E0594 ↗ When a struct refuses
E0596 ↗ impl blocks 3 other pages
E0597 ↗ &'static str 2 other pages
E0599 ↗ "No method named …" 11 other pages
E0603 ↗ Modules and visibility 2 other pages
E0605 ↗ What an enum is
E0616 ↗ Modules and visibility 1 other page
E0618 ↗ A type is not a constructor 2 other pages
E0624 ↗ "No method named …"
E0659 ↗ Bringing names in with use
E0665 ↗ What an attribute is 1 other page
E0700 ↗ Returning an iterator
E0716 ↗ Vec::into_iter — and the three IntoIterator impls 1 other page
E0740 ↗ What a union is
E0753 ↗ Comments that compile

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.