Skip to content

dropck: track order of destruction for r-value temporaries #22323

Closed
@pnkfelix

Description

@pnkfelix

Spawned off of #21022, #21972; see also #21657.

Tracking order of destruction for r-value temporaries would (probably) allow us to resume writing code like this from RFC 769:

for line in old_io::stdin().lock().lines() {
    ...
}

which is currently disallowed because the region inference system does not know that the temporary yielded by stdin() will outlive the temporary from stdin().lock().

(But note that it might also have fallout, potentially worse than that of #21657)

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-NLLArea: Non-lexical lifetimes (NLL)A-lifetimesArea: Lifetimes / regionsC-feature-requestCategory: A feature request, i.e: not implemented / a PR.fixed-by-NLLBugs fixed, but only when NLL is enabled.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions