-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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
Modify method dispatch to use trait machinery #17918
Comments
bors
added a commit
that referenced
this issue
Oct 22, 2014
…ng-infrastructure-2, r=pcwalton Convert trait method dispatch to use new trait matching machinery. This fixes about 90% of #17918. What remains to be done is to make inherent dispatch work with conditional dispatch as well. I plan to do this in a future patch by generalizing the "method match" code slightly to work for inherent impls as well (the basic algorithm is precisely the same). Fixes #17178. This is a [breaking-change] for two reasons: 1. The old code was a bit broken. I found various minor cases, particularly around operators, where the old code incorrectly matched, but an extra `*` or other change is now required. (See commit e8cef25 ("Correct case where the old version of method lookup...") for examples.) 2. The old code didn't type check calls against the method signature from the *trait* but rather the *impl*. The two can be different in subtle ways. This makes the new method dispatch both more liberal and more conservative than the original. (See commit 8308332 ("The new method lookup mechanism typechecks...") for examples.) r? @pcwalton since he's been reviewing most of this series of changes f? @nick29581 for commit 39df55f ("Permit DST types to unify like other types") cc @aturon as this relates to library stabilization
Done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Currently, method dispatch just compares the self type and -- if it matches -- assumes that the trait matches. It ought to use a strategy akin to what is used during trait matching. This probably involves some minor refactoring of the
select
trait to allow method dispatch to "hook in" to the same code.Part of trait reform #5527.
Nominating.
The text was updated successfully, but these errors were encountered: