rust/library/core/src/mem
ecstatic-morse 4f3697b4b8
Rollup merge of #76150 - matklad:droporder, r=withoutboats
Don't recommend ManuallyDrop to customize drop order

See
https://internals.rust-lang.org/t/need-for-controlling-drop-order-of-fields/12914/21
for the discussion.

TL;DR: ManuallyDrop is unsafe and footguny, but you can just ask the compiler to do all the work for you by re-ordering declarations.

Specifically, the original example from the docs is much better written as

```rust
struct Peach;
struct Banana;
struct Melon;
struct FruitBox {
    melon: Melon,
    // XXX: mind the relative drop order of the fields below
    peach: Peach,
    banana: Banana,
}
```
2020-09-21 20:40:41 -07:00
..
manually_drop.rs Don't recommend ManuallyDrop to customize drop order 2020-09-21 14:00:04 +02:00
maybe_uninit.rs Rollup merge of #76527 - fusion-engineering-forks:cleanup-uninit, r=jonas-schievink 2020-09-13 20:21:09 +02:00
mod.rs Use intra-doc links in core::mem 2020-09-14 15:14:21 -07:00