Rust 1.43.1
8d69840ab

# Lifetimes

There is a new edition of the book and this is an old link.

> Every reference in Rust has a lifetime, which is the scope for which that reference is valid. Most of the time lifetimes are implicit and inferred.

    {
        let x = 5;            // -----+-- 'b
                              //      |
        let r = &x;           // --+--+-- 'a
                              //   |  |
        println!("r: {}", r); //   |  |
                              // --+  |
    }                         // -----+

Run

Here are the relevant sections in the new and old books:

- in the current edition: Ch 10.03 — Lifetimes
- In the first edition: Ch 3.10 — Lifetimes