Change sized_constraints to return EarlyBinder
This commit is contained in:
parent
e21624dc80
commit
96a69dce2c
4 changed files with 10 additions and 5 deletions
|
@ -563,7 +563,7 @@ impl<'tcx> AdtDef<'tcx> {
|
|||
///
|
||||
/// Due to normalization being eager, this applies even if
|
||||
/// the associated type is behind a pointer (e.g., issue #31299).
|
||||
pub fn sized_constraint(self, tcx: TyCtxt<'tcx>) -> &'tcx [Ty<'tcx>] {
|
||||
tcx.adt_sized_constraint(self.did()).0
|
||||
pub fn sized_constraint(self, tcx: TyCtxt<'tcx>) -> ty::EarlyBinder<&'tcx [Ty<'tcx>]> {
|
||||
ty::EarlyBinder(tcx.adt_sized_constraint(self.did()).0)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2191,7 +2191,7 @@ impl<'tcx> Ty<'tcx> {
|
|||
|
||||
ty::Tuple(tys) => tys.iter().all(|ty| ty.is_trivially_sized(tcx)),
|
||||
|
||||
ty::Adt(def, _substs) => def.sized_constraint(tcx).is_empty(),
|
||||
ty::Adt(def, _substs) => def.sized_constraint(tcx).0.is_empty(),
|
||||
|
||||
ty::Projection(_) | ty::Param(_) | ty::Opaque(..) => false,
|
||||
|
||||
|
|
|
@ -1883,7 +1883,11 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
|||
let sized_crit = def.sized_constraint(self.tcx());
|
||||
// (*) binder moved here
|
||||
Where(obligation.predicate.rebind({
|
||||
sized_crit.iter().map(|ty| EarlyBinder(*ty).subst(self.tcx(), substs)).collect()
|
||||
sized_crit
|
||||
.0
|
||||
.iter()
|
||||
.map(|ty| sized_crit.rebind(*ty).subst(self.tcx(), substs))
|
||||
.collect()
|
||||
}))
|
||||
}
|
||||
|
||||
|
|
|
@ -33,8 +33,9 @@ fn sized_constraint_for_ty<'tcx>(
|
|||
let adt_tys = adt.sized_constraint(tcx);
|
||||
debug!("sized_constraint_for_ty({:?}) intermediate = {:?}", ty, adt_tys);
|
||||
adt_tys
|
||||
.0
|
||||
.iter()
|
||||
.map(|ty| EarlyBinder(*ty).subst(tcx, substs))
|
||||
.map(|ty| adt_tys.rebind(*ty).subst(tcx, substs))
|
||||
.flat_map(|ty| sized_constraint_for_ty(tcx, adtdef, ty))
|
||||
.collect()
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue