-
Notifications
You must be signed in to change notification settings - Fork 532
Add new temporary lifetime extension rule #1813
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
base: master
Are you sure you want to change the base?
Conversation
@WaffleLapkin I vaguely remember you were working on rewriting this section at some point? Maybe I misremember. |
I indeed found this message:
I did forget about it and can't find any changes I did back then, so I'd assume I haven't even started rewriting it. I'll write this down so I don't forget again ^^' |
This looks correct to me. |
[tuple struct]: types/struct.md#r-type.struct.tuple | ||
[tuple variant]: types/enum.md#r-type.enum.declaration |
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.
Let's switch these out for the r
identifiers.
@@ -374,10 +374,10 @@ expression which is one of the following: | |||
expression], [braced struct][struct expression], or [tuple][tuple expression] | |||
expression. | |||
* The final expression of any extending [block expression]. | |||
* The arguments to [tuple struct][tuple struct] and [tuple variant][tuple variant] constructors. |
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.
* The arguments to [tuple struct][tuple struct] and [tuple variant][tuple variant] constructors. | |
* The arguments to [tuple struct] and [tuple variant] constructors. |
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.
It looks like the examples below still need updating (just below in the "Examples" section).
@@ -374,10 +374,10 @@ expression which is one of the following: | |||
expression], [braced struct][struct expression], or [tuple][tuple expression] | |||
expression. | |||
* The final expression of any extending [block expression]. | |||
* The arguments to [tuple struct][tuple struct] and [tuple variant][tuple variant] constructors. |
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.
We were uncertain about two things here:
- What is an "extending ... expression"? Does that mean it is a subexpression of something else that is extending?
- Related to that, do these need the adjective "extending"? That is, "extending tuple struct" and "extending tuple variant"? If so, would it make sense to merge this with the third bullet point, or at least to move this bullet point to be next to it?
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.
I think to answer my own question, I do believe the "extending" part is relevant. My understanding is that:
Some{0: &temp()}
— ok(Some{0: &temp()},)
— okfoo(Some{0: &temp()},)
— ERROR
because in function call argument position it is not an "extending expression". The same seems to be true for tuple constructors in rust-lang/rust#140593:
Some(&temp())
— ok(Some(&temp()),)
— okfoo(Some(&temp()),)
— ERROR
See rust-lang/rust#140593