This website requires JavaScript.
Explore
Help
Register
Sign In
mikros
/
rust
Watch
1
Star
0
Fork
0
You've already forked rust
Code
Issues
Pull Requests
Packages
Projects
Releases
Wiki
Activity
d164ab65f7
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-16 22:28:16 -06:00
#![
allow(unused)
]
fn
foo
<
T
:
Drop
>
(
)
{
}
Fix formatting
2019-02-18 20:36:58 -06: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-16 22:28:16 -06:00
fn
main
(
)
{
}
Reference in New Issue
Copy Permalink