Skip to content

Commit 4eddade

Browse files
committed
Rework 2024 temporary edition differences
The style of the reference is to document the latest edition in the main body of the text, and any differences in a separate block. As a compromise, I included links to the edition description.
1 parent dbc9380 commit 4eddade

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/destructors.md

+5-2
Original file line numberDiff line numberDiff line change
@@ -211,8 +211,8 @@ smallest scope that contains the expression and is one of the following:
211211
guard.
212212
* The body expression for a match arm.
213213
* Each operand of a [lazy boolean expression].
214-
* *Starting from Edition 2024* the pattern-matching condition and consequent body of [`if let`].
215-
* *Starting from Edition 2024* the entirety of the tail expression of a block.
214+
* The pattern-matching condition and consequent body of [`if let`] ([destructors.scope.temporary.edition2024]).
215+
* The entirety of the tail expression of a block ([destructors.scope.temporary.edition2024]).
216216

217217
> **Notes**:
218218
>
@@ -221,6 +221,9 @@ smallest scope that contains the expression and is one of the following:
221221
> example, the temporary for `1` in `match 1 { ref mut z => z };` lives until
222222
> the end of the statement.
223223
224+
r[destructors.scope.temporary.edition2024]
225+
> **Edition differences**: The 2024 edition added two new temporary scope narrowing rules: `if let` temporaries are dropped before the `else` block, and temporaries of tail expressions of blocks are dropped immediately after the tail expression is evaluated.
226+
224227
Some examples:
225228

226229
```rust

0 commit comments

Comments
 (0)