diff options
| author | Michael Howell <michael@notriddle.com> | 2019-02-16 21:28:16 -0700 |
|---|---|---|
| committer | Michael Howell <michael@notriddle.com> | 2019-02-17 22:53:08 -0700 |
| commit | 2df14c370133781f4b5aa31b0168138cba0009b7 (patch) | |
| tree | 97070bbf3da380e6d44bf4ac5abd67a7fc475437 /tests/mir-opt/lower_array_len.array_len_raw.NormalizeArrayLen.diff | |
| parent | a71acac1da7eaf667ab90a1d65d10e5cc4b80191 (diff) | |
| download | rust-2df14c370133781f4b5aa31b0168138cba0009b7.tar.gz rust-2df14c370133781f4b5aa31b0168138cba0009b7.zip | |
Add a lint to warn on `T: Drop` bounds
**What it does:** Checks for generics with `std::ops::Drop` as bounds.
**Why is this bad?** `Drop` bounds do not really accomplish anything.
A type may have compiler-generated drop glue without implementing the
`Drop` trait itself. The `Drop` trait also only has one method,
`Drop::drop`, and that function is by fiat not callable in user code.
So there is really no use case for using `Drop` in trait bounds.
**Known problems:** None.
**Example:**
```rust
fn foo<T: Drop>() {}
```
Diffstat (limited to 'tests/mir-opt/lower_array_len.array_len_raw.NormalizeArrayLen.diff')
0 files changed, 0 insertions, 0 deletions
