1
Fork 0

map_bound_ref -> rebind

This commit is contained in:
Jack Huey 2020-10-16 14:04:11 -04:00
parent 11d62aa284
commit eba10270c6
21 changed files with 77 additions and 78 deletions

View file

@ -551,8 +551,7 @@ impl TypeRelation<'tcx> for Generalizer<'_, 'tcx> {
where
T: Relate<'tcx>,
{
let result = self.relate(a.skip_binder(), b.skip_binder())?;
Ok(a.map_bound(|_| result))
Ok(ty::Binder::bind(self.relate(a.skip_binder(), b.skip_binder())?))
}
fn relate_item_substs(
@ -834,8 +833,7 @@ impl TypeRelation<'tcx> for ConstInferUnifier<'_, 'tcx> {
where
T: Relate<'tcx>,
{
let result = self.relate(a.skip_binder(), b.skip_binder())?;
Ok(a.map_bound(|_| result))
Ok(ty::Binder::bind(self.relate(a.skip_binder(), b.skip_binder())?))
}
fn tys(&mut self, t: Ty<'tcx>, _t: Ty<'tcx>) -> RelateResult<'tcx, Ty<'tcx>> {

View file

@ -1004,6 +1004,6 @@ where
self.first_free_index.shift_in(1);
let result = self.relate(a.skip_binder(), a.skip_binder())?;
self.first_free_index.shift_out(1);
Ok(a.map_bound(|_| result))
Ok(ty::Binder::bind(result))
}
}

View file

@ -134,7 +134,7 @@ impl Elaborator<'tcx> {
let obligations = predicates.predicates.iter().map(|&(pred, _)| {
predicate_obligation(
pred.subst_supertrait(tcx, &bound_predicate.map_bound(|_| data.trait_ref)),
pred.subst_supertrait(tcx, &bound_predicate.rebind(data.trait_ref)),
obligation.param_env,
obligation.cause.clone(),
)