// could be extended easily also to the other `Predicate`.
let predicate_matches_closure = |p: Predicate<'tcx>| {
let mut relator: SimpleEqRelation<'tcx> = SimpleEqRelation::new(tcx, self_param_env);
- match (predicate.kind(), p.kind()) {
- (ty::PredicateKind::Trait(a, _), ty::PredicateKind::Trait(b, _)) => {
- relator.relate(a, b).is_ok()
+ match (predicate.skip_binders(), p.skip_binders()) {
+ (ty::PredicateAtom::Trait(a, _), ty::PredicateAtom::Trait(b, _)) => {
+ relator.relate(ty::Binder::bind(a), ty::Binder::bind(b)).is_ok()
}
- (ty::PredicateKind::Projection(a), ty::PredicateKind::Projection(b)) => {
- relator.relate(a, b).is_ok()
+ (ty::PredicateAtom::Projection(a), ty::PredicateAtom::Projection(b)) => {
+ relator.relate(ty::Binder::bind(a), ty::Binder::bind(b)).is_ok()
}
_ => predicate == p,
}
fn relate_with_variance<T: Relate<'tcx>>(
&mut self,
_: ty::Variance,
- a: &T,
- b: &T,
+ a: T,
+ b: T,
) -> RelateResult<'tcx, T> {
// Here we ignore variance because we require drop impl's types
// to be *exactly* the same as to the ones in the struct definition.
fn binders<T>(
&mut self,
- a: &ty::Binder<T>,
- b: &ty::Binder<T>,
+ a: ty::Binder<T>,
+ b: ty::Binder<T>,
) -> RelateResult<'tcx, ty::Binder<T>>
where
T: Relate<'tcx>,
// Anonymizing the LBRs is necessary to solve (Issue #59497).
// After we do so, it should be totally fine to skip the binders.
- let anon_a = self.tcx.anonymize_late_bound_regions(a);
- let anon_b = self.tcx.anonymize_late_bound_regions(b);
+ let anon_a = self.tcx.anonymize_late_bound_regions(&a);
+ let anon_b = self.tcx.anonymize_late_bound_regions(&b);
self.relate(anon_a.skip_binder(), anon_b.skip_binder())?;
Ok(a.clone())