Skip to content
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

Closed
alexcrichton opened this issue Jul 9, 2014 · 5 comments
Closed

Implement lifetime elision #15552

alexcrichton opened this issue Jul 9, 2014 · 5 comments
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

@alexcrichton
Copy link
Member

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.

@pnkfelix
Copy link
Member

Assigning P-backcompat-lang, 1.0.

@pnkfelix pnkfelix added this to the 1.0 milestone Jul 10, 2014
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
@alexcrichton
Copy link
Member Author

Reopening, as the tracking issue of the RFC it looks like there's still a few more tasks to accomplish:

cc #15872
cc #15838

At the same time I'll nominate for removal from the milestone as the backwards-incompatible pieces are done.

@aturon
Copy link
Member

aturon commented Jul 23, 2014

cc #15907

@pnkfelix
Copy link
Member

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.

@pnkfelix pnkfelix removed this from the 1.0 milestone Jul 24, 2014
@alexcrichton alexcrichton added the T-lang Relevant to the language team, which will review and decide on the PR/issue. label Aug 11, 2015
@alexcrichton
Copy link
Member Author

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.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants