Skip to content

Commit

Permalink
Auto merge of #111530 - Urgau:uplift_undropped_manually_drops, r=comp…
Browse files Browse the repository at this point in the history
…iler-errors

Uplift `clippy::undropped_manually_drops` lint

This PR aims at uplifting the `clippy::undropped_manually_drops` lint.

## `undropped_manually_drops`

(warn-by-default)

The `undropped_manually_drops` lint check for calls to `std::mem::drop` with a value of `std::mem::ManuallyDrop` which doesn't drop.

### Example

```rust
struct S;
drop(std::mem::ManuallyDrop::new(S));
```

### Explanation

`ManuallyDrop` does not drop it's inner value so calling `std::mem::drop` will not drop the inner value of the `ManuallyDrop` either.

-----

Mostly followed the instructions for uplifting an clippy lint described here: rust-lang/rust#99696 (review)

`@rustbot` label: +I-lang-nominated
r? compiler

-----

For Clippy:

changelog: Moves: Uplifted `clippy::undropped_manually_drops` into rustc
  • Loading branch information
bors committed Jun 9, 2023
2 parents 5a64f27 + 28a73a6 commit 46e7e94
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions core/tests/manually_drop.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![cfg_attr(not(bootstrap), allow(undropped_manually_drops))]

use core::mem::ManuallyDrop;

#[test]
Expand Down

0 comments on commit 46e7e94

Please sign in to comment.