]> git.lizzy.rs Git - rust.git/commitdiff
Add extra test cases from #8771, #8757, #9076.
authorAllen Hsu <allen@thelookoutway.com>
Wed, 13 Jul 2022 11:39:52 +0000 (21:39 +1000)
committerAllen Hsu <allen.hsusp+git@gmail.com>
Tue, 2 Aug 2022 12:00:04 +0000 (22:00 +1000)
tests/ui/trait_duplication_in_bounds_unfixable.rs

index a21d4c5d637daec8678ce052656d1d86bff631aa..5630a0345adb1278492d6f44e2c3b8923df9fbaa 100644 (file)
@@ -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<str>, _: impl AsRef<str>) {}
 
+pub mod one {
+    #[derive(Clone, Debug)]
+    struct MultiProductIter<I>
+    where
+        I: Iterator + Clone,
+        I::Item: Clone,
+    {
+        _marker: I,
+    }
+
+    pub struct MultiProduct<I>(Vec<MultiProductIter<I>>)
+    where
+        I: Iterator + Clone,
+        I::Item: Clone;
+
+    pub fn multi_cartesian_product<H>(_: H) -> MultiProduct<<H::Item as IntoIterator>::IntoIter>
+    where
+        H: Iterator,
+        H::Item: IntoIterator,
+        <H::Item as IntoIterator>::IntoIter: Clone,
+        <H::Item as IntoIterator>::Item: Clone,
+    {
+        todo!()
+    }
+}
+
+pub mod two {
+    use std::iter::Peekable;
+
+    pub struct MergeBy<I, J, F>
+    where
+        I: Iterator,
+        J: Iterator<Item = I::Item>,
+    {
+        _i: Peekable<I>,
+        _j: Peekable<J>,
+        _f: F,
+    }
+
+    impl<I, J, F> Clone for MergeBy<I, J, F>
+    where
+        I: Iterator,
+        J: Iterator<Item = I::Item>,
+        std::iter::Peekable<I>: Clone,
+        std::iter::Peekable<J>: 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<T> {}
+
+impl<A, B> ImplTrait<(A, B)> for Foo where Foo: ImplTrait<A> + ImplTrait<B> {}
+
 fn main() {}