Closed
Description
fn needs_iter(_: impl Iterator<Item = i32>) {}
fn main() {
needs_iter(IntoIterator::into_iter([0i32; 32]))
}
error[E0284]: type annotations needed: cannot satisfy `<<[i32; 32] as IntoIterator>::IntoIter as Iterator>::Item == i32`
--> <source>:4:16
|
4 | needs_iter(IntoIterator::into_iter([0i32; 32]))
| ---------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot satisfy `<<[i32; 32] as IntoIterator>::IntoIter as Iterator>::Item == i32`
| |
| required by a bound introduced by this call
|
note: required by a bound in `needs_iter`
--> <source>:1:32
|
1 | fn needs_iter(_: impl Iterator<Item = i32>) {}
| ^^^^^^^^^^ required by this bound in `needs_iter`
This may be due to us assembling two candidates -- one via the alias bound for IntoIter
and one via the normalized self type <[i32; 32] as IntoIterator>::IntoIter
which is std::array::IntoIter<i32, 32>
...
I'm surprised we're not combining these because they should have the same constraints -- none at all.