@@ -217,10 +217,10 @@ fn ensure_drop_predicates_are_implied_by_item_defn<'tcx>(
217
217
// repeated `.iter().any(..)` calls.
218
218
219
219
// This closure is a more robust way to check `Predicate` equality
220
- // than simple `==` checks (which were the previous implementation).
221
- // It relies on `ty::relate` for `TraitPredicate` and `ProjectionPredicate`
222
- // (which implement the Relate trait), while delegating on simple equality
223
- // for the other `Predicate`.
220
+ // than simple `==` checks (which were the previous implementation). It relies on
221
+ // `ty::relate` for `TraitPredicate`, `ProjectionPredicate`, `ConstEvaluatable `
222
+ // `TypeOutlives` and `TypeWellFormedFromEnv` (which implement the Relate trait),
223
+ // while delegating on simple equality for the other `Predicate`.
224
224
// This implementation solves (Issue #59497) and (Issue #58311).
225
225
// It is unclear to me at the moment whether the approach based on `relate`
226
226
// could be extended easily also to the other `Predicate`.
@@ -235,6 +235,17 @@ fn ensure_drop_predicates_are_implied_by_item_defn<'tcx>(
235
235
( ty:: PredicateKind :: Projection ( a) , ty:: PredicateKind :: Projection ( b) ) => {
236
236
relator. relate ( predicate. rebind ( a) , p. rebind ( b) ) . is_ok ( )
237
237
}
238
+ (
239
+ ty:: PredicateKind :: ConstEvaluatable ( def_a, substs_a) ,
240
+ ty:: PredicateKind :: ConstEvaluatable ( def_b, substs_b) ,
241
+ ) => tcx. try_unify_abstract_consts ( ( ( def_a, substs_a) , ( def_b, substs_b) ) ) ,
242
+ ( ty:: PredicateKind :: TypeOutlives ( a) , ty:: PredicateKind :: TypeOutlives ( b) ) => {
243
+ relator. relate ( predicate. rebind ( a. 0 ) , p. rebind ( b. 0 ) ) . is_ok ( )
244
+ }
245
+ (
246
+ ty:: PredicateKind :: TypeWellFormedFromEnv ( a) ,
247
+ ty:: PredicateKind :: TypeWellFormedFromEnv ( b) ,
248
+ ) => relator. relate ( predicate. rebind ( a) , p. rebind ( b) ) . is_ok ( ) ,
238
249
_ => predicate == p,
239
250
}
240
251
} ;
0 commit comments