Undroppable Types
In Rust, ManuallyDrop
is the tool of choice for eliding the destructor of a value. Wrapped in ManuallyDrop
, a value is simply forgotten when it goes out of scope. However, in some cases, it is useful to ensure that a value cannot be dropped — not because it is forgotten, but because the very act of dropping it is a compilation error.