From: Allen Hsu Date: Wed, 13 Jul 2022 11:39:52 +0000 (+1000) Subject: Add extra test cases from #8771, #8757, #9076. X-Git-Url: https://git.lizzy.rs/?a=commitdiff_plain;h=3ddc04f4db1f768f74fe9e21a4ef119c186295a0;p=rust.git Add extra test cases from #8771, #8757, #9076. --- diff --git a/tests/ui/trait_duplication_in_bounds_unfixable.rs b/tests/ui/trait_duplication_in_bounds_unfixable.rs index a21d4c5d637..5630a0345ad 100644 --- a/tests/ui/trait_duplication_in_bounds_unfixable.rs +++ b/tests/ui/trait_duplication_in_bounds_unfixable.rs @@ -95,7 +95,72 @@ fn bar() } } -// 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() {}