diff options
Diffstat (limited to 'src/tools/clippy/src/docs/undropped_manually_drops.txt')
-rw-r--r-- | src/tools/clippy/src/docs/undropped_manually_drops.txt | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/tools/clippy/src/docs/undropped_manually_drops.txt b/src/tools/clippy/src/docs/undropped_manually_drops.txt new file mode 100644 index 000000000..85e3ec566 --- /dev/null +++ b/src/tools/clippy/src/docs/undropped_manually_drops.txt @@ -0,0 +1,22 @@ +### What it does +Prevents the safe `std::mem::drop` function from being called on `std::mem::ManuallyDrop`. + +### Why is this bad? +The safe `drop` function does not drop the inner value of a `ManuallyDrop`. + +### Known problems +Does not catch cases if the user binds `std::mem::drop` +to a different name and calls it that way. + +### Example +``` +struct S; +drop(std::mem::ManuallyDrop::new(S)); +``` +Use instead: +``` +struct S; +unsafe { + std::mem::ManuallyDrop::drop(&mut std::mem::ManuallyDrop::new(S)); +} +```
\ No newline at end of file |