1 // test for https://github.com/rust-lang/rust/issues/86940
5 #![warn(rust_2021_prelude_collisions)]
7 #![allow(unused_imports)]
9 struct Generic<T, U>(T, U);
12 fn from_iter(_: i32) -> Self;
15 impl MyFromIter for Generic<i32, i32> {
16 fn from_iter(x: i32) -> Self {
21 impl std::iter::FromIterator<i32> for Generic<i32, i32> {
22 fn from_iter<T: IntoIterator<Item = i32>>(_: T) -> Self {
28 <Generic<_, _> as MyFromIter>::from_iter(1);
29 //~^ WARNING trait-associated function `from_iter` will become ambiguous in Rust 2021
30 //~| this is accepted in the current edition (Rust 2018)
31 <Generic::<i32, i32> as MyFromIter>::from_iter(1);
32 //~^ WARNING trait-associated function `from_iter` will become ambiguous in Rust 2021
33 //~| this is accepted in the current edition (Rust 2018)
34 <Generic::<_, _> as MyFromIter>::from_iter(1);
35 //~^ WARNING trait-associated function `from_iter` will become ambiguous in Rust 2021
36 //~| this is accepted in the current edition (Rust 2018)