Skip to content

Commit a6d7cc3

Browse files
committed
Fix temporary drop scope for last expression.
The outermost scope is "the entire function", not "the entire function body" which is different.
1 parent 142b2ed commit a6d7cc3

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/destructors.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ temporary variable that holds the result of that expression when used in a
156156
Apart from lifetime extension, the temporary scope of an expression is the
157157
smallest scope that contains the expression and is one of the following:
158158

159-
* The entire function body.
159+
* The entire function.
160160
* A statement.
161161
* The body of an [`if`], [`while`] or [`loop`] expression.
162162
* The `else` block of an `if` expression.
@@ -168,8 +168,8 @@ smallest scope that contains the expression and is one of the following:
168168
> **Notes**:
169169
>
170170
> Temporaries that are created in the final expression of a function
171-
> body are dropped *after* any named variables bound in the function body, as
172-
> there is no smaller enclosing temporary scope.
171+
> body are dropped *after* any named variables bound in the function body.
172+
> Their drop scope is the entire function, as there is no smaller enclosing temporary scope.
173173
>
174174
> The [scrutinee] of a `match` expression is not a temporary scope, so
175175
> temporaries in the scrutinee can be dropped after the `match` expression. For

0 commit comments

Comments
 (0)