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

🛠 Extend the "chalk lowering" pass with remaining rules #49177

Open
nikomatsakis opened this Issue Mar 19, 2018 · 6 comments

Comments

Projects
None yet
6 participants
@nikomatsakis
Copy link
Contributor

nikomatsakis commented Mar 19, 2018

Now that @scalexm has created the basic framework for lowering, we need to flesh it out. This issue is intentionally structured as a "quest isuse" -- that is, a way for a lot of people to contribute, each doing one small thing. The goal is for everyone to get familiar with the overall "chalk" setup.

The tasks

Each task corresponds to one of the rules documented in the rustc-guide. You can search the guide for the rule name in order to find some text explaining the rule. If you want to do a rule, just check the box and edit this post to add your name (if you are a member of the GitHub team, you should have privileges for that). If you are not yet a member of the WG-traits group, leave a comment below or ping me on gitter and I will add you.

Mentoring instructions

As described above, the goal is to add the code to generate appropriate program clauses from various Rust constructs. You should use the Implemented-From-Impl rule as a kind of template:

// Rule Implemented-From-Impl
//
// (see rustc guide)
let trait_ref = tcx.impl_trait_ref(def_id).unwrap();
let trait_ref = ty::TraitPredicate { trait_ref }.lower();
let where_clauses = tcx.predicates_of(def_id).predicates.lower();
let clause = Clause::Implies(where_clauses, trait_ref);
Lrc::new(vec![clause])

Each rule should also have a unit-test. This rustc-guide chapter describes how to create such unit tests.

cc @rust-lang/wg-traits

@varkor

This comment has been minimized.

Copy link
Member

varkor commented Mar 20, 2018

I'll take Rule Implemented-From-Env to get my feet wet!

varkor added a commit to varkor/rust that referenced this issue Mar 20, 2018

Implement Rule Implemented-From-Env
This extends the Chalk lowering pass with the "Implemented-From-Env" rule for generating program clauses from a trait definition as part of rust-lang#49177.

kennytm added a commit to kennytm/rust that referenced this issue Mar 21, 2018

Rollup merge of rust-lang#49211 - varkor:chalk-lowering-Implemented-F…
…rom-Env, r=nikomatsakis

Implement Chalk lowering rule "Implemented-From-Env"

This extends the Chalk lowering pass with the "Implemented-From-Env" rule for generating program clauses from a trait definition as part of rust-lang#49177.

r? @nikomatsakis

kennytm added a commit to kennytm/rust that referenced this issue Mar 21, 2018

Rollup merge of rust-lang#49211 - varkor:chalk-lowering-Implemented-F…
…rom-Env, r=nikomatsakis

Implement Chalk lowering rule "Implemented-From-Env"

This extends the Chalk lowering pass with the "Implemented-From-Env" rule for generating program clauses from a trait definition as part of rust-lang#49177.

r? @nikomatsakis

kennytm added a commit to kennytm/rust that referenced this issue Mar 22, 2018

Rollup merge of rust-lang#49211 - varkor:chalk-lowering-Implemented-F…
…rom-Env, r=nikomatsakis

Implement Chalk lowering rule "Implemented-From-Env"

This extends the Chalk lowering pass with the "Implemented-From-Env" rule for generating program clauses from a trait definition as part of rust-lang#49177.

r? @nikomatsakis

kennytm added a commit to kennytm/rust that referenced this issue Mar 22, 2018

Rollup merge of rust-lang#49211 - varkor:chalk-lowering-Implemented-F…
…rom-Env, r=nikomatsakis

Implement Chalk lowering rule "Implemented-From-Env"

This extends the Chalk lowering pass with the "Implemented-From-Env" rule for generating program clauses from a trait definition as part of rust-lang#49177.

r? @nikomatsakis
@tmandry

This comment has been minimized.

Copy link
Contributor

tmandry commented Mar 26, 2018

Working on Rule Implied-Bound-From-Trait!

@fanzier

This comment has been minimized.

Copy link
Contributor

fanzier commented Mar 31, 2018

I'd like to try Normalize-From-Impl :) (Also, I think the rule Implemented-From-Impl occurs twice in the list.)

@nikomatsakis

This comment has been minimized.

Copy link
Contributor Author

nikomatsakis commented Apr 2, 2018

@fanzier great! Let me know how it goes. Feel free to pop in on the gitter channel with questions.

bors added a commit that referenced this issue Apr 10, 2018

Auto merge of #49435 - tmandry:rule-implied-bound-from-trait, r=nikom…
…atsakis

chalkify: Implement lowering rule Implied-Bound-From-Trait

For #49177.

TODO:
- [x] Implement where clauses besides trait and projection predicates
- [x] Is the output of the `lower_trait_higher_rank` test correct?
- [ ] Remove `Self::Trait` from the query `tcx.predicates_of(<trait_id>).predicates`
- [ ] Consider moving tests to compile-fail to make them more manageable

bors added a commit that referenced this issue Apr 12, 2018

Auto merge of #49626 - fanzier:chalk-lowering, r=scalexm
Implement Chalk lowering rule Normalize-From-Impl

This extends the Chalk lowering pass with the "Normalize-From-Impl" rule for generating program clauses from a trait definition as part of #49177.

r? @nikomatsakis

kennytm added a commit to kennytm/rust that referenced this issue Apr 13, 2018

Rollup merge of rust-lang#49626 - fanzier:chalk-lowering, r=scalexm
Implement Chalk lowering rule Normalize-From-Impl

This extends the Chalk lowering pass with the "Normalize-From-Impl" rule for generating program clauses from a trait definition as part of rust-lang#49177.

r? @nikomatsakis

kennytm added a commit to kennytm/rust that referenced this issue Apr 13, 2018

Rollup merge of rust-lang#49626 - fanzier:chalk-lowering, r=scalexm
Implement Chalk lowering rule Normalize-From-Impl

This extends the Chalk lowering pass with the "Normalize-From-Impl" rule for generating program clauses from a trait definition as part of rust-lang#49177.

r? @nikomatsakis

bors added a commit that referenced this issue Apr 17, 2018

Auto merge of #49626 - fanzier:chalk-lowering, r=scalexm
Implement Chalk lowering rule Normalize-From-Impl

This extends the Chalk lowering pass with the "Normalize-From-Impl" rule for generating program clauses from a trait definition as part of #49177.

r? @nikomatsakis

bors added a commit that referenced this issue Jul 9, 2018

Auto merge of #50250 - csmoe:wf_traitref, r=scalexm
Chalk lowering rule: WellFormed-TraitRef

Address chalk lowering "Implemented-From-Env" as part of #49177.
r? @nikomatsakis
@bjorn3

This comment has been minimized.

Copy link
Contributor

bjorn3 commented Oct 19, 2018

@nikomatsakis I believe some check boxes should be checked.

bors added a commit that referenced this issue Nov 14, 2018

Auto merge of #52153 - csmoe:projeq_normal, r=scalexm
chalk lowering rule: ProjectionEq-Normalize

cc #49177
r? @scalexm
@bjorn3

This comment has been minimized.

Copy link
Contributor

bjorn3 commented Nov 14, 2018

PR #52153 has been merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.