Why Every Rust Developer Should Read the Rustonomicon
The Rustonomicon isn't just about unsafe code. It teaches data layout, variance, drop mechanics, and how the language actually works under the hood.
![]()
Several times I’ve seen Rust developers dismiss the Rustonomicon - “it’s about unsafe code, I’ll never use that” or “it’s outdated.” This is wrong, and I think it’s one of the most underrated resources in the Rust ecosystem.
Yes, it covers unsafe. But that’s not the point.
The Rustonomicon teaches you how Rust actually works under the hood. Things you won’t find explained this well anywhere else:
- Data layout - how structs get padded and reordered, why
repr(C)vsrepr(Rust)matters, whatrepr(transparent)actually guarantees - References in depth - aliasing rules, why
&mutcan’t be aliased, and how this enables compiler optimizations like eliminating redundant reads and keeping values in registers - Lifetimes beyond the basics - unbounded lifetimes, Higher-Rank Trait Bounds (
for<'a>), why your closure sometimes needs explicit lifetime polymorphism - Subtyping and variance - why
&'static stris a subtype of&'a str, why&mut Tis invariant, and howPhantomDatacontrols variance in std’s own types (look atthread::Scopesource) - Drop mechanics - drop check, drop flags, why
mem::forgetis safe and what that means for your API design (it killed the oldthread::scoped) - What Vec and Arc look like inside - and why understanding their internals changes how you think about your own data structures
- Exception safety - why setting
Vec’s length before initializing elements is a time bomb, and the drop guard pattern
This isn’t just “unsafe stuff.” It’s how the language thinks. After reading it, you’ll understand why the borrow checker rejects certain code, why some trait bounds exist, and why std is designed the way it is.
Every Rust developer should read it. Not to write unsafe code - but to write better safe code.