Skip to content

Commit

Permalink
Merge pull request #3636 from m-ou-se/3606-diagram
Browse files Browse the repository at this point in the history
Add diagram back to RFC 3606.
  • Loading branch information
m-ou-se authored May 14, 2024
2 parents 55a275c + db5aeba commit cab8ca9
Show file tree
Hide file tree
Showing 2 changed files with 10 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.
](3606-temporary-lifetimes-in-tail-expressions/diagram.svg)

# Motivation

Temporaries in the tail expression in a block live longer than the block itself,
Expand Down
4 changes: 4 additions & 0 deletions text/3606-temporary-lifetimes-in-tail-expressions/diagram.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit cab8ca9

Please sign in to comment.