-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Make method calls use trait matching infrastructure #18121
Merged
bors
merged 13 commits into
rust-lang:master
from
nikomatsakis:method-call-use-trait-matching-infrastructure-2
Oct 22, 2014
Merged
Make method calls use trait matching infrastructure #18121
bors
merged 13 commits into
rust-lang:master
from
nikomatsakis:method-call-use-trait-matching-infrastructure-2
Oct 22, 2014
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cc @flaper87 (this is mostly orthogonal to what we've been talking about, but related) |
Awesome! |
r=me with questions/nits addressed |
…twist that we have to take the transformed self type into account, and allow for coercion between the receiver and the actual type declared on the impl.
Also: 1. stop eagerly coercing from `[T, ..n]` to `[T]` only do so if requested. 2. permit error to be interact more freely. Fixes rust-lang#17178.
over anything that is foldable, not just fn signatures.
nikomatsakis
force-pushed
the
method-call-use-trait-matching-infrastructure-2
branch
from
October 21, 2014 15:57
951b095
to
98ca778
Compare
of tracking individual candidates per impl, we just track one candidate for the extension trait itself, and let the trait resolution handle walking the individual impls and so forth. Also change the interface to report back a richer notion of error.
…atching, as far as I can tell.
…ype declared in the trait, not in the impl. In some cases that results in tighter rules, and in some cases looser. Correct for that.
…mpl of `FnMut` for some reason.
…-ambiguities. These are mostly new tests though I also revamped (and renamed) some of the existing tests.
nikomatsakis
force-pushed
the
method-call-use-trait-matching-infrastructure-2
branch
from
October 21, 2014 16:32
98ca778
to
646ec7d
Compare
bors
added a commit
that referenced
this pull request
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
nikomatsakis
deleted the
method-call-use-trait-matching-infrastructure-2
branch
March 30, 2016 16:16
lnicola
pushed a commit
to lnicola/rust
that referenced
this pull request
Sep 25, 2024
…, r=Veykril fix: fix ambigious package name in flycheck fixes rust-lang#18121
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
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:
*
or other change is now required. (See commit e8cef25 ("Correct case where the old version of method lookup...") 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