Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clarify third lifetime elision rule example #3805

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/ch10-03-lifetime-syntax.md
Original file line number Diff line number Diff line change
Expand Up @@ -552,10 +552,10 @@ Here is an example where the third lifetime elision rule applies:
{{#rustdoc_include ../listings/ch10-generic-types-traits-and-lifetimes/no-listing-10-lifetimes-on-methods/src/main.rs:3rd}}
```

There are two input lifetimes, so Rust applies the first lifetime elision rule
and gives both `&self` and `announcement` their own lifetimes. Then, because
one of the parameters is `&self`, the return type gets the lifetime of `&self`,
and all lifetimes have been accounted for.
There are two parameters and both are references. So Rust applies the first
lifetime elision rule and gives both `&self` and `announcement` their own
lifetimes. Then, because one of the parameters is `&self`, the return type
gets the lifetime of `&self`, and all lifetimes have been accounted for.

### The Static Lifetime

Expand Down