Skip to content

Incorrect inherent method resolution with multiple impls #9938

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
jonas-schievink opened this issue Aug 17, 2021 · 1 comment
Closed

Incorrect inherent method resolution with multiple impls #9938

jonas-schievink opened this issue Aug 17, 2021 · 1 comment
Labels
A-ty type system / type inference / traits / method resolution S-actionable Someone could pick this issue up and work on it right now

Comments

@jonas-schievink
Copy link
Contributor

struct S<T>(T);

trait Tr {}

impl<T: Tr> S<T> {
    fn call(&self, arg: u8) {}
}

impl S<()> {
    fn call(&self) {}
}

fn main() {
    S(()).call();
}

This gets a false-positive mismatched-arg-count diagnostic, because we choose the first impl block (despite the missing (): Tr impl), while the second one is actually correct.

This causes issues when using wasmer or wasm3, since they expose function handles with impls like these.

@jonas-schievink jonas-schievink added A-ty type system / type inference / traits / method resolution S-actionable Someone could pick this issue up and work on it right now labels Aug 17, 2021
@lowr
Copy link
Contributor

lowr commented Oct 29, 2022

This is another case of #5441. Closing as it's been fixed 😄

@lowr lowr closed this as completed Oct 29, 2022
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 S-actionable Someone could pick this issue up and work on it right now
Projects
None yet
Development

No branches or pull requests

2 participants