This website requires JavaScript.
Explore
Help
Sign In
nordic-dev.net
/
rust
Watch
2
Star
0
Fork
0
You've already forked rust
mirror of
https://github.com/rust-lang/rust.git
synced
2024-11-28 09:44:08 +00:00
Code
Issues
Packages
Projects
Releases
Wiki
Activity
6d9ee9e5eb
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 04:28:16 +00:00
#![
allow(unused)
]
fn
foo
<
T
:
Drop
>
(
)
{
}
Fix formatting
2019-02-19 02:36:58 +00: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 04:28:16 +00:00
fn
main
(
)
{
}
Reference in New Issue
Copy Permalink