Effective Rust (2024)

Availability & Buying a Free Book

  • Many are surprised an O’Reilly title is fully online; it’s seen as unusually generous and a good marketing funnel.
  • Several say they’ll still buy it (especially print) to support the author/publisher, get better formatting (epub/Kindle), and increase motivation to actually read it.
  • Physical books are valued as long-term career investments, even if tech titles go stale and end up discarded.

Position Among Rust Learning Resources

  • The book is praised as high quality and “advanced best practices,” not a first Rust text.
  • Common learning path suggested: “The Rust Programming Language” (the official book), Rust by Example, then more advanced titles like Programming Rust, Rust in Action, Rust for Rustaceans, Rust Atomics and Locks, plus video content.
  • Programming Rust is repeatedly recommended as an excellent or even best beginner book.

Symbol “Soup” and Readability

  • Some criticize Rust as full of symbol soup (lifetimes, generics, ?, ::, etc.) and find constructs like )?)? off‑putting.
  • Others argue symbols are just another alphabet, quickly become natural, and enable concise expression—similar to math or APL-like languages.
  • There is debate over specific choices (' for lifetimes, < > for generics); some find them intuitive, others think alternatives would be more readable.
  • Consensus: explicit lifetimes look scary at first but are rare in everyday code and largely ignorable once internalized.

Rust’s Niche vs Other Languages

  • Rust is framed as a “curly‑brace, static binary, no-VM” systems language that occupies a sweet spot of power, safety, and usability.
  • It’s compared to C++ (similar domain, RAII, zero‑cost abstractions, long compile times) and to Zig (seen as more C-like but less mature/stable).
  • Opinions diverge on whether Rust suits high-level work: some prefer GC languages for most server/web apps; others increasingly wish high-level languages adopted more Rust features (enums/ADTs, error handling, Cargo-like tooling).

Lifetimes, Inference, and Compiler Tradeoffs

  • Several note Rust’s explicit lifetime syntax is about giving the compiler a local, checkable contract; inference is intentionally limited.
  • There’s a detailed back‑and‑forth on whole‑program lifetime inference: it might reduce annotations but would hurt compile times, locality, error messages, and semver stability.
  • Rust 2024 and tools like Clippy are cited as gradually reducing the amount of boilerplate needed.

Error Handling Ergonomics

  • Rust’s ? operator is widely praised: one symbol replacing multiple boilerplate lines is seen as clearer and less bug-prone than Go-style repeated if err != nil patterns.
  • Some Go users prefer explicit conditionals, arguing they’re used to “ignoring the noise,” but others counter that this habit hides copy‑paste mistakes and subtle logic bugs.
  • Rust’s ability to implicitly convert error types when bubbling (From/Into) is highlighted as an additional ergonomic win.

Drop, RAII, and Memory Leaks

  • A Rust novice notes the book’s Drop/RAII section omits “Drop leaks” (e.g., mem::forget), prompting discussion.
  • mem::forget is described as a surprising but “safe” footgun: it can leak resources but doesn’t violate Rust’s specific definition of memory safety (no UB, no type-violating reads).
  • Long, heated subthread debates definitions of “safety,” “undefined behavior,” and “memory leak”:
    • One side argues Rust narrowed “safety” to what the compiler can enforce (no UAF, no data races) and that leaks and crashes are outside that scope.
    • The other side insists leaks and race conditions are also real safety issues and criticizes Rust’s terminology as marketing-driven.
  • Practical notes on Drop:
    • Destructors can be skipped (via leaks) but never run twice; you can’t safely rely on Drop in unsafe invariants.
    • You cannot “re‑animate” objects from Drop, unlike some older managed C++ designs.
    • Arc’s strong_count must not be used to decide “last owner” due to race conditions; APIs like Arc::into_inner/get_mut are safer.