Prepare RFC 3606 to be merged

The FCP has completed on RFC 3606, so let's prepare it to be merged.

First, we'll shorten the name of the feature flag a bit; this should
still be unambiguous.

Second, we're going to remove the graphic from the summary.  While it
may be illustrative, the text and the other examples seem clear enough
without it, and its benefits have to be weighed against the fact that
we want the content in this repository to be easily editable and
freestanding.  Pulling in an SVG file from an outside host pulls
against that.  If we come to think the graphic is critical, we could
always add it back in a separate PR that would add an editable version
of this SVG file into the repository itself.

Third, let's make the H1 title of the document a bit more clear.
This commit is contained in:
Travis Cross 2024-05-06 01:21:23 +00:00
parent 9053ae4311
commit 929c584a28
1 changed files with 3 additions and 9 deletions

View File

@ -1,20 +1,14 @@
# Temporary lifetimes in tail expressions
# Shorter temporary lifetimes in tail expressions
- Feature Name: `tail_temporaries_shorter_lifetime`
- Feature Name: `shorter_tail_lifetimes`
- Start Date: 2023-05-04
- RFC PR: [rust-lang/rfcs#3606](https://github.com/rust-lang/rfcs/pull/3606)
- Rust Issue: [rust-lang/rust#123739](https://github.com/rust-lang/rust/issues/123739)
- Tracking Issue: [rust-lang/rust#123739](https://github.com/rust-lang/rust/issues/123739)
# Summary
In the next edition, drop temporaries in tail expressions *before* dropping locals, rather than after.
![A diagram showing a function with one let statement "let x = g();" and a tail expression "temp().h()"
and a visualisation of how long x and temp live before and after this change.
Before: x is created first, then temp is created, then x is dropped, then temp is dropped.
After: x is created first, then temp is created, then temp is dropped, then x is dropped.
](https://hackmd.io/_uploads/HyVB0FtkA.svg)
# Motivation
Temporaries in the tail expression in a block live longer than the block itself,