diff options
| author | ecstatic-morse <ecstaticmorse@gmail.com> | 2020-09-21 20:40:41 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-09-21 20:40:41 -0700 |
| commit | 4f3697b4b87abff222330cab31f9dce53021c100 (patch) | |
| tree | 9f8b55101bd6d60da04c93c6dc6e4f40f2d0d9f0 /src/test/codegen/src-hash-algorithm | |
| parent | dc42aa8cd4418fe012394c6263a093b0333467b9 (diff) | |
| parent | 60b102de06f52102aa6c343de1f1ef31ff08f8df (diff) | |
| download | rust-4f3697b4b87abff222330cab31f9dce53021c100.tar.gz rust-4f3697b4b87abff222330cab31f9dce53021c100.zip | |
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,
}
```
Diffstat (limited to 'src/test/codegen/src-hash-algorithm')
0 files changed, 0 insertions, 0 deletions
