Skip to content

Commit

Permalink
Update partially initialized values in drop documentation.
Browse files Browse the repository at this point in the history
  • Loading branch information
ehuss committed Aug 6, 2019
1 parent 1528956 commit 663b0fb
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/destructors.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,11 @@ loop {
moved = ShowOnDrop("Drops when moved");
// drops now, but is then uninitialized
moved;
// Uninitialized does not drop.
let uninitialized: ShowOnDrop;
// Only first element drops
let mut partially_initialized: (ShowOnDrop, ShowOnDrop);
partially_initialized.0 = ShowOnDrop("Partial tuple first");
let mut partially_initialized = (ShowOnDrop("one"), ShowOnDrop("two"));
core::mem::forget(partially_initialized.1);
}
```

Expand Down

0 comments on commit 663b0fb

Please sign in to comment.