diff options
| author | Corey Farwell <coreyf@rwell.org> | 2017-02-28 08:33:10 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-02-28 08:33:10 -0500 |
| commit | a851fc144109996cff2bbc20080258def9f06859 (patch) | |
| tree | ecec25a70b0438b87db17dffe296de4c2e92165f | |
| parent | c4b6c98f351b9d86975ca11276b7920d4dd2fe07 (diff) | |
| parent | b70f929396b09de5557e9432417488981b960eb6 (diff) | |
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
| -rw-r--r-- | src/doc/book/src/lifetimes.md | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/doc/book/src/lifetimes.md b/src/doc/book/src/lifetimes.md index 8bca13c28f0..042d9af9717 100644 --- a/src/doc/book/src/lifetimes.md +++ b/src/doc/book/src/lifetimes.md @@ -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 |
