Rollup merge of #100095 - jackh726:early-binder, r=lcnr
More EarlyBinder cleanups Each commit is independent r? types
This commit is contained in:
commit
01ccde5ec8
14 changed files with 94 additions and 68 deletions
|
@ -431,6 +431,12 @@ impl<'tcx> Body<'tcx> {
|
|||
self.local_decls[RETURN_PLACE].ty
|
||||
}
|
||||
|
||||
/// Returns the return type; it always return first element from `local_decls` array.
|
||||
#[inline]
|
||||
pub fn bound_return_ty(&self) -> ty::EarlyBinder<Ty<'tcx>> {
|
||||
ty::EarlyBinder(self.local_decls[RETURN_PLACE].ty)
|
||||
}
|
||||
|
||||
/// Gets the location of the terminator for the given block.
|
||||
#[inline]
|
||||
pub fn terminator_loc(&self, bb: BasicBlock) -> Location {
|
||||
|
|
|
@ -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,
|
||||
|
||||
|
|
|
@ -680,6 +680,24 @@ impl<'tcx> TyCtxt<'tcx> {
|
|||
pub fn bound_const_param_default(self, def_id: DefId) -> ty::EarlyBinder<ty::Const<'tcx>> {
|
||||
ty::EarlyBinder(self.const_param_default(def_id))
|
||||
}
|
||||
|
||||
pub fn bound_predicates_of(
|
||||
self,
|
||||
def_id: DefId,
|
||||
) -> ty::EarlyBinder<ty::generics::GenericPredicates<'tcx>> {
|
||||
ty::EarlyBinder(self.predicates_of(def_id))
|
||||
}
|
||||
|
||||
pub fn bound_explicit_predicates_of(
|
||||
self,
|
||||
def_id: DefId,
|
||||
) -> ty::EarlyBinder<ty::generics::GenericPredicates<'tcx>> {
|
||||
ty::EarlyBinder(self.explicit_predicates_of(def_id))
|
||||
}
|
||||
|
||||
pub fn bound_impl_subject(self, def_id: DefId) -> ty::EarlyBinder<ty::ImplSubject<'tcx>> {
|
||||
ty::EarlyBinder(self.impl_subject(def_id))
|
||||
}
|
||||
}
|
||||
|
||||
struct OpaqueTypeExpander<'tcx> {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue