-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Guts of trait reform: Reimplement trait matching algorithm #17197
Merged
bors
merged 10 commits into
rust-lang:master
from
nikomatsakis:issue-5527-trait-reform-revisited
Sep 16, 2014
Merged
Guts of trait reform: Reimplement trait matching algorithm #17197
bors
merged 10 commits into
rust-lang:master
from
nikomatsakis:issue-5527-trait-reform-revisited
Sep 16, 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
nikomatsakis
force-pushed
the
issue-5527-trait-reform-revisited
branch
from
September 12, 2014 16:20
1df889c
to
5b48f0a
Compare
Argh. I just merged this this morning, but I already see merge conflicts! Probably best to do review now and I'll patch it up afterwards. |
Note: see doc.rs for an intro to the trait matching code. |
Very excited to see this close to landing! |
nikomatsakis
force-pushed
the
issue-5527-trait-reform-revisited
branch
from
September 12, 2014 20:39
5b48f0a
to
627ca58
Compare
rebased so that it is mergable |
nikomatsakis
force-pushed
the
issue-5527-trait-reform-revisited
branch
from
September 12, 2014 21:47
627ca58
to
13693c4
Compare
rebased: correct typos |
Address nits and refactor the trait resolution that is specific to trans into trans. |
see the lang-items for Sized etc. @acrichto and @thestinger had no objections.
- Unify the "well-formedness" checking that typeck was already doing with what was taking place in kind. - Move requirements that things be sized into typeck. - I left the checking on upvars in kind, though I think it should eventually be refactored into regionck (which would perhaps be renamed). This reflects a general plan to convert typeck so that it registers obligations or other pending things for conditions it cannot check eventually. This makes it easier to identify all the conditions that apply to an AST expression, but can also influence inference in somec cases (e.g., `Send` implies `'static`, so I already had to promote a lot of the checking that `kind.rs` was doing into typeck, this branch just continues the process).
nikomatsakis
force-pushed
the
issue-5527-trait-reform-revisited
branch
from
September 15, 2014 19:28
66f8172
to
48bc291
Compare
Rebased. |
bors
added a commit
that referenced
this pull request
Sep 16, 2014
…sited, r=pcwalton This patch does not make many functional changes, but does a lot of restructuring towards the goals of #5527. This is the biggest patch, basically, that should enable most of the other patches in a relatively straightforward way. Major changes: - Do not track impls through trans, instead recompute as needed. - Isolate trait matching code into its own module, carefully structure to distinguish various phases (selection vs confirmation vs fulfillment) - Consider where clauses in their more general form - Integrate checking of builtin bounds into the trait matching process, rather than doing it separately in kind.rs (important for opt-in builtin bounds) What is not included: - Where clauses are still not generalized. This should be a straightforward follow-up patch. - Caching. I did not include much caching. I have plans for various kinds of caching we can do. Should be straightforward. Preliminary perf measurements suggested that this branch keeps compilation times roughly what they are. - Method resolution. The initial algorithm I proposed for #5527 does not work as well as I hoped. I have a revised plan which is much more similar to what we do today. - Deref vs deref-mut. The initial fix I had worked great for autoderef, but not for explicit deref. - Permitting blanket impls to overlap with specific impls. Initial plan to consider all nested obligations before considering an impl to match caused many compilation errors. We have a revised plan but it is not implemented here, should be a relatively straightforward extension.
bors
added a commit
that referenced
this pull request
Sep 16, 2014
…sited, r=pcwalton This patch does not make many functional changes, but does a lot of restructuring towards the goals of #5527. This is the biggest patch, basically, that should enable most of the other patches in a relatively straightforward way. Major changes: - Do not track impls through trans, instead recompute as needed. - Isolate trait matching code into its own module, carefully structure to distinguish various phases (selection vs confirmation vs fulfillment) - Consider where clauses in their more general form - Integrate checking of builtin bounds into the trait matching process, rather than doing it separately in kind.rs (important for opt-in builtin bounds) What is not included: - Where clauses are still not generalized. This should be a straightforward follow-up patch. - Caching. I did not include much caching. I have plans for various kinds of caching we can do. Should be straightforward. Preliminary perf measurements suggested that this branch keeps compilation times roughly what they are. - Method resolution. The initial algorithm I proposed for #5527 does not work as well as I hoped. I have a revised plan which is much more similar to what we do today. - Deref vs deref-mut. The initial fix I had worked great for autoderef, but not for explicit deref. - Permitting blanket impls to overlap with specific impls. Initial plan to consider all nested obligations before considering an impl to match caused many compilation errors. We have a revised plan but it is not implemented here, should be a relatively straightforward extension.
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.
This patch does not make many functional changes, but does a lot of restructuring towards the goals of #5527. This is the biggest patch, basically, that should enable most of the other patches in a relatively straightforward way.
Major changes:
What is not included: