-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Implement lifetime elision #15552
Labels
B-RFC-approved
Blocker: Approved by a merged RFC but not yet implemented.
metabug
Issues about issues themselves ("bugs about bugs")
P-medium
Medium priority
T-lang
Relevant to the language team, which will review and decide on the PR/issue.
Comments
Assigning P-backcompat-lang, 1.0. |
bors
added a commit
that referenced
this issue
Jul 20, 2014
This implements RFC 39. Omitted lifetimes in return values will now be inferred to more useful defaults, and an error is reported if a lifetime in a return type is omitted and one of the two lifetime elision rules does not specify what it should be. This primarily breaks two uncommon code patterns. The first is this: unsafe fn get_foo_out_of_thin_air() -> &Foo { ... } This should be changed to: unsafe fn get_foo_out_of_thin_air() -> &'static Foo { ... } The second pattern that needs to be changed is this: enum MaybeBorrowed<'a> { Borrowed(&'a str), Owned(String), } fn foo() -> MaybeBorrowed { Owned(format!("hello world")) } Change code like this to: enum MaybeBorrowed<'a> { Borrowed(&'a str), Owned(String), } fn foo() -> MaybeBorrowed<'static> { Owned(format!("hello world")) } Closes #15552. [breaking-change] r? @nick29581
cc #15907 |
reclassifiying this as a metabug. Thus it shuold not block 1.0 milestone; more specific subbugs will be added to 1.0 milestone as warranted. P-high, not 1.0 milestone. |
alexcrichton
added
the
T-lang
Relevant to the language team, which will review and decide on the PR/issue.
label
Aug 11, 2015
This has long since been implemented and the last two issues have separate issues, so I'm going to close this one. |
bors
added a commit
to rust-lang-ci/rust
that referenced
this issue
Sep 18, 2023
Bump `rustc-perf` checkout for metrics, replace webrender, diesel and ripgrep with newer versions The previous versions were removed hence the updates. The metric results for the changed ones are disconnected now as to not muddle things up. I think it's worth it for us to occasionally bump the `rustc-perf` checkout, as it allows us to include more interesting new targets. Notably, the newer diesel is 3 times as fast to analyze as the one of the current checkout.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
B-RFC-approved
Blocker: Approved by a merged RFC but not yet implemented.
metabug
Issues about issues themselves ("bugs about bugs")
P-medium
Medium priority
T-lang
Relevant to the language team, which will review and decide on the PR/issue.
Tracking issue for rust-lang/rfcs#141
Nominating, I believe the "error on unnamed lifetimes in return types" is a backwards-incompatible change. The elision, however, is not backwards-incompatible.
The text was updated successfully, but these errors were encountered: