We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 663b0fb commit a5b0281Copy full SHA for a5b0281
src/destructors.md
@@ -63,11 +63,15 @@ loop {
63
moved = ShowOnDrop("Drops when moved");
64
// drops now, but is then uninitialized
65
moved;
66
+
67
// Uninitialized does not drop.
68
let uninitialized: ShowOnDrop;
- // Only first element drops
69
- let mut partially_initialized = (ShowOnDrop("one"), ShowOnDrop("two"));
70
- core::mem::forget(partially_initialized.1);
+ // After a partial move, only the remaining fields are dropped.
71
+ let mut partial_move = (ShowOnDrop("first"), ShowOnDrop("forgotten"));
72
+ // Perform a partial move, leaving only `partial_move.0` initialized.
73
+ core::mem::forget(partial_move.1);
74
+ // When partial_move's scope ends, only the first field is dropped.
75
}
76
```
77
0 commit comments