Helpful resources for references¶
References › Reading list
Level: reference · the reading list
One line: For each part of the references path, the book chapters, docs, papers and articles that cover the same idea — with chapter names as well as numbers, because numbers move between editions — and the sources to read with care, each with what is wrong in it.
Every link was checked on 2026-09-16. A print book is cited only by the chapter and section headings its own pages show, so "covers" means a section is titled for the idea, not that every paragraph was read.
If you read only four¶
- The Rust Programming Language, ch. 4.2 — References and Borrowing ↗ —
&,&mut, the two rules, and the dangling reference the compiler refuses. The page everyone starts from. - Programming Rust, 2nd ed. (Blandy, Orendorff & Tindall, O'Reilly 2021) — ch. 5 "References", in particular "Reference Safety" and its first case, "Borrowing a Local Variable": how the compiler assigns each reference a lifetime and works out the constraints between them. The deepest book treatment of why a reference program is refused.
- Stacked Borrows: An Aliasing Model for Rust ↗ (Jung, Dang, Kang & Dreyer, POPL 2020), §2 "An Introduction to Rust" — four pages that state the exclusion principle and explain borrow checking as loans with lifetimes. No formal background needed for §2; §3 onwards is the model for
unsafecode. A borrow is a loan runs its programs. reference↗ andpointer↗ — the std pages for&T/&mut Tand*const T/*mut T: which traits every reference implements, and the list of things a raw pointer promises nothing about.
By part of the path¶
Borrowing, loans and lifetimes¶
- TRPL ch. 4.2 — References and Borrowing ↗ — Listing 4-6 is the
E0596of writing through a& - Programming Rust, 2nd ed., ch. 5 "References" → "Reference Safety" → "Borrowing a Local Variable" — the
E0597example A borrow is a loan takes as its kata - Stacked Borrows paper (PDF) ↗ — §2 for loans, reborrowing and shared references; §5 "Supporting Interior Mutability" for why
Cellis the exception - Rustonomicon — References ↗ and Aliasing ↗ — the rules again, from the side of someone writing
unsafecode, and the optimization aliasing information makes sound - Learning Rust With Entirely Too Many Linked Lists — Stacked Borrows ↗ — the same model met while writing a queue with raw pointers, with Miri reporting each violation
- Ralf Jung, Stacked Borrows Implemented (2018) ↗ — the blog post before the paper, with the rules tried out in Miri
Pointer types, Box and Rc¶
- The Reference — Pointer types ↗ — shared and mutable references, raw pointers, smart pointers: the normative list
- TRPL ch. 15 — Smart Pointers ↗, 15.2 — Treating Smart Pointers Like Regular References ↗ and 15.4 —
Rc<T>, the Reference Counted Smart Pointer ↗ — the cons list shared by two lists, and the counts 1, 2, 3, 2 - Effective Rust, Item 8 — Familiarize yourself with reference and pointer types ↗ — references, pointer traits, fat pointers, and smart pointer types, in that order
- Stack Overflow — Understanding and relationship between
Box,ref,&and*↗ — see Read with care before trusting any snippet in it - Rust in Action (Tim McNamara, Manning 2021), ch. 6 "Memory", §6.1–6.2 — pointers, references and raw pointers in the book's vocabulary; seventeen of its claims are run in Rust in Action, chapter 6: right on the three-way split, wrong on alignment, the second word of a wide pointer and the size of
Option, and one listing is undefined behaviour - Ralf Jung, Pointers Are Complicated II (2020) ↗ — provenance: why two pointers to the same address are not interchangeable to an optimizing compiler
ref and patterns¶
refkeyword ↗ — two examples, one refused and one fixed, and the one-line difference betweenrefand&in a pattern- Rust By Example — The ref pattern ↗
- The Reference — Patterns, binding modes ↗ — the default binding mode that made
refrare - RFC 2005 — match ergonomics ↗
Dereferencing¶
- TRPL ch. 15.2 — Treating Smart Pointers Like Regular References ↗ —
*on a reference, on aBox, and throughDeref Deref↗ — deref coercion, and its three-part test for when a type should implementDerefat all
Raw pointers and unsafe¶
- Cliffle, Learn Rust the Dangerous Way, part 2 — References available upon request ↗ — a C program's raw-pointer parameter turned into
&mut [Body; N], and the list of bugs that change rules out; see Read with care for the one line that no longer compiles - TRPL ch. 20.1 — Dereferencing a Raw Pointer ↗
std::ptr↗ —ptr::read,ptr::write, and the safety section every raw-pointer function points back to- Edition guide — Disallow references to
static mut↗
Writing through a shared reference¶
std::cell↗ — "Shareable mutable containers": whyCellandRefCellcan be written through a&- TRPL ch. 15.5 —
RefCell<T>and the Interior Mutability Pattern ↗
Videos¶
Titles and channels checked through YouTube's oEmbed endpoint on 2026-09-16; the timestamps are the authors' own chapter marks from each video's description, not a transcript read here.
- Jon Gjengset, Crust of Rust: Lifetime Annotations ↗ (April 2020, 93 min) — a string splitter that holds a
&'a strand moves it forward, which is Re-pointing a slice built live. Chapters: 17:10 — missing lifetime specifier ↗ · 48:07 — what is therefkeyword and why not&↗ · 51:36 — the*on the left ofremainder↗ · 54:48 — mutable references are one level deep ↗. Recorded on a 2020 toolchain; the edition-2024 rule aboutrefunder a borrowing default mode is on Therefkeyword. - Jon Gjengset, Crust of Rust: Smart Pointers and Interior Mutability ↗ (June 2020, 123 min) —
Cell,RefCellandRcre-implemented from scratch. Chapters: 3:50 — interior mutability ↗ · 41:21 —RefCell↗ · 1:06:27 —Rc↗ · 1:54:20 —Cow↗. Beside Six pointer types, one table and Interior mutability. - Ralf Jung, Stacked Borrows: An Aliasing Model for Rust ↗ (ACM SIGPLAN, POPL 2020, 21 min, no chapters) — the conference talk for the paper A borrow is a loan takes its programs from.
Read with care¶
Good sources, each with something that does not compile or no longer holds on rustc 1.98.0. The evidence for each is on What reference explanations get wrong, run.
- The Stack Overflow thread (2015–2026). The accepted answer (2015) is still the best short overview of
Box,ref,&and*, but its pointer snippet takes&mut xof alet xthat is notmut, its*mut SomeTraithas been an error since edition 2021, and "Box<T>always takes a pointer's worth of bytes" is false forBox<str>andBox<dyn Trait>. The table answer (2022) mixes up where the pointer lives with where the data lives, and calls three non-owning pointers "shared ownership". Its last line, "refis the same as&", equates two pattern forms that do opposite things. - The Book, ch. 4.2. The
E0596transcript for Listing 4-6 comes from an older rustc: 1.98.0 says "so it cannot be borrowed as mutable" and suggests the fix as a diff. - The Book, ch. 15.4. "for reading only" describes
Rc<T>throughDeref;Rc::get_mutwrites in place when the count is one, andRc::make_mutclones first when it is not. - Programming Rust, 2nd ed. "At run time, a reference is nothing but an address" holds for a reference to a sized type; a
&stror&[T]also carries a length. - Cliffle, part 2 (written against rustc 1.39).
offset_Momentum(&mut solar_Bodies)on astatic mutis a warning in edition 2021 and an error in edition 2024.
Po polsku¶
Lista lektur do ścieżki o referencjach. Najkrócej: rozdział 4.2 The Rust Programming Language (referencje i pożyczanie), rozdział 5 Programming Rust („Reference Safety”), sekcja 2 artykułu Stacked Borrows (zasada wykluczania i pożyczki z czasem życia) oraz strony reference i pointer w dokumentacji std. Sekcja „Read with care” wymienia źródła, które warto czytać, ale z poprawkami — wątek na Stack Overflow, fragmenty The Book, Programming Rust i kursu Cliffle'a — a dowody (wyniki kompilatora) są na stronie z twierdzeniami sprawdzonymi na rustc 1.98.0.
Szukaj po polsku: referencje w Ruście · pożyczanie · zasada wykluczania · rust stacked borrows · rust ref keyword · rust raw pointer vs reference