Explicitly bind trait method generics #512
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.