File tree 1 file changed +9
-0
lines changed 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -209,6 +209,7 @@ smallest scope that contains the expression and is one of the following:
209
209
* The body expression for a match arm.
210
210
* Each operand of a [ lazy boolean expression] .
211
211
* The pattern-matching condition(s) and consequent body of [ ` if ` ] ([ destructors.scope.temporary.edition2024] ).
212
+ * The pattern-matching condition and loop body of [ ` while ` ] .
212
213
* The entirety of the tail expression of a block ([ destructors.scope.temporary.edition2024] ).
213
214
214
215
> [ !NOTE]
@@ -221,6 +222,7 @@ r[destructors.scope.temporary.edition2024]
221
222
Some examples:
222
223
223
224
``` rust
225
+ # #![allow(irrefutable_let_patterns)]
224
226
# struct PrintOnDrop (& 'static str );
225
227
# impl Drop for PrintOnDrop {
226
228
# fn drop (& mut self ) {
@@ -247,6 +249,13 @@ else {
247
249
// `if let else` dropped here
248
250
};
249
251
252
+ while let x = PrintOnDrop (" while let scrutinee" ). 0 {
253
+ PrintOnDrop (" while let loop body" ). 0 ;
254
+ break ;
255
+ // `while let loop body` dropped here.
256
+ // `while let scrutinee` dropped here.
257
+ }
258
+
250
259
// Dropped before the first ||
251
260
(PrintOnDrop (" first operand" ). 0 == ""
252
261
// Dropped before the )
You can’t perform that action at this time.
0 commit comments