-
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
rustc: implement error messages from lifetime elision RFC #15838
Comments
Nominating. |
Assigning P-high, 1.0 milestone. (Its relatively high priority because the RFC was accepted in part because of the error message support it proclaimed.) |
The test now produces the appropriate
|
some progress has been made on this. some aspects of the RFC are not yet implemented. I will audit to evaluate what's left to do here. |
Result of audit: For the
where presumably I don't think these additional sentences are crucial. They certainly are not a 1.0 blocker. For the First off, the error scenario for the Perhaps more importantly: As far as I can tell, the lifetime elision rules for the impl case do not actually appear to be implemented today. In particular, both of the following examples cause compiler errors today: trait Foo<'a> { fn foo(&self) -> &'a u32; }
struct Bar0(&'static u32, &'static u32);
impl Foo for Bar0 { fn foo(&self) -> &u32 { self.0 } }
fn main() { } playpen yields:
And perhaps more importantly (in terms of a useful case where elision could well apply): trait Foo<'a> { fn foo(&self) -> &'a u32; }
struct Bar1<'b>(&'b u32, &'b u32);
impl Foo for Bar1 { fn foo(&self) -> &u32 { self.0 } }
fn main() { } playpen yields:
So therefore it is not currently relevant how we handle the case below; it will just error due to the missing parameters, and so we need not yet worry about the "cliff" between the above two cases and this one. trait Foo<'a> { fn foo(&self) -> &'a u32; }
struct Bar2<'b,'c>(&'b u32, &'c u32);
impl Foo for Bar2 { fn foo(&self) -> &u32 { self.0 } }
fn main() { } |
This is no longer a priority for 1.0 (see audit results above). Arguably the issue could be closed outright, depending on whether we have potentially decided to not actually implement lifetime elision for Update: ah, we apparently are still intending to implement elision for |
triage: P-low |
(unassigning from self since I did the audit promised above.) |
Just nominating this for re-triage. It was a critical part of the elision RFC, and still not implemented. cc @jonathandturner @GuillaumeGomez important error messages need to get done. |
@brson: Taking a look next week! |
Closing in favor of #15872 -- the remaining work is about implementing elision for impls, not really about the error message. |
The new lifetime elision rules recently landed, but the error messages for the rules do not reflect the RFC. The function
produces the error
The error messages are critical for providing a gentle slope from the intuition of borrowing to the mechanism of lifetimes.
cc @pcwalton @nick29581
The text was updated successfully, but these errors were encountered: