2020-08-11 13:43:21 +00:00
|
|
|
#![deny(clippy::trait_duplication_in_bounds)]
|
2022-07-18 07:39:37 +00:00
|
|
|
#![allow(unused)]
|
2020-08-11 13:43:21 +00:00
|
|
|
|
2023-05-20 13:39:26 +00:00
|
|
|
use std::any::Any;
|
|
|
|
|
2022-08-31 13:24:45 +00:00
|
|
|
fn bad_foo<T: Clone + Clone + Clone + Copy, U: Clone + Copy>(arg0: T, argo1: U) {
|
|
|
|
unimplemented!();
|
|
|
|
}
|
2020-08-11 13:43:21 +00:00
|
|
|
|
2022-08-31 13:24:45 +00:00
|
|
|
fn bad_bar<T, U>(arg0: T, arg1: U)
|
2020-08-11 13:43:21 +00:00
|
|
|
where
|
2022-08-31 13:24:45 +00:00
|
|
|
T: Clone + Clone + Clone + Copy,
|
|
|
|
U: Clone + Copy,
|
2020-08-11 13:43:21 +00:00
|
|
|
{
|
|
|
|
unimplemented!();
|
|
|
|
}
|
|
|
|
|
2022-08-31 13:24:45 +00:00
|
|
|
fn good_bar<T: Clone + Copy, U: Clone + Copy>(arg0: T, arg1: U) {
|
2020-08-11 13:43:21 +00:00
|
|
|
unimplemented!();
|
|
|
|
}
|
|
|
|
|
2022-08-31 13:24:45 +00:00
|
|
|
fn good_foo<T, U>(arg0: T, arg1: U)
|
2020-08-11 13:43:21 +00:00
|
|
|
where
|
2022-08-31 13:24:45 +00:00
|
|
|
T: Clone + Copy,
|
|
|
|
U: Clone + Copy,
|
2020-08-11 13:43:21 +00:00
|
|
|
{
|
|
|
|
unimplemented!();
|
|
|
|
}
|
|
|
|
|
2022-08-31 13:24:45 +00:00
|
|
|
trait GoodSelfTraitBound: Clone + Copy {
|
|
|
|
fn f();
|
2020-08-11 13:43:21 +00:00
|
|
|
}
|
|
|
|
|
2022-08-31 13:24:45 +00:00
|
|
|
trait GoodSelfWhereClause {
|
2022-01-13 12:18:19 +00:00
|
|
|
fn f()
|
|
|
|
where
|
2022-08-31 13:24:45 +00:00
|
|
|
Self: Clone + Copy;
|
2022-01-13 12:18:19 +00:00
|
|
|
}
|
|
|
|
|
2022-08-31 13:24:45 +00:00
|
|
|
trait BadSelfTraitBound: Clone + Clone + Clone {
|
|
|
|
fn f();
|
|
|
|
}
|
|
|
|
|
|
|
|
trait BadSelfWhereClause {
|
2022-01-13 12:18:19 +00:00
|
|
|
fn f()
|
|
|
|
where
|
2022-08-31 13:24:45 +00:00
|
|
|
Self: Clone + Clone + Clone;
|
|
|
|
}
|
|
|
|
|
|
|
|
trait GoodTraitBound<T: Clone + Copy, U: Clone + Copy> {
|
|
|
|
fn f();
|
2022-01-13 12:18:19 +00:00
|
|
|
}
|
|
|
|
|
2022-08-31 13:24:45 +00:00
|
|
|
trait GoodWhereClause<T, U> {
|
2022-01-13 12:18:19 +00:00
|
|
|
fn f()
|
|
|
|
where
|
2022-08-31 13:24:45 +00:00
|
|
|
T: Clone + Copy,
|
|
|
|
U: Clone + Copy;
|
2022-01-13 12:18:19 +00:00
|
|
|
}
|
|
|
|
|
2022-08-31 13:24:45 +00:00
|
|
|
trait BadTraitBound<T: Clone + Clone + Clone + Copy, U: Clone + Copy> {
|
|
|
|
fn f();
|
|
|
|
}
|
|
|
|
|
|
|
|
trait BadWhereClause<T, U> {
|
2022-01-13 12:18:19 +00:00
|
|
|
fn f()
|
|
|
|
where
|
2022-08-31 13:24:45 +00:00
|
|
|
T: Clone + Clone + Clone + Copy,
|
|
|
|
U: Clone + Copy;
|
2022-01-13 12:18:19 +00:00
|
|
|
}
|
|
|
|
|
2022-08-31 13:24:45 +00:00
|
|
|
struct GoodStructBound<T: Clone + Copy, U: Clone + Copy> {
|
|
|
|
t: T,
|
|
|
|
u: U,
|
|
|
|
}
|
2022-01-13 12:18:19 +00:00
|
|
|
|
2022-08-31 13:24:45 +00:00
|
|
|
impl<T: Clone + Copy, U: Clone + Copy> GoodTraitBound<T, U> for GoodStructBound<T, U> {
|
2022-01-13 12:18:19 +00:00
|
|
|
// this should not warn
|
|
|
|
fn f() {}
|
|
|
|
}
|
|
|
|
|
2022-08-31 13:24:45 +00:00
|
|
|
struct GoodStructWhereClause;
|
|
|
|
|
|
|
|
impl<T, U> GoodTraitBound<T, U> for GoodStructWhereClause
|
|
|
|
where
|
|
|
|
T: Clone + Copy,
|
|
|
|
U: Clone + Copy,
|
|
|
|
{
|
2022-01-13 12:18:19 +00:00
|
|
|
// this should not warn
|
|
|
|
fn f() {}
|
|
|
|
}
|
|
|
|
|
2022-08-31 13:24:45 +00:00
|
|
|
fn no_error_separate_arg_bounds(program: impl AsRef<()>, dir: impl AsRef<()>, args: &[impl AsRef<()>]) {}
|
2022-01-27 14:12:45 +00:00
|
|
|
|
2022-08-31 13:24:45 +00:00
|
|
|
trait GenericTrait<T> {}
|
2022-01-27 14:12:45 +00:00
|
|
|
|
2022-08-31 13:24:45 +00:00
|
|
|
fn good_generic<T: GenericTrait<u64> + GenericTrait<u32>>(arg0: T) {
|
|
|
|
unimplemented!();
|
2022-01-27 14:12:45 +00:00
|
|
|
}
|
|
|
|
|
2022-08-31 13:24:45 +00:00
|
|
|
fn bad_generic<T: GenericTrait<u64> + GenericTrait<u32> + GenericTrait<u64>>(arg0: T) {
|
|
|
|
unimplemented!();
|
|
|
|
}
|
2022-07-18 07:39:37 +00:00
|
|
|
|
2022-08-31 13:24:45 +00:00
|
|
|
mod foo {
|
|
|
|
pub trait Clone {}
|
|
|
|
}
|
2022-07-18 07:39:37 +00:00
|
|
|
|
2022-08-31 13:24:45 +00:00
|
|
|
fn qualified_path<T: std::clone::Clone + Clone + foo::Clone>(arg0: T) {
|
|
|
|
unimplemented!();
|
2022-07-18 07:39:37 +00:00
|
|
|
}
|
|
|
|
|
2023-05-20 13:39:26 +00:00
|
|
|
fn good_trait_object(arg0: &(dyn Any + Send)) {
|
|
|
|
unimplemented!();
|
|
|
|
}
|
|
|
|
|
|
|
|
fn bad_trait_object(arg0: &(dyn Any + Send + Send)) {
|
|
|
|
unimplemented!();
|
|
|
|
}
|
|
|
|
|
2020-08-11 13:43:21 +00:00
|
|
|
fn main() {}
|