Skip to content

Nested projection normalization results in ambiguity #13

Description

@compiler-errors
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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    fundamental-issueSomething that'll need fundamental restructuring or a hack existing at the solver levelneeds-further-investigationNeeds to be root-caused

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions