/// Determines whether one region is a subregion of another.  This is intended to run *after
/// inference* and sadly the logic is somewhat duplicated with the code in infer.rs.
Determines whether one region is a subregion of another.  This is intended to run *after
inference* and sadly the logic is somewhat duplicated with the code in infer.rs.
Determines whether one region is a subregion of another . This is intended to run * after inference * and sadly the logic is somewhat duplicated with the code in infer . rs .
pub fn is_subregion_of(&self,
                           tcx: TyCtxt,
                           sub_region: ty::Region,
                           super_region: ty::Region)
                           -> bool {
        let result = sub_region == super_region || {
            match (sub_region, super_region) {
                (ty::ReEmpty, _) |
                (_, ty::ReStatic) =>
                    true,
                (ty::ReScope(sub_scope), ty::ReScope(super_scope)) =>
                    tcx.region_maps.is_subscope_of(sub_scope, super_scope),
                (ty::ReScope(sub_scope), ty::ReFree(fr)) =>
                    tcx.region_maps.is_subscope_of(sub_scope, fr.scope) ||
                    self.is_static(fr),
                (ty::ReFree(sub_fr), ty::ReFree(super_fr)) =>
                    self.sub_free_region(sub_fr, super_fr),
                (ty::ReStatic, ty::ReFree(sup_fr)) =>
                    self.is_static(sup_fr),
                _ =>
                    false,
            }
        };
        debug!("is_subregion_of(sub_region={:?}, super_region={:?}) = {:?}",
               sub_region, super_region, result);
        result
    }
pub fn is_subregion_of ( & self , tcx : TyCtxt , sub_region : ty :: Region , super_region : ty :: Region ) -> bool { let result = sub_region == super_region || { match ( sub_region , super_region ) { ( ty :: ReEmpty , _ ) | ( _ , ty :: ReStatic ) => true , ( ty :: ReScope ( sub_scope ) , ty :: ReScope ( super_scope ) ) => tcx . region_maps . is_subscope_of ( sub_scope , super_scope ) , ( ty :: ReScope ( sub_scope ) , ty :: ReFree ( fr ) ) => tcx . region_maps . is_subscope_of ( sub_scope , fr . scope ) || self . is_static ( fr ) , ( ty :: ReFree ( sub_fr ) , ty :: ReFree ( super_fr ) ) => self . sub_free_region ( sub_fr , super_fr ) , ( ty :: ReStatic , ty :: ReFree ( sup_fr ) ) => self . is_static ( sup_fr ) , _ => false , } } ; debug ! ( " " sub_region super_region result ) ; result }
Determines whether one region is a subregion of another.
Determines whether one region is a subregion of another .
&self
tcx
TyCtxt
sub_region
ty::Region
super_region
ty::Region