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

intern predicates, introduce forall/implies #285

Closed
nikomatsakis opened this issue May 5, 2020 · 3 comments
Closed

intern predicates, introduce forall/implies #285

nikomatsakis opened this issue May 5, 2020 · 3 comments
Labels
major-change A proposal to make a major change to rustc major-change-accepted A major change proposal that was accepted

Comments

@nikomatsakis
Copy link
Contributor

nikomatsakis commented May 5, 2020

TL;DR

Refactor ty::Predicate to better align with how chalk handles things and to enable what we need for GATs. Highlights:

Goals:

  • Introduce forall and implication predicates so we can model forall<T> { if (T: Debug) { Vec<T>: Debug } }.
  • Remove the "poly" from all the other kinds of predicates (e.g., Predicate::Trait would be an ordinary TraitRef)
  • Change Predicate<'tcx> to an interned reference (&'tcx PredicateKind<'tcx>) to enable recursion

Steps

  • Enable recursive predicates (this work has started on a branch of mine and is basically done)
    • Rename Predicate to PredicateKind, introduce type Predicate = PredicateKind
    • Introduce interned pool for Predicate and alter type Predicate<'tcx> to &'tcx PredicateKind<'tcx>
  • Introduce forall:
    • Introduce forall predicate goals and integrate into the fulfillment context
      • hmm -- this may require finishing up the universe integration work, which is semi-blocked
    • Remove the mandatory binder on trait predicates and other predicates and use forall goals instead where needed
  • Introduce implication predicates, which extend the ParamEnv with new predicates

Mentors or Reviewers

nikomatsakis will mentor

@nikomatsakis nikomatsakis added the major-change A proposal to make a major change to rustc label May 5, 2020
@rustbot rustbot added the to-announce Announce this issue on triage meeting label May 5, 2020
@nikomatsakis
Copy link
Contributor Author

Zulip thread

@eddyb
Copy link
Member

eddyb commented May 11, 2020

@rustbot second

@rustbot rustbot added the final-comment-period The FCP has started, most (if not all) team members are in agreement label May 11, 2020
@spastorino spastorino removed the to-announce Announce this issue on triage meeting label May 13, 2020
@nikomatsakis
Copy link
Contributor Author

FCP closed! See #72055 for initial implementation steps.

RalfJung added a commit to RalfJung/rust that referenced this issue May 21, 2020
Intern predicates

Implements the first step of rust-lang/compiler-team#285

Renames `ty::Predicate` to `ty::PredicateKind`, which is now interned.
To ease the transition, `ty::Predicate` is now a struct containing a reference
to `ty::PredicateKind`.

r? @ghost
RalfJung added a commit to RalfJung/rust that referenced this issue May 21, 2020
Intern predicates

Implements the first step of rust-lang/compiler-team#285

Renames `ty::Predicate` to `ty::PredicateKind`, which is now interned.
To ease the transition, `ty::Predicate` is now a struct containing a reference
to `ty::PredicateKind`.

r? @ghost
@spastorino spastorino added the major-change-accepted A major change proposal that was accepted label Jun 8, 2020
@spastorino spastorino removed the final-comment-period The FCP has started, most (if not all) team members are in agreement label Jun 11, 2020
Manishearth added a commit to Manishearth/rust that referenced this issue Jun 19, 2020
…komatsakis

Cache flags and escaping vars for predicates

With predicates becoming interned (rust-lang/compiler-team#285) this is now possible and could be a perf win. It would become an even larger win once we have recursive predicates.

cc @lcnr @nikomatsakis

r? @ghost
bors added a commit to rust-lang-ci/rust that referenced this issue Jun 21, 2020
…matsakis

Cache flags and escaping vars for predicates

With predicates becoming interned (rust-lang/compiler-team#285) this is now possible and could be a perf win. It would become an even larger win once we have recursive predicates.

cc @lcnr @nikomatsakis

r? @ghost
bors added a commit to rust-lang-ci/rust that referenced this issue Jul 27, 2020
… r=nikomatsakis

convert higher ranked `Predicate`s to `PredicateKind::ForAll`

implements step 2 of rust-lang/compiler-team#285
r? @nikomatsakis
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
major-change A proposal to make a major change to rustc major-change-accepted A major change proposal that was accepted
Projects
None yet
Development

No branches or pull requests

4 participants