Skip to content

docs: One of lifetime elision examples says "output lifetime is unclear" but not "ILLEGAL" #25915

Closed
@dequis

Description

@dequis

http://doc.rust-lang.org/book/lifetimes.html#examples

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

All other examples say ILLEGAL clearly, and when i read it, it seemed like the expanded version was legal, even though the output lifetime is unclear, which sounded a lot like the kind of "undefined behavior" rust wants to avoid, and that made me feel very uncomfortable.

If this is actually illegal, it would be nice to say it explicitly.

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