Introduce PredicateKind::Clause

This commit is contained in:
Santiago Pastorino 2022-11-24 18:14:58 -03:00
parent 42cc8e8f4e
commit 974e2837bb
No known key found for this signature in database
GPG key ID: 8131A24E0C79EFAF
75 changed files with 568 additions and 407 deletions

View file

@ -403,8 +403,10 @@ impl<'tcx> AutoTraitFinder<'tcx> {
) {
let mut should_add_new = true;
user_computed_preds.retain(|&old_pred| {
if let (ty::PredicateKind::Trait(new_trait), ty::PredicateKind::Trait(old_trait)) =
(new_pred.kind().skip_binder(), old_pred.kind().skip_binder())
if let (
ty::PredicateKind::Clause(ty::Clause::Trait(new_trait)),
ty::PredicateKind::Clause(ty::Clause::Trait(old_trait)),
) = (new_pred.kind().skip_binder(), old_pred.kind().skip_binder())
{
if new_trait.def_id() == old_trait.def_id() {
let new_substs = new_trait.trait_ref.substs;
@ -624,14 +626,14 @@ impl<'tcx> AutoTraitFinder<'tcx> {
let bound_predicate = predicate.kind();
match bound_predicate.skip_binder() {
ty::PredicateKind::Trait(p) => {
ty::PredicateKind::Clause(ty::Clause::Trait(p)) => {
// Add this to `predicates` so that we end up calling `select`
// with it. If this predicate ends up being unimplemented,
// then `evaluate_predicates` will handle adding it the `ParamEnv`
// if possible.
predicates.push_back(bound_predicate.rebind(p));
}
ty::PredicateKind::Projection(p) => {
ty::PredicateKind::Clause(ty::Clause::Projection(p)) => {
let p = bound_predicate.rebind(p);
debug!(
"evaluate_nested_obligations: examining projection predicate {:?}",
@ -764,11 +766,11 @@ impl<'tcx> AutoTraitFinder<'tcx> {
}
}
}
ty::PredicateKind::RegionOutlives(binder) => {
ty::PredicateKind::Clause(ty::Clause::RegionOutlives(binder)) => {
let binder = bound_predicate.rebind(binder);
select.infcx().region_outlives_predicate(&dummy_cause, binder)
}
ty::PredicateKind::TypeOutlives(binder) => {
ty::PredicateKind::Clause(ty::Clause::TypeOutlives(binder)) => {
let binder = bound_predicate.rebind(binder);
match (
binder.no_bound_vars(),