File tree Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -8,11 +8,12 @@ One detail we didn’t discuss in the [“References and
8
8
Borrowing”] [ references-and-borrowing ] <!-- ignore --> section in Chapter 4 is
9
9
that every reference in Rust has a _ lifetime_ , which is the scope for which
10
10
that reference is valid. Most of the time, lifetimes are implicit and inferred,
11
- just like most of the time, types are inferred. We only have to annotate types
12
- when multiple types are possible. In a similar way, we have to annotate lifetimes
13
- when the lifetimes of references could be related in a few different ways. Rust
14
- requires us to annotate the relationships using generic lifetime parameters to
15
- ensure the actual references used at runtime will definitely be valid.
11
+ just like most of the time, types are inferred. We are only required to
12
+ annotate types when multiple types are possible. In a similar way, we have to
13
+ annotate lifetimes when the lifetimes of references could be related in a few
14
+ different ways. Rust requires us to annotate the relationships using generic
15
+ lifetime parameters to ensure the actual references used at runtime will
16
+ definitely be valid.
16
17
17
18
Annotating lifetimes is not even a concept most other programming languages
18
19
have, so this is going to feel unfamiliar. Although we won’t cover lifetimes in
You can’t perform that action at this time.
0 commit comments