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

Explicitly bind trait method generics #512

Merged
merged 8 commits into from
Jan 2, 2025

Conversation

Nadrieril
Copy link
Member

@Nadrieril Nadrieril commented Dec 31, 2024

The correspondance between the pair "(impl generics, method generics)" and the full list of generics that must be passed to the function item is not trivial: methods may reuse a default method (which requires changing generics), they may be more specific (e.g. have fewer trait bounds or different late-bound lifetimes) than the trait method, arguments may be out of order because charon modified the parameter list (e.g. for #127).

To support these cases, this PR adds explicit binders to methods in trait decls and trait impls. A method binder binds exactly the generics expected from the method declaration. This works as a map from method generics to a full list of generics to be passed to the bound function item. To map the other way around (from the function item generics to the correponding trait/impl generics and method generics), see in ItemKind.

This is progress towards #180 and #127.

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.

1 participant