Function rustc_trait_selection::traits::wf::required_region_bounds
source ยท pub(crate) fn required_region_bounds<'tcx>(
tcx: TyCtxt<'tcx>,
erased_self_ty: Ty<'tcx>,
predicates: impl Iterator<Item = Clause<'tcx>>,
) -> Vec<Region<'tcx>>
Expand description
Given a set of predicates that apply to an object type, returns
the region bounds that the (erased) Self
type must
outlive. Precisely because the Self
type is erased, the
parameter erased_self_ty
must be supplied to indicate what type
has been used to represent Self
in the predicates
themselves. This should really be a unique type; FreshTy(0)
is a
popular choice.
N.B., in some cases, particularly around higher-ranked bounds,
this function returns a kind of conservative approximation.
That is, all regions returned by this function are definitely
required, but there may be other region bounds that are not
returned, as well as requirements like for<'a> T: 'a
.
Requires that trait definitions have been processed so that we can elaborate predicates and walk supertraits.