mirror of https://github.com/rust-lang/rust.git
Rollup merge of #40131 - MajorBreakfast:patch-3, r=steveklabnik
Make lifetime elision docs clearer Previously it said "It's forbidden to allow reasoning about types based on the item signature alone." I think that sentence is wrong. Rust **uses** the item signatures to perform type inference within the body. I think what's meant is the other way around: It does not infer types for item signatures. r? @steveklabnik
This commit is contained in:
commit
a851fc1441
|
@ -349,8 +349,8 @@ to it.
|
|||
|
||||
## Lifetime Elision
|
||||
|
||||
Rust supports powerful local type inference in the bodies of functions but not in their item signatures.
|
||||
It's forbidden to allow reasoning about types based on the item signature alone.
|
||||
Rust supports powerful local type inference in the bodies of functions, but it
|
||||
deliberately does not perform any reasoning about types for item signatures.
|
||||
However, for ergonomic reasons, a very restricted secondary inference algorithm called
|
||||
“lifetime elision” does apply when judging lifetimes. Lifetime elision is concerned solely with inferring
|
||||
lifetime parameters using three easily memorizable and unambiguous rules. This means lifetime elision
|
||||
|
|
Loading…
Reference in New Issue