|
1 | 1 | # Destructors
|
2 | 2 |
|
3 | 3 | When an [initialized] [variable] or [temporary] goes out of
|
4 |
| -[scope](#drop-scopes) its *destructor* is run, or it is *dropped*. [Assignment] |
| 4 | +[scope](#drop-scopes), its *destructor* is run, or it is *dropped*. [Assignment] |
5 | 5 | also runs the destructor of its left-hand operand, if it's initialized. If a
|
6 | 6 | variable has been partially initialized, only its initialized fields are
|
7 | 7 | dropped.
|
@@ -154,7 +154,7 @@ temporary variable that holds the result of that expression when used in a
|
154 | 154 | [place context], unless it is [promoted].
|
155 | 155 |
|
156 | 156 | Apart from lifetime extension, the temporary scope of an expression is the
|
157 |
| -smallest scope that contains the expression and is for one of the following: |
| 157 | +smallest scope that contains the expression and is one of the following: |
158 | 158 |
|
159 | 159 | * The entire function body.
|
160 | 160 | * A statement.
|
@@ -246,7 +246,8 @@ loop {
|
246 | 246 | ### Constant promotion
|
247 | 247 |
|
248 | 248 | Promotion of a value expression to a `'static` slot occurs when the expression
|
249 |
| -could be written in a constant, borrowed, and dereferencing that borrow where |
| 249 | +could be written in a constant and borrowed, and that borrow could be dereferenced |
| 250 | +where |
250 | 251 | the expression was originally written, without changing the runtime behavior.
|
251 | 252 | That is, the promoted expression can be evaluated at compile-time and the
|
252 | 253 | resulting value does not contain [interior mutability] or [destructors] (these
|
|
0 commit comments