Skip to content

Commit 7f2797a

Browse files
committed
Add extra test cases from #8771, #8757, #9076.
1 parent 458a11c commit 7f2797a

File tree

1 file changed

+66
-1
lines changed

1 file changed

+66
-1
lines changed

tests/ui/trait_duplication_in_bounds_unfixable.rs

Lines changed: 66 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,72 @@ trait FooIter: Iterator<Item = Foo> {
9595
}
9696
}
9797

98-
// This should not lint
98+
// The below should not lint and exist to guard against false positives
9999
fn impl_trait(_: impl AsRef<str>, _: impl AsRef<str>) {}
100100

101+
pub mod one {
102+
#[derive(Clone, Debug)]
103+
struct MultiProductIter<I>
104+
where
105+
I: Iterator + Clone,
106+
I::Item: Clone,
107+
{
108+
_marker: I,
109+
}
110+
111+
pub struct MultiProduct<I>(Vec<MultiProductIter<I>>)
112+
where
113+
I: Iterator + Clone,
114+
I::Item: Clone;
115+
116+
pub fn multi_cartesian_product<H>(_: H) -> MultiProduct<<H::Item as IntoIterator>::IntoIter>
117+
where
118+
H: Iterator,
119+
H::Item: IntoIterator,
120+
<H::Item as IntoIterator>::IntoIter: Clone,
121+
<H::Item as IntoIterator>::Item: Clone,
122+
{
123+
todo!()
124+
}
125+
}
126+
127+
pub mod two {
128+
use std::iter::Peekable;
129+
130+
pub struct MergeBy<I, J, F>
131+
where
132+
I: Iterator,
133+
J: Iterator<Item = I::Item>,
134+
{
135+
_i: Peekable<I>,
136+
_j: Peekable<J>,
137+
_f: F,
138+
}
139+
140+
impl<I, J, F> Clone for MergeBy<I, J, F>
141+
where
142+
I: Iterator,
143+
J: Iterator<Item = I::Item>,
144+
std::iter::Peekable<I>: Clone,
145+
std::iter::Peekable<J>: Clone,
146+
F: Clone,
147+
{
148+
fn clone(&self) -> Self {
149+
Self {
150+
_i: self._i.clone(),
151+
_j: self._j.clone(),
152+
_f: self._f.clone(),
153+
}
154+
}
155+
}
156+
}
157+
158+
pub trait Trait {}
159+
160+
pub fn f(_a: impl Trait, _b: impl Trait) {}
161+
162+
pub trait ImplTrait<T> {}
163+
164+
impl<A, B> ImplTrait<(A, B)> for Foo where Foo: ImplTrait<A> + ImplTrait<B> {}
165+
101166
fn main() {}

0 commit comments

Comments
 (0)