Skip to content

The Ownership guide does not clearly explain what happens when there are two or more elided lifetimes #21284

@snowe2010

Description

@snowe2010

Reading over the Ownership section in TRPL and came across the example

fn frob(s: &str, t: &str) -> &str;  // ILLEGAL, two inputs

As a newbie, this was very confusing. I believe the situation could be explained by simply adding another line.

fn frob(s: &str, t: &str) -> &str;  // ILLEGAL, two inputs
fn frob(s: &'a str, t: &'b str) -> &'? str; // Expanded: Output lifetime is unclear

I'm not sure if this is the best way to do this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions