From 10d6b34d32e377798868586d2d8e25d972cbeb0d Mon Sep 17 00:00:00 2001 From: Mara Bos Date: Wed, 7 Jul 2021 13:25:48 +0000 Subject: [PATCH] Add generic types to prelude collision lint test. --- .../future-prelude-collision-unneeded.rs | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/src/test/ui/rust-2021/future-prelude-collision-unneeded.rs b/src/test/ui/rust-2021/future-prelude-collision-unneeded.rs index 8b3b7e74a7f..6e207679986 100644 --- a/src/test/ui/rust-2021/future-prelude-collision-unneeded.rs +++ b/src/test/ui/rust-2021/future-prelude-collision-unneeded.rs @@ -23,6 +23,28 @@ fn from_iter(_: i32) -> Self { } } +struct Y(T); + +impl Hey for Y { + fn from_iter(_: i32) -> Self { + Y(0) + } +} + +struct Z(T); + +impl Hey for Z { + fn from_iter(_: i32) -> Self { + Z(0) + } +} + +impl std::iter::FromIterator for Z { + fn from_iter>(_: T) -> Self { + todo!() + } +} + fn main() { // See https://github.com/rust-lang/rust/issues/86633 let s = S; @@ -30,4 +52,7 @@ fn main() { // See https://github.com/rust-lang/rust/issues/86902 X::from_iter(1); + Y::from_iter(1); + Y::::from_iter(1); + Z::::from_iter(1); }