-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Description
I was wondering what changed since the second edition of The Rust Programming Language. So I spent some time asking Claude Sonnet to dig around in the git logs to answer that question. This is what we came up with. This is based on December 2022 up until today (June 30, 2025).
I'm posting this here in case it's helpful to others. @carols10cents @chriskrycho does this sound more or less correct to you?
Chapter 1: Getting Started
==Reread Recommended - Significant practical updates==
- New section: "Working Offline with This Book" - Shows how to pre-download dependencies with
cargo add [email protected] [email protected]
and use--offline
flag for all examples - Windows installation simplified: Removed complex Visual Studio setup instructions, now just directs to install Visual Studio with automated setup
- New section: "Text Editors and Integrated Development Environments" - Guidance on editor/IDE choices with link to tools page
- Technical updates: TLS version updated in curl command (--tlsv1.2), simplified linker explanations
Chapter 2: Programming a Guessing Game
- Minor wording improvements and clarifications about crates vs modules
- Updated compiler output examples for newer Rust versions
- Small tweaks to explanations of dependency management
Chapter 3: Common Programming Concepts
- Clarifications: Better explanation of function definitions vs expressions,
return
vsbreak
- Technical: Removed pedantic IEEE-754 reference, clarified stack types
- Wording: Improved control flow and looping explanations
Chapter 4: Understanding Ownership
- Clarification: Better explanation of reference scope and when references can be used
- New content: Short discussion of assignment and ownership
- Links: Added forward reference to collections chapter
Chapter 5: Using Structs to Structure Related Data
- New examples: Added example of destructuring tuple structs
- Clarification: Note about field access after struct update syntax
- Corrections: Fixed description of some code listings (particularly Listing 5-6)
Chapter 6: Enums and Pattern Matching
==Reread Recommended - New language feature==
- New:
let else
syntax added to existingif let
section - New examples: Shows how
let else
helps with "happy path" programming patterns and early returns
Chapter 7: Managing Growing Projects
- Enhanced explanations of
pub use
re-exports - Clarifications on module system concepts
Chapter 8: Common Collections
- Enhanced examples: Better progression of vector, string, and hash map usage patterns
- Updated explanations: Clearer discussions of when to use each collection type
Chapter 9: Error Handling
- Better privacy demonstration: Updated guessing game example to properly show module privacy with a dedicated
guessing_game.rs
module file - Enhanced structure: Clearer separation between
main.rs
and library code to demonstrate error handling patterns - Updated compiler outputs: Refreshed error messages for current Rust versions
Chapter 10: Generic Types, Traits, and Lifetimes
- Improved explanations: Better clarification of language details in lifetime syntax
- Enhanced examples: Made social media discussion examples more generic and inclusive
- Clearer progression: Better explanation of how non-compiling listings would be fixed
Chapter 11: Writing Automated Tests
- Updated test patterns: Examples now match what
cargo new --lib
generates (usingusize
instead ofi32
, better assertion patterns) - Enhanced CLI documentation: Better links to rustc book for
cargo test
options - Improved test organization: Better consistency with modern Rust project structure
- Updated output examples: Refreshed test output for current versions
Chapter 12: An I/O Project
- Better main/lib split: Adjusted listings to better reflect modern Rust project organization
- Enhanced modularity: Clearer demonstration of separating binary and library code
- Improved terminology: Fixed uses of "shadowed" and better explanations of variable scope
Chapter 13: Functional Language Features
- Improved closure explanations: Better clarification about functions implementing
Fn
traits - Enhanced note: Clearer explanation of when to use function names vs closures, and how functions automatically implement appropriate
Fn
traits - Better examples: More precise explanations of closure capture behavior and trait implementations
- Performance discussions: Enhanced coverage of measurement accuracy in performance comparisons
Chapter 14: More about Cargo and Crates.io
- Updated cargo instructions: Removed outdated authentication directions
- Enhanced publishing workflow: Better explanation of modern crates.io publishing process
- Improved examples: Updated dependency management examples
Chapter 15: Smart Pointers
- Improved error explanations: Better coverage of improved compiler error messages for smart pointer usage
- Enhanced examples: Clearer progression of
Box
,Deref
,Drop
,Rc
, andRefCell
usage
Chapter 16: Fearless Concurrency
- Enhanced examples: Better demonstration of thread, message passing, and shared state patterns
- Improved explanations: Clearer coverage of
Send
andSync
traits
Chapter 17: Fundamentals of Asynchronous Programming
==Entirely New Chapter - Major addition==
Added October 2024 - Complete coverage of async/await in Rust:
- 17-1: Futures and the Async Syntax - Introduction to
async
functions and.await
- 17-2: Applying Concurrency with Async - Concurrent execution patterns
- 17-3: Working With Any Number of Futures -
join!
,select!
, and dynamic collections - 17-4: Streams: Futures in Sequence - Processing async sequences of data
- 17-5: A Closer Look at the Traits for Async -
Future
,Stream
, and related traits - 17-6: Futures, Tasks, and Threads - Runtime considerations and performance
Key Topics: async
/await
syntax, Future
trait, tokio
runtime, Pin
and pinning, Stream
trait, concurrency patterns, choosing between async and threads
This represents a completely new area of Rust programming that wasn't covered in the second edition.
Chapter 18: Object Oriented Programming (formerly Ch 17)
- Enhanced delegation discussions in trait object examples
- Improved state pattern explanations
Chapter 19: Patterns and Matching (formerly Ch 18)
- Pattern syntax clarifications
Chapter 20: Advanced Features (formerly Ch 19)
- New:
&raw
syntax for safe raw pointer creation (Rust 2024 feature)- Replaces unsafe
&*ptr
patterns with&raw const
and&raw mut
- Example:
*(&raw const COUNTER)
instead of directly accessingCOUNTER
- Particularly affects static mutable variable access patterns
- Replaces unsafe
- Enhanced: Improved unsafe function documentation with better safety examples
- Updated: Clearer explanations of function pointers vs closures
- New safety patterns: Better guidance on when and how to use unsafe code
Chapter 21: Final Project (formerly Ch 20)
- New mentions: References async/await as alternative approaches where appropriate
- Browser connection handling improvements
- Code cleanup and modernization
Appendices
Appendix A: Keywords
- Updated keyword lists for 2024 edition, including
use
for precise capturing - Improved explanations of raw identifiers
Appendix B: Operators and Symbols
- Enhanced operator documentation (clarifies field access vs method calls)
Appendix C: Derivable Traits
- Enhanced explanations: Improved descriptions of what each derivable trait does
- Clearer examples: Better explanation of
Debug
trait usage withassert_eq!
Appendix D: Useful Development Tools
- Updated development tools
Appendix E: Editions
- Four editions: Now covers Rust 2015, 2018, 2021, and 2024 (was three)
2024 Edition Throughout
Universal Change
- All code examples: Now use
edition = "2024"
instead of"2021"
- New language features:
&raw
syntax,use
for precise capturing - Improved error messages: Updated compiler output throughout all chapters
Reading Priority Summary
High Priority:
- Chapter 17 (Async Programming) - Entirely new, essential for modern Rust development
- Chapter 6 (
let else
) - New syntax you'll encounter in modern code - Chapter 1 (Setup improvements) - Practical benefits for following along
Moderate Priority:
- Chapter 20 (
&raw
syntax) - Important safety improvements for unsafe code - Appendix E (2024 Edition) - Understanding current Rust ecosystem
- Chapters 8-13 - Substantial content improvements and modernization
Low Priority/Skim:
- Chapters 2-5, 7, 14-16, 18-19, 21 - Incremental improvements and clarifications
- Other Appendices - Reference updates
The most significant change is the addition of Chapter 17 on async programming, which covers a major area of Rust development that has become essential since the second edition was published.