Skip to content

Commit 10d6b34

Browse files
committed
Add generic types to prelude collision lint test.
1 parent f77dd5a commit 10d6b34

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

src/test/ui/rust-2021/future-prelude-collision-unneeded.rs

+25
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,36 @@ impl Hey for X {
2323
}
2424
}
2525

26+
struct Y<T>(T);
27+
28+
impl Hey for Y<i32> {
29+
fn from_iter(_: i32) -> Self {
30+
Y(0)
31+
}
32+
}
33+
34+
struct Z<T>(T);
35+
36+
impl Hey for Z<i32> {
37+
fn from_iter(_: i32) -> Self {
38+
Z(0)
39+
}
40+
}
41+
42+
impl std::iter::FromIterator<u32> for Z<u32> {
43+
fn from_iter<T: IntoIterator<Item = u32>>(_: T) -> Self {
44+
todo!()
45+
}
46+
}
47+
2648
fn main() {
2749
// See https://github.com/rust-lang/rust/issues/86633
2850
let s = S;
2951
let s2 = s.try_into();
3052

3153
// See https://github.com/rust-lang/rust/issues/86902
3254
X::from_iter(1);
55+
Y::from_iter(1);
56+
Y::<i32>::from_iter(1);
57+
Z::<i32>::from_iter(1);
3358
}

0 commit comments

Comments
 (0)