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

check that fn decls in impls/traits match #70

Merged
merged 1 commit into from
Jun 29, 2022
Merged

Conversation

nikomatsakis
Copy link
Contributor

@nikomatsakis nikomatsakis commented Jun 25, 2022

Very basic check that function declarations in impls vs traits match. Checks:

  • impl and trait version of fn have the same generic parameters (this is too strict, compared to rustc, because of late-bound lifetimes)
  • parameter types on the trait are a subtype of parameter types on the impl
  • return type on the impl is a subtype of return type on the trait

I can't remember precisely how this check compares to rustc! This is the most general version, but I think rustc requires equality perhaps in some places. We should figure that out.

Fixes #69

@nikomatsakis nikomatsakis merged commit c42d83f into main Jun 29, 2022
@nikomatsakis nikomatsakis deleted the fn-decls-match branch August 24, 2022 15:44
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.

Compare fns in impls against trait interface definitions
1 participant