pub fn construct_parameter_environment<'a>(&'a self,
                                               span: Span,
                                               generics: &ty::Generics<'tcx>,
                                               generic_predicates: &ty::GenericPredicates<'tcx>,
                                               free_id: NodeId)
                                               -> ParameterEnvironment<'a, 'tcx>
    {
        //
        // Construct the free substs.
        //

        let free_substs = self.construct_free_substs(generics, free_id);
        let free_id_outlive = self.region_maps.item_extent(free_id);

        //
        // Compute the bounds on Self and the type parameters.
        //

        let bounds = generic_predicates.instantiate(self, &free_substs);
        let bounds = self.liberate_late_bound_regions(free_id_outlive, &ty::Binder(bounds));
        let predicates = bounds.predicates.into_vec();

        debug!("construct_parameter_environment: free_id={:?} free_subst={:?} predicates={:?}",
               free_id,
               free_substs,
               predicates);

        //
        // Finally, we have to normalize the bounds in the environment, in
        // case they contain any associated type projections. This process
        // can yield errors if the put in illegal associated types, like
        // `<i32 as Foo>::Bar` where `i32` does not implement `Foo`. We
        // report these errors right here; this doesn't actually feel
        // right to me, because constructing the environment feels like a
        // kind of a "idempotent" action, but I'm not sure where would be
        // a better place. In practice, we construct environments for
        // every fn once during type checking, and we'll abort if there
        // are any errors at that point, so after type checking you can be
        // sure that this will succeed without errors anyway.
        //

        let unnormalized_env = ty::ParameterEnvironment {
            tcx: self,
            free_substs: free_substs,
            implicit_region_bound: ty::ReScope(free_id_outlive),
            caller_bounds: predicates,
            selection_cache: traits::SelectionCache::new(),
            free_id: free_id,
        };

        let cause = traits::ObligationCause::misc(span, free_id);
        traits::normalize_param_env_or_error(unnormalized_env, cause)
    }
/// See `ParameterEnvironment` struct def'n for details
See `ParameterEnvironment` struct def'n for details
See ` ParameterEnvironment ` struct def ' n for details
pub fn construct_parameter_environment<'a>(&'a self,
                                               span: Span,
                                               generics: &ty::Generics<'tcx>,
                                               generic_predicates: &ty::GenericPredicates<'tcx>,
                                               free_id: NodeId)
                                               -> ParameterEnvironment<'a, 'tcx>
    {
        //
        // Construct the free substs.
        //
        let free_substs = self.construct_free_substs(generics, free_id);
        let free_id_outlive = self.region_maps.item_extent(free_id);
        //
        // Compute the bounds on Self and the type parameters.
        //
        let bounds = generic_predicates.instantiate(self, &free_substs);
        let bounds = self.liberate_late_bound_regions(free_id_outlive, &ty::Binder(bounds));
        let predicates = bounds.predicates.into_vec();
        debug!("construct_parameter_environment: free_id={:?} free_subst={:?} predicates={:?}",
               free_id,
               free_substs,
               predicates);
        //
        // Finally, we have to normalize the bounds in the environment, in
        // case they contain any associated type projections. This process
        // can yield errors if the put in illegal associated types, like
        // `<i32 as Foo>::Bar` where `i32` does not implement `Foo`. We
        // report these errors right here; this doesn't actually feel
        // right to me, because constructing the environment feels like a
        // kind of a "idempotent" action, but I'm not sure where would be
        // a better place. In practice, we construct environments for
        // every fn once during type checking, and we'll abort if there
        // are any errors at that point, so after type checking you can be
        // sure that this will succeed without errors anyway.
        //
        let unnormalized_env = ty::ParameterEnvironment {
            tcx: self,
            free_substs: free_substs,
            implicit_region_bound: ty::ReScope(free_id_outlive),
            caller_bounds: predicates,
            selection_cache: traits::SelectionCache::new(),
            free_id: free_id,
        };
        let cause = traits::ObligationCause::misc(span, free_id);
        traits::normalize_param_env_or_error(unnormalized_env, cause)
    }
pub fn construct_parameter_environment < ' a > ( & ' a self , span : Span , generics : & ty :: Generics < ' tcx > , generic_predicates : & ty :: GenericPredicates < ' tcx > , free_id : NodeId ) -> ParameterEnvironment < ' a , ' tcx > { // // Construct the free substs. // let free_substs = self . construct_free_substs ( generics , free_id ) ; let free_id_outlive = self . region_maps . item_extent ( free_id ) ; // // Compute the bounds on Self and the type parameters. // let bounds = generic_predicates . instantiate ( self , & free_substs ) ; let bounds = self . liberate_late_bound_regions ( free_id_outlive , & ty :: Binder ( bounds ) ) ; let predicates = bounds . predicates . into_vec ( ) ; debug ! ( " " free_id free_substs predicates ) ; // // Finally, we have to normalize the bounds in the environment, in // case they contain any associated type projections. This process // can yield errors if the put in illegal associated types, like // `<i32 as Foo>::Bar` where `i32` does not implement `Foo`. We // report these errors right here; this doesn't actually feel // right to me, because constructing the environment feels like a // kind of a "idempotent" action, but I'm not sure where would be // a better place. In practice, we construct environments for // every fn once during type checking, and we'll abort if there // are any errors at that point, so after type checking you can be // sure that this will succeed without errors anyway. // let unnormalized_env = ty :: ParameterEnvironment { tcx : self , free_substs : free_substs , implicit_region_bound : ty :: ReScope ( free_id_outlive ) , caller_bounds : predicates , selection_cache : traits :: SelectionCache :: new ( ) , free_id : free_id , } ; let cause = traits :: ObligationCause :: misc ( span , free_id ) ; traits :: normalize_param_env_or_error ( unnormalized_env , cause ) }
See `ParameterEnvironment` struct def'n for details
See ` ParameterEnvironment ` struct def ' n for details
&'a self
span
Span
generics
&ty::Generics<'tcx>
generic_predicates
&ty::GenericPredicates<'tcx>
free_id
NodeId
&'a self
span
Span
generics
&ty::Generics<'tcx>
generic_predicates
&ty::GenericPredicates<'tcx>
free_id
NodeId