Skip to content

Commit 96a69dc

Browse files
committed
Change sized_constraints to return EarlyBinder
1 parent e21624d commit 96a69dc

File tree

4 files changed

+10
-5
lines changed

4 files changed

+10
-5
lines changed

compiler/rustc_middle/src/ty/adt.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -563,7 +563,7 @@ impl<'tcx> AdtDef<'tcx> {
563563
///
564564
/// Due to normalization being eager, this applies even if
565565
/// the associated type is behind a pointer (e.g., issue #31299).
566-
pub fn sized_constraint(self, tcx: TyCtxt<'tcx>) -> &'tcx [Ty<'tcx>] {
567-
tcx.adt_sized_constraint(self.did()).0
566+
pub fn sized_constraint(self, tcx: TyCtxt<'tcx>) -> ty::EarlyBinder<&'tcx [Ty<'tcx>]> {
567+
ty::EarlyBinder(tcx.adt_sized_constraint(self.did()).0)
568568
}
569569
}

compiler/rustc_middle/src/ty/sty.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2191,7 +2191,7 @@ impl<'tcx> Ty<'tcx> {
21912191

21922192
ty::Tuple(tys) => tys.iter().all(|ty| ty.is_trivially_sized(tcx)),
21932193

2194-
ty::Adt(def, _substs) => def.sized_constraint(tcx).is_empty(),
2194+
ty::Adt(def, _substs) => def.sized_constraint(tcx).0.is_empty(),
21952195

21962196
ty::Projection(_) | ty::Param(_) | ty::Opaque(..) => false,
21972197

compiler/rustc_trait_selection/src/traits/select/mod.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -1883,7 +1883,11 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
18831883
let sized_crit = def.sized_constraint(self.tcx());
18841884
// (*) binder moved here
18851885
Where(obligation.predicate.rebind({
1886-
sized_crit.iter().map(|ty| EarlyBinder(*ty).subst(self.tcx(), substs)).collect()
1886+
sized_crit
1887+
.0
1888+
.iter()
1889+
.map(|ty| sized_crit.rebind(*ty).subst(self.tcx(), substs))
1890+
.collect()
18871891
}))
18881892
}
18891893

compiler/rustc_ty_utils/src/ty.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,9 @@ fn sized_constraint_for_ty<'tcx>(
3333
let adt_tys = adt.sized_constraint(tcx);
3434
debug!("sized_constraint_for_ty({:?}) intermediate = {:?}", ty, adt_tys);
3535
adt_tys
36+
.0
3637
.iter()
37-
.map(|ty| EarlyBinder(*ty).subst(tcx, substs))
38+
.map(|ty| adt_tys.rebind(*ty).subst(tcx, substs))
3839
.flat_map(|ty| sized_constraint_for_ty(tcx, adtdef, ty))
3940
.collect()
4041
}

0 commit comments

Comments
 (0)