]> git.lizzy.rs Git - rust.git/blob - src/tools/clippy/src/docs/undropped_manually_drops.txt
Rollup merge of #101413 - nicholasbishop:bishop-remove-uefi-static-reloc, r=petrochenkov
[rust.git] / src / tools / clippy / src / docs / undropped_manually_drops.txt
1 ### What it does
2 Prevents the safe `std::mem::drop` function from being called on `std::mem::ManuallyDrop`.
3
4 ### Why is this bad?
5 The safe `drop` function does not drop the inner value of a `ManuallyDrop`.
6
7 ### Known problems
8 Does not catch cases if the user binds `std::mem::drop`
9 to a different name and calls it that way.
10
11 ### Example
12 ```
13 struct S;
14 drop(std::mem::ManuallyDrop::new(S));
15 ```
16 Use instead:
17 ```
18 struct S;
19 unsafe {
20     std::mem::ManuallyDrop::drop(&mut std::mem::ManuallyDrop::new(S));
21 }
22 ```