Skip to content

Incorrect mismatched-arg-count for generic types "duplicated" functions #9392

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

Closed
pedromfedricci opened this issue Jun 24, 2021 · 2 comments
Closed
Labels
A-ty type system / type inference / traits / method resolution

Comments

@pedromfedricci
Copy link

A minimal reproduction I could come up with, where the incorrect message shows:

use std::marker::PhantomData;

struct MyStruct<A, B> {
    _pd: PhantomData<*const (A, B)>,
}

trait TraitA {}

impl<A, B> MyStruct<A, B>
where
    A: TraitA,
{
    fn call(&self, _arg: ()) {}
}

impl<B> MyStruct<(), B> {
    fn call(&self) {}
}

fn main() {
    let my_struct: MyStruct<(), ()> = MyStruct { _pd: PhantomData };
    my_struct.call();
}

In main's my_struct.call(), rust-analyzer complains that: expected 1 argument, found 0.
My understanding is that it is only looking at the first call implementation, but my_struct concrete type actually matches the second impl block.
Cargo check and build work fine with the sample.
Not sure how this relates to #8479, if at all, I found it to be considerably different to open a new issue.

rust-analyzer version: 3898387 2021-06-21 stable
ty.

@jonas-schievink jonas-schievink added the A-ty type system / type inference / traits / method resolution label Jun 24, 2021
@pedromfedricci
Copy link
Author

similar to #7856

@pedromfedricci
Copy link
Author

Fixed by #13074, released at 2022-08-22.
Awesome!
ty @lowr

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
Projects
None yet
Development

No branches or pull requests

2 participants