Skip to content

Commit 36df983

Browse files
committed
Add diagram back to RFC 3606.
1 parent 55a275c commit 36df983

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-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+
](https://github.com/rust-lang/rfcs/assets/783247/07adb0c3-af0a-4761-a696-9bddd0b75c62)
17+
1218
# Motivation
1319

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

0 commit comments

Comments
 (0)