Open
Description
Split up the PredicateKind
type into Goal
and Clauses
similar (or exactly :D) like what chalk does. The TLDR is that ParamEnv only contains a small set of PrecicateKind
variants and we want to encode this in the type system by only returning Clause
s from it.
This projection has been accepted as an MCP: rust-lang/compiler-team#531
Implementation steps
- [SP] Split out
Trait
,TypeOutlives
,RegionOutlives
andProjection
intoClause
enum: #104846 - [SP] #104911
inferred_outlives_crate
returns predicates, but they are always only TypeOutlives or RegionOutlives- may kill perf, so let's see if it works to just return ty::Clause where it now returns
ty::Predicate
and build the predicates at the caller site ofinferred_outlives_of
- may kill perf, so let's see if it works to just return ty::Clause where it now returns
- doing the same thing for
explicit_predicates_of
is gonna be a bit more involved - Improve perf of #104846
- start with
gather_explicit_predicates_of
and convert at the caller sites -
Bounds::predicates
should return an iterator over Clauses (MakeBound::predicates
useClause
#112734)
Follow-up work after #112938:
- Investigate making
TypeFoldable<TyCtxt<'tcx>> for ty::Clause<'tcx>
implementation less weird: - Clean up the elaborator since it should only be emitting child clauses, not predicates
- Rename identifiers like
pred
andpredicates
toclause
if they're actually clauses around the codebase - Validate that all of the
ToPredicate
impls are acutally still needed, or prune them if they're not
leave a comment when you start working on one of these steps so that no one else duplicates work.