pub fn make_query_outlives<'tcx>(
    tcx: TyCtxt<'_, '_, 'tcx>,
    region_obligations: Vec<(ast::NodeId, RegionObligation<'tcx>)>,
    region_constraints: &RegionConstraintData<'tcx>,
) -> Vec<QueryRegionConstraint<'tcx>> {
    let RegionConstraintData {
        constraints,
        verifys,
        givens,
    } = region_constraints;

    assert!(verifys.is_empty());
    assert!(givens.is_empty());

    let mut outlives: Vec<_> = constraints
            .into_iter()
            .map(|(k, _)| match *k {
                // Swap regions because we are going from sub (<=) to outlives
                // (>=).
                Constraint::VarSubVar(v1, v2) => ty::OutlivesPredicate(
                    tcx.mk_region(ty::ReVar(v2)).into(),
                    tcx.mk_region(ty::ReVar(v1)),
                ),
                Constraint::VarSubReg(v1, r2) => {
                    ty::OutlivesPredicate(r2.into(), tcx.mk_region(ty::ReVar(v1)))
                }
                Constraint::RegSubVar(r1, v2) => {
                    ty::OutlivesPredicate(tcx.mk_region(ty::ReVar(v2)).into(), r1)
                }
                Constraint::RegSubReg(r1, r2) => ty::OutlivesPredicate(r2.into(), r1),
            })
            .map(ty::Binder::dummy) // no bound regions in the code above
            .collect();

    outlives.extend(
        region_obligations
            .into_iter()
            .map(|(_, r_o)| ty::OutlivesPredicate(r_o.sup_type.into(), r_o.sub_region))
            .map(ty::Binder::dummy), // no bound regions in the code above
    );

    outlives
}
/// Given the region obligations and constraints scraped from the infcx,
/// creates query region constraints.
Given the region obligations and constraints scraped from the infcx,
creates query region constraints.
Given the region obligations and constraints scraped from the infcx creates query region constraints .
pub fn make_query_outlives<'tcx>(
    tcx: TyCtxt<'_, '_, 'tcx>,
    region_obligations: Vec<(ast::NodeId, RegionObligation<'tcx>)>,
    region_constraints: &RegionConstraintData<'tcx>,
) -> Vec<QueryRegionConstraint<'tcx>> {
    let RegionConstraintData {
        constraints,
        verifys,
        givens,
    } = region_constraints;
    assert!(verifys.is_empty());
    assert!(givens.is_empty());
    let mut outlives: Vec<_> = constraints
            .into_iter()
            .map(|(k, _)| match *k {
                // Swap regions because we are going from sub (<=) to outlives
                // (>=).
                Constraint::VarSubVar(v1, v2) => ty::OutlivesPredicate(
                    tcx.mk_region(ty::ReVar(v2)).into(),
                    tcx.mk_region(ty::ReVar(v1)),
                ),
                Constraint::VarSubReg(v1, r2) => {
                    ty::OutlivesPredicate(r2.into(), tcx.mk_region(ty::ReVar(v1)))
                }
                Constraint::RegSubVar(r1, v2) => {
                    ty::OutlivesPredicate(tcx.mk_region(ty::ReVar(v2)).into(), r1)
                }
                Constraint::RegSubReg(r1, r2) => ty::OutlivesPredicate(r2.into(), r1),
            })
            .map(ty::Binder::dummy) // no bound regions in the code above
            .collect();
    outlives.extend(
        region_obligations
            .into_iter()
            .map(|(_, r_o)| ty::OutlivesPredicate(r_o.sup_type.into(), r_o.sub_region))
            .map(ty::Binder::dummy), // no bound regions in the code above
    );
    outlives
}
pub fn make_query_outlives < ' tcx > ( tcx : TyCtxt < ' _ , ' _ , ' tcx > , region_obligations : Vec < ( ast :: NodeId , RegionObligation < ' tcx > ) > , region_constraints : & RegionConstraintData < ' tcx > , ) -> Vec < QueryRegionConstraint < ' tcx > > { let RegionConstraintData { constraints , verifys , givens , } = region_constraints ; assert ! ( verifys is_empty ( ) ) ; assert ! ( givens is_empty ( ) ) ; let mut outlives : Vec < _ > = constraints . into_iter ( ) . map ( | ( k , _ ) | match * k { // Swap regions because we are going from sub (<=) to outlives // (>=). Constraint :: VarSubVar ( v1 , v2 ) => ty :: OutlivesPredicate ( tcx . mk_region ( ty :: ReVar ( v2 ) ) . into ( ) , tcx . mk_region ( ty :: ReVar ( v1 ) ) , ) , Constraint :: VarSubReg ( v1 , r2 ) => { ty :: OutlivesPredicate ( r2 . into ( ) , tcx . mk_region ( ty :: ReVar ( v1 ) ) ) } Constraint :: RegSubVar ( r1 , v2 ) => { ty :: OutlivesPredicate ( tcx . mk_region ( ty :: ReVar ( v2 ) ) . into ( ) , r1 ) } Constraint :: RegSubReg ( r1 , r2 ) => ty :: OutlivesPredicate ( r2 . into ( ) , r1 ) , } ) . map ( ty :: Binder :: dummy ) // no bound regions in the code above . collect ( ) ; outlives . extend ( region_obligations . into_iter ( ) . map ( | ( _ , r_o ) | ty :: OutlivesPredicate ( r_o . sup_type . into ( ) , r_o . sub_region ) ) . map ( ty :: Binder :: dummy ) , // no bound regions in the code above ) ; outlives }
Given the region obligations and constraints scraped from the infcx,
creates query region constraints.
Given the region obligations and constraints scraped from the infcx creates query region constraints .
tcx
TyCtxt<'_, '_, 'tcx>
region_obligations
Vec<(ast::NodeId, RegionObligation<'tcx>)>
region_constraints
&RegionConstraintData<'tcx>