Skip to content

Commit cab8ca9

Browse files
authored
Merge pull request #3636 from m-ou-se/3606-diagram
Add diagram back to RFC 3606.
2 parents 55a275c + db5aeba commit cab8ca9

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

text/3606-temporary-lifetimes-in-tail-expressions.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@
99

1010
In the next edition, drop temporaries in tail expressions *before* dropping locals, rather than after.
1111

12+
![A diagram showing a function with one let statement "let x = g();" and a tail expression "temp().h()"
13+
and a visualisation of how long x and temp live before and after this change.
14+
Before: x is created first, then temp is created, then x is dropped, then temp is dropped.
15+
After: x is created first, then temp is created, then temp is dropped, then x is dropped.
16+
](3606-temporary-lifetimes-in-tail-expressions/diagram.svg)
17+
1218
# Motivation
1319

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

text/3606-temporary-lifetimes-in-tail-expressions/diagram.svg

Lines changed: 4 additions & 0 deletions
Loading

0 commit comments

Comments
 (0)