/// Constructs and returns a substitution that can be applied to move from
/// the "outer" view of a type or method to the "inner" view.
/// In general, this means converting from bound parameters to
/// free parameters. Since we currently represent bound/free type
/// parameters in the same way, this only has an effect on regions.
Constructs and returns a substitution that can be applied to move from
the "outer" view of a type or method to the "inner" view.
In general, this means converting from bound parameters to
free parameters. Since we currently represent bound/free type
parameters in the same way, this only has an effect on regions.
Constructs and returns a substitution that can be applied to move from the " outer " view of a type or method to the " inner " view . In general this means converting from bound parameters to free parameters . Since we currently represent bound / free type parameters in the same way this only has an effect on regions .
pub fn construct_free_substs(&self, generics: &Generics<'tcx>,
                                 free_id: NodeId) -> Substs<'tcx> {
        // map T => T
        let mut types = VecPerParamSpace::empty();
        for def in generics.types.as_slice() {
            debug!("construct_parameter_environment(): push_types_from_defs: def={:?}",
                    def);
            types.push(def.space, self.mk_param_from_def(def));
        }
        let free_id_outlive = self.region_maps.item_extent(free_id);
        // map bound 'a => free 'a
        let mut regions = VecPerParamSpace::empty();
        for def in generics.regions.as_slice() {
            let region =
                ReFree(FreeRegion { scope: free_id_outlive,
                                    bound_region: BrNamed(def.def_id, def.name) });
            debug!("push_region_params {:?}", region);
            regions.push(def.space, region);
        }
        Substs {
            types: types,
            regions: subst::NonerasedRegions(regions)
        }
    }
pub fn construct_free_substs ( & self , generics : & Generics < ' tcx > , free_id : NodeId ) -> Substs < ' tcx > { // map T => T let mut types = VecPerParamSpace :: empty ( ) ; for def in generics . types . as_slice ( ) { debug ! ( " " def ) ; types . push ( def . space , self . mk_param_from_def ( def ) ) ; } let free_id_outlive = self . region_maps . item_extent ( free_id ) ; // map bound 'a => free 'a let mut regions = VecPerParamSpace :: empty ( ) ; for def in generics . regions . as_slice ( ) { let region = ReFree ( FreeRegion { scope : free_id_outlive , bound_region : BrNamed ( def . def_id , def . name ) } ) ; debug ! ( " " region ) ; regions . push ( def . space , region ) ; } Substs { types : types , regions : subst :: NonerasedRegions ( regions ) } }
Constructs and returns a substitution that can be applied to move from
the "outer" view of a type or method to the "inner" view.
Constructs and returns a substitution that can be applied to move from the " outer " view of a type or method to the " inner " view .
&self
generics
&Generics<'tcx>
free_id
NodeId