Skip to content

Commit

Permalink
Prepare RFC 3606 to be merged
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
traviscross committed May 6, 2024
1 parent 9053ae4 commit 929c584
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions text/3606-temporary-lifetimes-in-tail-expressions.md
Original file line number Diff line number Diff line change
@@ -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,
Expand Down

2 comments on commit 929c584

@m-ou-se
Copy link
Member

@m-ou-se m-ou-se commented on 929c584 May 13, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@traviscross Why did you remove the diagram? :/

I was showing the RFC to someone just now and was surprised the diagram was just.. gone? That's the best summary of the RFC, so please don't remove that without checking first.

If hosting it externally is an issue then that's easily solvable..

diagram

@m-ou-se
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.