-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Expand further on <> syntax in TRPL. #27538
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
Conversation
We haven't discussed this syntax yet, so provide a basic explanation and link up to later chapters. Fixes rust-lang#26917
(rust_highfive has picked a reviewer for you, use r? to override) |
No turbo fish? 😿 |
[generics]: generics.html | ||
|
||
We use `<>` to declare our lifetimes. This says that `bar` has one lifetime, | ||
`'a`. If we had two reference parameters, it would look like this: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This might be a bit deceptive -- a function can have many more lifetimes that aren't declared thanks to elision.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From a technical perspective I each function can have multiple lifetime parameters, but from the perspective of just explaining syntax I think it's fine to assume that "lifetime parameter" is the same as "explicitly declared lifetime parameter". Elision kinda fits into the same system later on, so I don't think that we're going to confuse anyone from this.
shrug monotonic improvement -- can always refine later if desired. On Wed, Aug 5, 2015 at 11:49 AM, Alex Crichton [email protected]
|
We haven't discussed this syntax yet, so provide a basic explanation and link up to later chapters. Fixes rust-lang#26917
We haven't discussed this syntax yet, so provide a basic explanation
and link up to later chapters.
Fixes #26917