Merge pull request #4284 from reitzig/patch-1

Ch. 10.3: clarify language detail
This commit is contained in:
Chris Krycho
2025-03-20 08:58:15 -06:00
committed by GitHub
+2 -2
View File
@@ -8,8 +8,8 @@ One detail we didn’t discuss in the [“References and
Borrowing”][references-and-borrowing]<!-- ignore --> section in Chapter 4 is
that 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,
just like most of the time, types are inferred. We must annotate types only
when multiple types are possible. In a similar way, we must annotate lifetimes
just like most of the time, types are inferred. We only have to annotate types
when multiple types are possible. In a similar way, we have to annotate lifetimes
when the lifetimes of references could be related in a few different ways. Rust
requires us to annotate the relationships using generic lifetime parameters to
ensure the actual references used at runtime will definitely be valid.