Skip to content

Commit

Permalink
Add diagram back to RFC 3606.
Browse files Browse the repository at this point in the history
  • Loading branch information
m-ou-se committed May 14, 2024
1 parent 55a275c commit 36df983
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions text/3606-temporary-lifetimes-in-tail-expressions.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@

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://github.com/rust-lang/rfcs/assets/783247/07adb0c3-af0a-4761-a696-9bddd0b75c62)

# Motivation

Temporaries in the tail expression in a block live longer than the block itself,
Expand Down

0 comments on commit 36df983

Please sign in to comment.