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 Clauses from it.
This projection has been accepted as an MCP: rust-lang/compiler-team#531
Implementation steps
Follow-up work after #112938:
leave a comment when you start working on one of these steps so that no one else duplicates work.
Split up the
PredicateKindtype intoGoalandClausessimilar (or exactly :D) like what chalk does. The TLDR is that ParamEnv only contains a small set ofPrecicateKindvariants and we want to encode this in the type system by only returningClauses from it.This projection has been accepted as an MCP: rust-lang/compiler-team#531
Implementation steps
Trait,TypeOutlives,RegionOutlivesandProjectionintoClauseenum: #104846inferred_outlives_cratereturns predicates, but they are always only TypeOutlives or RegionOutlivesty::Predicateand build the predicates at the caller site ofinferred_outlives_ofexplicit_predicates_ofis gonna be a bit more involvedgather_explicit_predicates_ofand convert at the caller sitesBounds::predicatesshould return an iterator over Clauses (MakeBound::predicatesuseClause#112734)Follow-up work after #112938:
TypeFoldable<TyCtxt<'tcx>> for ty::Clause<'tcx>implementation less weird:rust/compiler/rustc_middle/src/ty/structural_impls.rs
Line 672 in 2efe091
predandpredicatestoclauseif they're actually clauses around the codebaseToPredicateimpls are acutally still needed, or prune them if they're notleave a comment when you start working on one of these steps so that no one else duplicates work.