mirror of
https://github.com/rust-lang/book.git
synced 2026-12-01 16:26:06 -06:00
Small wording changes
This commit is contained in:
committed by
Carol (Nichols || Goulding)
parent
4d988c795a
commit
66aedb4a61
@@ -8,13 +8,13 @@ One detail we didn’t discuss in the [“References and
|
|||||||
Borrowing”][references-and-borrowing]<!-- ignore --> section in Chapter 4 is
|
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 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,
|
that reference is valid. Most of the time, lifetimes are implicit and inferred,
|
||||||
just like most of the time, types are inferred. We only must annotate types
|
just like most of the time, types are inferred. We must only annotate types
|
||||||
when multiple types are possible. In a similar way, we must annotate lifetimes
|
when multiple types are possible. In a similar way, we must annotate lifetimes
|
||||||
when the lifetimes of references could be related in a few different ways. Rust
|
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
|
requires us to annotate the relationships using generic lifetime parameters to
|
||||||
ensure the actual references used at runtime will definitely be valid.
|
ensure the actual references used at runtime will definitely be valid.
|
||||||
|
|
||||||
Annotating lifetimes is not even a concept most other programming languages
|
Annotating lifetimes is not a concept most other programming languages
|
||||||
have, so this is going to feel unfamiliar. Although we won’t cover lifetimes in
|
have, so this is going to feel unfamiliar. Although we won’t cover lifetimes in
|
||||||
their entirety in this chapter, we’ll discuss common ways you might encounter
|
their entirety in this chapter, we’ll discuss common ways you might encounter
|
||||||
lifetime syntax so you can get comfortable with the concept.
|
lifetime syntax so you can get comfortable with the concept.
|
||||||
|
|||||||
Reference in New Issue
Block a user