Skip to content

Commit 3fbe6b8

Browse files
authored
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
2 parents e640c79 + b70f929 commit 3fbe6b8

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Diff for: src/doc/book/src/lifetimes.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -349,8 +349,8 @@ to it.
349349

350350
## Lifetime Elision
351351

352-
Rust supports powerful local type inference in the bodies of functions but not in their item signatures.
353-
It's forbidden to allow reasoning about types based on the item signature alone.
352+
Rust supports powerful local type inference in the bodies of functions, but it
353+
deliberately does not perform any reasoning about types for item signatures.
354354
However, for ergonomic reasons, a very restricted secondary inference algorithm called
355355
“lifetime elision” does apply when judging lifetimes. Lifetime elision is concerned solely with inferring
356356
lifetime parameters using three easily memorizable and unambiguous rules. This means lifetime elision

0 commit comments

Comments
 (0)