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

Fail to find unique implementation of From #14279

Closed
HKalbasi opened this issue Mar 8, 2023 · 0 comments · Fixed by #14750
Closed

Fail to find unique implementation of From #14279

HKalbasi opened this issue Mar 8, 2023 · 0 comments · Fixed by #14750
Labels
A-ty type system / type inference / traits / method resolution C-bug Category: bug

Comments

@HKalbasi
Copy link
Member

HKalbasi commented Mar 8, 2023

Sorry if it is duplicate. In this code:

fn foo<T>(_: impl From<T>) -> T {
    todo!()
}

struct S;

fn bar() {
    let x = foo(S);
      //^ x is `{unknown}`, but it should be `S`
}

We fail to infer the type of x. It should be S since the only From<S> implementation is the generic impl From<T> for T from the standard library.

@HKalbasi HKalbasi added the C-bug Category: bug label Mar 8, 2023
@lnicola lnicola added the A-ty type system / type inference / traits / method resolution label Mar 8, 2023
@bors bors closed this as completed in bb66f6f May 6, 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

Successfully merging a pull request may close this issue.

2 participants