We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
while let
1 parent 04317e3 commit bcfbb98Copy full SHA for bcfbb98
src/destructors.md
@@ -221,6 +221,7 @@ r[destructors.scope.temporary.edition2024]
221
Some examples:
222
223
```rust
224
+# #![allow(irrefutable_let_patterns)]
225
# struct PrintOnDrop(&'static str);
226
# impl Drop for PrintOnDrop {
227
# fn drop(&mut self) {
@@ -247,6 +248,13 @@ else {
247
248
// `if let else` dropped here
249
};
250
251
+while let x = PrintOnDrop("while let scrutinee").0 {
252
+ PrintOnDrop("while let loop body").0;
253
+ break;
254
+ // `while let loop body` dropped here.
255
+ // `while let scrutinee` dropped here.
256
+}
257
+
258
// Dropped before the first ||
259
(PrintOnDrop("first operand").0 == ""
260
// Dropped before the )
0 commit comments