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

23.2 Lifetimes: Functions | mut_one() appears to just work? #256

Closed
nelsonjchen opened this issue Oct 8, 2014 · 5 comments
Closed

23.2 Lifetimes: Functions | mut_one() appears to just work? #256

nelsonjchen opened this issue Oct 8, 2014 · 5 comments

Comments

@nelsonjchen
Copy link

If I uncomment mut_one(), it looks like it just works and it doesn't error out. Did something change recently?

impl Triplet {
    // First attempt: No explicit lifetimes
    // Error! The compiler needs information about the lifetimes
    fn mut_one(&mut self) -> &mut int {
        &mut self.one
    }
   // ...
}
@nelsonjchen
Copy link
Author

@mirkonasato
Copy link

Just noticed the same: if you uncomment mut_one() and call it from main() everything works fine using the latest master or 0.12.0. You do get an error with 0.11.0.

@kosciej
Copy link

kosciej commented Oct 25, 2014

I believe that recently lifetime elision was implemented in Rust.
This is the RFC which suggests some of the lifetime annotations unnecessary:
rust-lang/rfcs#141
https://github.com/rust-lang/rfcs/blob/091e5fabbbbd0419b8d291a6d1cd8e6e59c56deb/text/0141-lifetime-elision.md

@abonander
Copy link
Contributor

Related to #195

@steveklabnik
Copy link
Member

This has since been fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants