Skip to content

Commit 663b0fb

Browse files
committed
Update partially initialized values in drop documentation.
1 parent 1528956 commit 663b0fb

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/destructors.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,11 @@ loop {
6363
moved = ShowOnDrop("Drops when moved");
6464
// drops now, but is then uninitialized
6565
moved;
66+
// Uninitialized does not drop.
6667
let uninitialized: ShowOnDrop;
6768
// Only first element drops
68-
let mut partially_initialized: (ShowOnDrop, ShowOnDrop);
69-
partially_initialized.0 = ShowOnDrop("Partial tuple first");
69+
let mut partially_initialized = (ShowOnDrop("one"), ShowOnDrop("two"));
70+
core::mem::forget(partially_initialized.1);
7071
}
7172
```
7273

0 commit comments

Comments
 (0)