diff --git a/tests/ui/trait_duplication_in_bounds_unfixable.rs b/tests/ui/trait_duplication_in_bounds_unfixable.rs index a21d4c5d637d..5630a0345adb 100644 --- a/tests/ui/trait_duplication_in_bounds_unfixable.rs +++ b/tests/ui/trait_duplication_in_bounds_unfixable.rs @@ -95,7 +95,72 @@ trait FooIter: Iterator { } } -// This should not lint +// The below should not lint and exist to guard against false positives fn impl_trait(_: impl AsRef, _: impl AsRef) {} +pub mod one { + #[derive(Clone, Debug)] + struct MultiProductIter + where + I: Iterator + Clone, + I::Item: Clone, + { + _marker: I, + } + + pub struct MultiProduct(Vec>) + where + I: Iterator + Clone, + I::Item: Clone; + + pub fn multi_cartesian_product(_: H) -> MultiProduct<::IntoIter> + where + H: Iterator, + H::Item: IntoIterator, + ::IntoIter: Clone, + ::Item: Clone, + { + todo!() + } +} + +pub mod two { + use std::iter::Peekable; + + pub struct MergeBy + where + I: Iterator, + J: Iterator, + { + _i: Peekable, + _j: Peekable, + _f: F, + } + + impl Clone for MergeBy + where + I: Iterator, + J: Iterator, + std::iter::Peekable: Clone, + std::iter::Peekable: Clone, + F: Clone, + { + fn clone(&self) -> Self { + Self { + _i: self._i.clone(), + _j: self._j.clone(), + _f: self._f.clone(), + } + } + } +} + +pub trait Trait {} + +pub fn f(_a: impl Trait, _b: impl Trait) {} + +pub trait ImplTrait {} + +impl ImplTrait<(A, B)> for Foo where Foo: ImplTrait + ImplTrait {} + fn main() {}