Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ambiguity for projection candidates that aren't equal, but *are* equal modulo normalization #4

Open
compiler-errors opened this issue Apr 13, 2023 · 5 comments · Fixed by rust-lang/rust#119106

Comments

@compiler-errors
Copy link
Member

compiler-errors commented Apr 13, 2023

edit: after rust-lang/rust#119106 this only affects higher ranked aliases and should not be an issue in practice

fn needs_iter(_: impl Iterator<Item = i32>) {}

fn main() {
    needs_iter(IntoIterator::into_iter([0i32; 32]))
}

Bails out with two ambiguous candidates:

Candidate { source: Impl(DefId(2:3663 ~ core[523c]::array::iter::{impl#2})), result: Canonical { value: Response { certainty: Yes, var_values: CanonicalVarValues { var_values: [i32] }, external_constraints: ExternalConstraints(Interned(ExternalConstraintsData { region_constraints: QueryRegionConstraints { outlives: [], member_constraints: [] }, opaque_types: [] }, PrivateZst)) }, max_universe: U0, variables: [] } },
  Candidate { source: AliasBound, result: Canonical { value: Response { certainty: Yes, var_values: CanonicalVarValues { var_values: [<[i32; 32] as std::iter::IntoIterator>::Item] }, external_constraints: ExternalConstraints(Interned(ExternalConstraintsData { region_constraints: QueryRegionConstraints { outlives: [], member_constraints: [] }, opaque_types: [] }, PrivateZst)) }, max_universe: U0, variables: [] } }]

That is, we have that <[i32; 32] as IntoIterator>::Item normalizes to either i32 or <[i32; 32] as std::iter::IntoIterator>::Item via an impl or alias bound, respectively.

@compiler-errors
Copy link
Member Author

This is no longer ambiguous because we only assemble alias-bound candidates for rigid aliases.

@compiler-errors
Copy link
Member Author

Actually maybe I'll open this back up because I didn't see the edit note above.

@compiler-errors
Copy link
Member Author

cc @jdno your repo syncs will close random cross-org issues

@jdno
Copy link
Member

jdno commented Mar 5, 2024

What the... 😳 Thanks for letting me know. I'll look into this.

@compiler-errors
Copy link
Member Author

possibly because you've got owner permission for all the repos via t-infra?

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

Successfully merging a pull request may close this issue.

3 participants