pub trait ClosureRegionRequirementsExt<'tcx> {
fn apply_requirements(
&self,
tcx: TyCtxt<'tcx>,
closure_def_id: DefId,
closure_substs: SubstsRef<'tcx>
) -> Vec<QueryOutlivesConstraint<'tcx>>;
}
Required Methods
sourcefn apply_requirements(
fn apply_requirements(
&self,
tcx: TyCtxt<'tcx>,
closure_def_id: DefId,
closure_substs: SubstsRef<'tcx>
) -> Vec<QueryOutlivesConstraint<'tcx>>
Implementations on Foreign Types
sourceimpl<'tcx> ClosureRegionRequirementsExt<'tcx> for ClosureRegionRequirements<'tcx>
impl<'tcx> ClosureRegionRequirementsExt<'tcx> for ClosureRegionRequirements<'tcx>
sourcefn apply_requirements(
&self,
tcx: TyCtxt<'tcx>,
closure_def_id: DefId,
closure_substs: SubstsRef<'tcx>
) -> Vec<QueryOutlivesConstraint<'tcx>>
fn apply_requirements(
&self,
tcx: TyCtxt<'tcx>,
closure_def_id: DefId,
closure_substs: SubstsRef<'tcx>
) -> Vec<QueryOutlivesConstraint<'tcx>>
Given an instance T of the closure type, this method instantiates the “extra” requirements that we computed for the closure into the inference context. This has the effect of adding new outlives obligations to existing variables.
As described on ClosureRegionRequirements
, the extra
requirements are expressed in terms of regionvids that index
into the free regions that appear on the closure type. So, to
do this, we first copy those regions out from the type T into
a vector. Then we can just index into that vector to extract
out the corresponding region from T and apply the
requirements.