Skip to content

Commit

Permalink
Add generic types to prelude collision lint test.
Browse files Browse the repository at this point in the history
  • Loading branch information
m-ou-se committed Jul 7, 2021
1 parent f77dd5a commit 10d6b34
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions src/test/ui/rust-2021/future-prelude-collision-unneeded.rs
Expand Up @@ -23,11 +23,36 @@ impl Hey for X {
}
}

struct Y<T>(T);

impl Hey for Y<i32> {
fn from_iter(_: i32) -> Self {
Y(0)
}
}

struct Z<T>(T);

impl Hey for Z<i32> {
fn from_iter(_: i32) -> Self {
Z(0)
}
}

impl std::iter::FromIterator<u32> for Z<u32> {
fn from_iter<T: IntoIterator<Item = u32>>(_: T) -> Self {
todo!()
}
}

fn main() {
// See https://github.com/rust-lang/rust/issues/86633
let s = S;
let s2 = s.try_into();

// See https://github.com/rust-lang/rust/issues/86902
X::from_iter(1);
Y::from_iter(1);
Y::<i32>::from_iter(1);
Z::<i32>::from_iter(1);
}

0 comments on commit 10d6b34

Please sign in to comment.