Skip to content

Fix built-in Fn impls when generics are involved #541

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

Merged
merged 1 commit into from
Jun 23, 2020

Conversation

flodiebold
Copy link
Member

There were two problems:

  • the FnDef impl was using a wrong substitution for the FnDef (calling
    builder.substitution_in_scope(), which wasn't even necessarily the same
    number of parameters -- not sure what the intention was there)
  • when looking for Normalize clauses, the self type wasn't generalized (so
    bound variables were handled wrongly). (This lead to crashes when trying to
    integrate it in rust-analyzer: Bump chalk rust-analyzer#4982)


goal {
exists<T> { Normalize(<foo<T> as FnOnce<(T,)>>::Output -> T) }
} yields[SolverChoice::recursive()] {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this associated type ambiguity for SLG? If so, can you add a comment (next to the wrong output)?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh hm actually I just added that while debugging, let me check whether it fails.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, works fine, I've removed it.

There were two problems:
 - the FnDef impl was using a wrong substitution for the FnDef (calling
   `builder.substitution_in_scope()`, which wasn't even necessarily the same
   number of parameters -- not sure what the intention was there)
 - when looking for `Normalize` clauses, the self type wasn't generalized (so
   bound variables were handled wrongly). (This lead to crashes when trying to
   integrate it in rust-analyzer: rust-lang/rust-analyzer#4982)
@jackh726 jackh726 merged commit 57037a5 into rust-lang:master Jun 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants