dropck: track order of destruction for r-value temporaries · Issue #22323 · rust-lang/rust (original) (raw)

Skip to content

Provide feedback

Saved searches

Use saved searches to filter your results more quickly

Sign up

Appearance settings

@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)