dropck: track order of destruction for r-value temporaries (original) (raw)

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)