File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Expand file tree Collapse file tree 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:
209209* The body expression for a match arm.
210210* Each operand of a [ lazy boolean expression] .
211211* The pattern-matching condition(s) and consequent body of [ ` if ` ] ([ destructors.scope.temporary.edition2024] ).
212+ * The pattern-matching condition and loop body of [ ` while ` ] .
212213* The entirety of the tail expression of a block ([ destructors.scope.temporary.edition2024] ).
213214
214215> [ !NOTE]
@@ -221,6 +222,7 @@ r[destructors.scope.temporary.edition2024]
221222Some examples:
222223
223224``` rust
225+ # #![allow(irrefutable_let_patterns)]
224226# struct PrintOnDrop (& 'static str );
225227# impl Drop for PrintOnDrop {
226228# fn drop (& mut self ) {
@@ -247,6 +249,13 @@ else {
247249 // `if let else` dropped here
248250};
249251
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+
250259// Dropped before the first ||
251260(PrintOnDrop (" first operand" ). 0 == ""
252261// Dropped before the )
You can’t perform that action at this time.
0 commit comments