diff options
| author | bors <bors@rust-lang.org> | 2020-10-25 09:37:09 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2020-10-25 09:37:09 +0000 |
| commit | 6b01c39e644dbe8b358e6c02a51169aa1fbef561 (patch) | |
| tree | 7ade4d91a610dfd1e6f2ef5e9b894750993c1e03 /compiler/rustc_mir/src/transform/coverage/counters.rs | |
| parent | e0e617adaa89c759beccf74bc0f9eafaed44de22 (diff) | |
| parent | e70817e712fd4d4e930ead0d587031e2b4a97a2e (diff) | |
| download | rust-6b01c39e644dbe8b358e6c02a51169aa1fbef561.tar.gz rust-6b01c39e644dbe8b358e6c02a51169aa1fbef561.zip | |
Auto merge of #6181 - cgm616:undropped-manually-drops, r=flip1995
Add new lint for undropped ManuallyDrop values
Adds a new lint for the following code:
```rust
struct S;
impl Drop for S {
fn drop(&mut self) {
println!("drip drop");
}
}
fn main() {
// This will not drop the `S`!!!
drop(std::mem::ManuallyDrop::new(S));
unsafe {
// This will.
std::mem::ManuallyDrop::drop(&mut std::mem::ManuallyDrop::new(S));
}
}
```
The inner value of a `ManuallyDrop` will not be dropped unless the proper, unsafe drop function is called on it. This lint makes sure that a user does not accidently use the wrong function and forget to drop a `ManuallyDrop` value.
Fixes #5581.
---
*Please keep the line below*
changelog: none
Diffstat (limited to 'compiler/rustc_mir/src/transform/coverage/counters.rs')
0 files changed, 0 insertions, 0 deletions
