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

Reason for using generics in lifelines isn't clear #154

Closed
mdinger opened this issue Jul 2, 2014 · 0 comments
Closed

Reason for using generics in lifelines isn't clear #154

mdinger opened this issue Jul 2, 2014 · 0 comments

Comments

@mdinger
Copy link
Contributor

mdinger commented Jul 2, 2014

In Lifetimes/Functions, the example:

struct Triplet { one: int, two: int, three: int }
impl Triplet {
    // Fails
    fn mut_one(&mut self) -> &mut int { &mut self.one }
    // Fails
    fn mut_two<'s, 'f>(&'s mut self) -> &'f mut int { &mut self.two }
    // Works
    fn mut_three<'s>(&'s mut self) -> &'s mut int { &mut self.three }
}

You switch fromfn mut(...) to fn mut<...>(...) without explanation. Triplet isn't generic so it isn't clear why the lifelines should need to be generic. Removing <...> definitely fails but it's not clear why.

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

2 participants