This website requires JavaScript.
Explore
Help
Sign In
OpenE2K
/
rust
Watch
2
Star
0
Fork
0
You've already forked rust
Code
Issues
Pull Requests
Projects
Releases
Wiki
Activity
d71e9c4f10
rust
/
tests
/
ui
/
drop_bounds.rs
9 lines
87 B
Rust
Raw
Normal View
History
Unescape
Escape
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>() {} ```
2019-02-17 05:28:16 +01:00
#![
allow(unused)
]
fn
foo
<
T
:
Drop
>
(
)
{
}
Fix formatting
2019-02-19 03:36:58 +01:00
fn
bar
<
T
>
(
)
where
T
:
Drop
,
{
}
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>() {} ```
2019-02-17 05:28:16 +01:00
fn
main
(
)
{
}
Reference in New Issue
Copy Permalink