pub fn universally_quantify_polytype(&self,
                                         polytype: ty_param_bounds_and_ty)
                                         -> UniversalQuantificationResult {
        let regions = match polytype.generics.region_param {
            None => opt_vec::Empty,
            Some(_) => {
                opt_vec::with(
                    self.inference_context.next_region_var(
                        infer::BoundRegionInCoherence))
            }
        };

        let bounds_count = polytype.generics.type_param_defs.len();
        let type_parameters = self.inference_context.next_ty_vars(bounds_count);

        let substitutions = substs {
            regions: ty::NonerasedRegions(regions),
            self_ty: None,
            tps: type_parameters
        };
        let monotype = subst(self.crate_context.tcx,
                             &substitutions,
                             polytype.ty);

        UniversalQuantificationResult {
            monotype: monotype,
            type_variables: substitutions.tps,
            type_param_defs: polytype.generics.type_param_defs
        }
    }
// Converts a polytype to a monotype by replacing all parameters with
// type variables. Returns the monotype and the type variables created.
Converts a polytype to a monotype by replacing all parameters with
type variables. Returns the monotype and the type variables created.
Converts a polytype to a monotype by replacing all parameters with type variables . Returns the monotype and the type variables created .
pub fn universally_quantify_polytype(&self,
                                         polytype: ty_param_bounds_and_ty)
                                         -> UniversalQuantificationResult {
        let regions = match polytype.generics.region_param {
            None => opt_vec::Empty,
            Some(_) => {
                opt_vec::with(
                    self.inference_context.next_region_var(
                        infer::BoundRegionInCoherence))
            }
        };
        let bounds_count = polytype.generics.type_param_defs.len();
        let type_parameters = self.inference_context.next_ty_vars(bounds_count);
        let substitutions = substs {
            regions: ty::NonerasedRegions(regions),
            self_ty: None,
            tps: type_parameters
        };
        let monotype = subst(self.crate_context.tcx,
                             &substitutions,
                             polytype.ty);
        UniversalQuantificationResult {
            monotype: monotype,
            type_variables: substitutions.tps,
            type_param_defs: polytype.generics.type_param_defs
        }
    }
pub fn universally_quantify_polytype ( & self , polytype : ty_param_bounds_and_ty ) -> UniversalQuantificationResult { let regions = match polytype . generics . region_param { None => opt_vec :: Empty , Some ( _ ) => { opt_vec :: with ( self . inference_context . next_region_var ( infer :: BoundRegionInCoherence ) ) } } ; let bounds_count = polytype . generics . type_param_defs . len ( ) ; let type_parameters = self . inference_context . next_ty_vars ( bounds_count ) ; let substitutions = substs { regions : ty :: NonerasedRegions ( regions ) , self_ty : None , tps : type_parameters } ; let monotype = subst ( self . crate_context . tcx , & substitutions , polytype . ty ) ; UniversalQuantificationResult { monotype : monotype , type_variables : substitutions . tps , type_param_defs : polytype . generics . type_param_defs } }
Converts a polytype to a monotype by replacing all parameters with
type variables.
Converts a polytype to a monotype by replacing all parameters with type variables .
&self
polytype
ty_param_bounds_and_ty
&self
polytype
ty_param_bounds_and_ty