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

Add lowering rules for GATs #147

Merged
merged 1 commit into from
Jun 1, 2018

Conversation

tmandry
Copy link
Member

@tmandry tmandry commented May 31, 2018

Add the lowering rules from rust-lang/chalk#12 (comment) that were added to Chalk in rust-lang/chalk#134.

cc #137, @scalexm, @nikomatsakis

@tmandry tmandry force-pushed the gat-lowering-rules branch from 67f1414 to d8d13a8 Compare May 31, 2018 04:10
Copy link
Member

@scalexm scalexm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left two small comments.

// XXX how exactly should we set this up? Have to be careful;
// presumably this has to be a kind of `FromEnv` setup.
// Rule Implied-Bound-From-AssocTy
forall<Self, P1..Pn, Pn+1..Pm> {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add: « for each Bound in the set of Bounds » or something like this, to emphasize the fact that we output one FromEnv rule at a time


```text
// Rule Normalize-From-Impl
forall<P0..Pm> {
forall<Pn+1..Pm> {
Normalize(<A0 as Trait<A1..An>>::AssocType<Pn+1..Pm> -> T) :-
WC && WC1
WC_impl && WC1
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WC_impl can actually be replaced with Implemented(A0: Trait) (and that’s what we do in chalk)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. Do you think it's more or less confusing to keep WC_impl around then? :)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let’s keep it, so that it looks like a general enough impl.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moreover, your comment just below about what the impl can rely on is very informative.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good. I added a note about WC_impl being unused just so it doesn't seem like a mistake.

@tmandry tmandry force-pushed the gat-lowering-rules branch from d8d13a8 to 80e9918 Compare June 1, 2018 15:17
@tmandry tmandry force-pushed the gat-lowering-rules branch from 80e9918 to 8a98e39 Compare June 1, 2018 15:31
@nikomatsakis nikomatsakis merged commit 5c7d4da into rust-lang:master Jun 1, 2018
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.

3 participants