summaryrefslogtreecommitdiffstats
path: root/src/tools/clippy/src/docs/undropped_manually_drops.txt
blob: 85e3ec56653c9736daa7964a113e7c50879403e9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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));
}
```