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

Adding parsing and AST->IR lowering for RevealMode + Overrides + added reveal { G } syntax #230

Closed
wants to merge 2 commits into from

Conversation

sunjay
Copy link
Member

@sunjay sunjay commented Jun 8, 2019

This begins to implement the first bullet in #219 (comment).

I added a number of things:

  1. A new reveal { G } syntax similar to the compatible { G } syntax we already have for introducing the RevealMode (this is useful for testing and whatnot)
  2. Parsing for RevealMode and Overrides[V0](P0: Trait<P1..Pn>) syntax
  3. Lowering from the AST to the chalk IR for all of this
  4. All the standard Debug, Fold, Zip stuff for the new variants and types

Unresolved questions for @nikomatsakis before this is merged:

  • Do I need to add/change anything in the rust_ir? I didn't encounter any compiler errors, so I wasn't sure
  • Did I look up the associated type's TypeId correctly during lowering?
  • What should we do when lowering Overrides in clauses.rs? Right now I've just left it as unimplemented!()
    • I could just do the same thing as when we added LocalImplAllowed and create program clauses for the trait ref, but do we also have to take the associated type ID into account?

I'm going to do the second part of this ("Modify the lowering for default type to include the Overrides clause") after this PR.

@sunjay sunjay requested a review from nikomatsakis June 8, 2019 17:26
@sunjay sunjay marked this pull request as ready for review June 8, 2019 17:26
@sunjay
Copy link
Member Author

sunjay commented Jun 8, 2019

I recommend excluding the rustfmt commit when you review this because it adds a lot of unnecessary noise.

@@ -214,7 +214,11 @@ fn program_clauses_that_could_match(
DomainGoal::LocalImplAllowed(trait_ref) => db
.trait_datum(trait_ref.trait_id)
.to_program_clauses(db, clauses),
DomainGoal::Compatible(()) => (),
DomainGoal::Compatible(()) | DomainGoal::RevealMode(()) => (),
DomainGoal::Overrides(ov) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

So here we need to find all the "sources" of overrides clauses. I think these would derive from lowering the "assoc type values" found in impl of the given trait, so the simplest thing would be to call push_program_clauses_for_associated_type_values_in_impls_of like we do for Normalize.

@XVilka
Copy link

XVilka commented Sep 23, 2019

There are conflicts now - so should be rebased.

@jackh726
Copy link
Member

We discussed this in the meeting today (https://rust-lang.zulipchat.com/#narrow/stream/144729-wg-traits/topic/design.20meeting.202020.2E04.2E14/near/193955431) and decided to close this. I'm gonna link this in a specialization-related issue for potential followup though

@jackh726 jackh726 closed this Apr 14, 2020
@jackh726 jackh726 mentioned this pull request Apr 14, 2020
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.

4 participants