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

Type inference breaks when using multiple associated types with the same bound. #14804

Closed
LouisGariepy opened this issue May 14, 2023 · 1 comment
Labels
A-ty type system / type inference / traits / method resolution C-bug Category: bug

Comments

@LouisGariepy
Copy link

Feel free to change the title, I don't know enough about RA to actually pin point a better title.

rust-analyzer version: v0.4.1510

rustc version: 1.69.0

MRE

pub trait Foo {
    type A: IntoIterator<Item = u8>;

    type B: IntoIterator<Item = u8>;

    fn baz() {
        let _ = [1, 2, 3].into_iter().map(|_| 3);
    }
}

The into_iter method doesn't resolve.

Removing one (or both) of the two associated types, or changing one (or both) of the bounds makes inference work correctly.

What I expected to happen

I expected the .into_iter() method to resolve correctly.

What actually happens

.into_iter() doesn't resolve correctly, which causes subsequent interactions with the resulting value to also be unresolved.

Screenshot from 2023-05-13 22-49-30

@LouisGariepy LouisGariepy added the C-bug Category: bug label May 14, 2023
@Veykril Veykril added the A-ty type system / type inference / traits / method resolution label May 14, 2023
@lowr
Copy link
Contributor

lowr commented May 14, 2023

This is a duplicate of #10653 (it's actually a longstanding issue that needs to be solved in upstream library: rust-lang/chalk#750). Closing, thanks for the report though!

@lowr lowr closed this as not planned Won't fix, can't repro, duplicate, stale May 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-ty type system / type inference / traits / method resolution C-bug Category: bug
Projects
None yet
Development

No branches or pull requests

3 participants