Skip to content

Omitting an lifetime name in the return value of an function should be always forbidden. #9466

Closed
@Kimundi

Description

@Kimundi

Right now any function signature of the form

fn foo(...) -> &Bar

is valid, but only if the thing returned has the static lifetime.

I think it would be less confusing if we would just always forbid that, requiring to write out the 'static explicitly in those cases:

fn foo(...) -> &'static Bar

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