Skip to content

Conversation

steveklabnik
Copy link
Contributor

Fixes #19662.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think a comment here is warranted similar to this. If you don't recognize this, it is puzzling why int doesn't get a lifetime too.

// `lvl` doesn't need a lifetime because it's not a reference (`&`). Only references need lifetimes.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not only references: struct Foo<'a> { ... } would be fn foo<'a>(x: Foo<'a>).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe this could be "all references have a lifetime" or something else that emphasises that it is an inherent property of references.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

re-worded

@steveklabnik
Copy link
Contributor Author

r? @huonw

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, it has one, that is used in both input and output position.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

both meaning and input and output lifetime, even though they are the same one. Is it worth an extra few words?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed this

alexcrichton added a commit to alexcrichton/rust that referenced this pull request Jan 5, 2015
alexcrichton added a commit to alexcrichton/rust that referenced this pull request Jan 6, 2015
@bors bors merged commit a56e7ae into rust-lang:master Jan 6, 2015
@steveklabnik steveklabnik deleted the gh19662 branch October 25, 2017 18:27
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.

Fully document all forms of lifetime elision

4 participants