Skip to content

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

@nelsonjchen

Description

@nelsonjchen

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
    }
   // ...
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions