Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upIn-band lifetime syntax inconsistency? #37
Comments
This comment has been minimized.
This comment has been minimized.
|
The RFC itself appears to be inconsistent. The summary and guide level explanation use the first form (lifetimes must be introduced as part of the arguments, and don't have to use the same name) while the reference level explanation use the second form (lifetimes with the name of an argument binding implicitly refer to that binding). Testing the feature seems to show that only the first form works. |
This comment has been minimized.
This comment has been minimized.
|
I guess this ambiguity is one thing to be sorted out before the feature lands, then :) |
This comment has been minimized.
This comment has been minimized.
|
Opened rust-lang/rfcs#2486 to fix the RFC and #38 to fix the docs. |
This comment has been minimized.
This comment has been minimized.
|
Gonna wait to see what the lang team says before merging this. |
This comment has been minimized.
This comment has been minimized.
|
actually, we should probably take the other PR as it was first... |
HadrienG2 commentedJun 23, 2018
In the in-band lifetime section, the following syntax is introduced:
Later, in the lifetime elision in impl section, it is said that the feature interacts with in-band lifetime syntax in the following way:
There is a little difference between these two syntaxes, however. The former syntax gives the impression that the lifetime parameter is named "bar" by choice, but could be anything, whereas the latter syntax gives the impression that one can use
&'argas a shorthand to denote the lifetime of reference argument "arg" of a function.Which syntax is the correct one?