Skip to content

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

Merged
merged 1 commit into from
Aug 5, 2015
Merged

Conversation

steveklabnik
Copy link
Member

We haven't discussed this syntax yet, so provide a basic explanation
and link up to later chapters.

Fixes #26917

We haven't discussed this syntax yet, so provide a basic explanation
and link up to later chapters.

Fixes rust-lang#26917
@rust-highfive
Copy link
Contributor

r? @alexcrichton

(rust_highfive has picked a reviewer for you, use r? to override)

@Gankra
Copy link
Contributor

Gankra commented Aug 5, 2015

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:
Copy link
Contributor

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.

Copy link
Member

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.

@alexcrichton
Copy link
Member

@bors: r+ 8f828a3 rollup

(but feel free to r- @gankro if you disagree)

@Gankra
Copy link
Contributor

Gankra commented Aug 5, 2015

shrug monotonic improvement -- can always refine later if desired.

On Wed, Aug 5, 2015 at 11:49 AM, Alex Crichton [email protected]
wrote:

@bors https://github.com/bors: r+ 8f828a3
8f828a3
rollup

(but feel free to r- @gankro https://github.com/Gankro if you disagree)


Reply to this email directly or view it on GitHub
#27538 (comment).

steveklabnik added a commit to steveklabnik/rust that referenced this pull request Aug 5, 2015
We haven't discussed this syntax yet, so provide a basic explanation
and link up to later chapters.

Fixes rust-lang#26917
bors added a commit that referenced this pull request Aug 5, 2015
@bors bors merged commit 8f828a3 into rust-lang:master Aug 5, 2015
@steveklabnik steveklabnik deleted the gh26917 branch June 19, 2016 20:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants