File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -105,12 +105,13 @@ impl<T> ManuallyDrop<T> {
105105// Other common impls such as `Debug for T: Debug`.
106106```
107107
108- Let us apply this union to the example from the motivation:
108+ Let us apply this union to a somewhat expanded example from the motivation:
109109
110110``` rust
111111struct FruitBox {
112112 // Immediately clear there’s something non-trivial going on with these fields.
113113 peach : ManuallyDrop <Peach >,
114+ melon : Melon , // Field that’s independent of the other two.
114115 banana : ManuallyDrop <Banana >,
115116}
116117
@@ -123,6 +124,8 @@ impl Drop for FruitBox {
123124 peach . manually_drop ();
124125 banana . manually_drop ();
125126 }
127+ // After destructor for `FruitBox` runs (this function), the destructor for Melon gets
128+ // invoked in the usual manner, as it is not wrapped in `ManuallyDrop`.
126129 }
127130}
128131```
You can’t perform that action at this time.
0 commit comments