Skip to content

Lifetime of borrowed values should be extended #6721

Closed
@lilyball

Description

@lilyball

When borrowing an owned value, the lifetime of the value should be extended at least to the end of the current statement, and perhaps extended to the full lifetime of the borrow.

Extending the lifetime to the end of the current statement would allow constructs like the following to work:

foo(vec::from_elem(16, 0).slice(0,4));

Extending the lifetime to the full lifetime of the borrow would just be a bit more convenient for the programmer who doesn't care about having an owned pointer, although it may not be worth the complexity.

@nikomatsakis

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