pub fn construct_parameter_environment(self,
                                           span: Span,
                                           def_id: DefId,
                                           free_id_outlive: CodeExtent)
                                           -> ParameterEnvironment<'gcx>
    {
        //
        // Construct the free substs.
        //

        let free_substs = self.construct_free_substs(def_id, free_id_outlive);

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

        let tcx = self.global_tcx();
        let generic_predicates = tcx.item_predicates(def_id);
        let bounds = generic_predicates.instantiate(tcx, free_substs);
        let bounds = tcx.liberate_late_bound_regions(free_id_outlive, &ty::Binder(bounds));
        let predicates = bounds.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 {
            free_substs: free_substs,
            implicit_region_bound: tcx.mk_region(ty::ReScope(free_id_outlive)),
            caller_bounds: predicates,
            free_id_outlive: free_id_outlive,
            is_copy_cache: RefCell::new(FxHashMap()),
            is_sized_cache: RefCell::new(FxHashMap()),
        };

        let cause = traits::ObligationCause::misc(span, free_id_outlive.node_id(&self.region_maps));
        traits::normalize_param_env_or_error(tcx, unnormalized_env, cause)
    }
/// See `ParameterEnvironment` struct def'n for details.
/// If you were using `free_id: NodeId`, you might try `self.region_maps.item_extent(free_id)`
/// for the `free_id_outlive` parameter. (But note that this is not always quite right.)
See `ParameterEnvironment` struct def'n for details.
See ` ParameterEnvironment ` struct def ' n for details .
pub fn construct_parameter_environment(self,
                                           span: Span,
                                           def_id: DefId,
                                           free_id_outlive: CodeExtent)
                                           -> ParameterEnvironment<'gcx>
    {
        //
        // Construct the free substs.
        //
        let free_substs = self.construct_free_substs(def_id, free_id_outlive);
        //
        // Compute the bounds on Self and the type parameters.
        //
        let tcx = self.global_tcx();
        let generic_predicates = tcx.item_predicates(def_id);
        let bounds = generic_predicates.instantiate(tcx, free_substs);
        let bounds = tcx.liberate_late_bound_regions(free_id_outlive, &ty::Binder(bounds));
        let predicates = bounds.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 {
            free_substs: free_substs,
            implicit_region_bound: tcx.mk_region(ty::ReScope(free_id_outlive)),
            caller_bounds: predicates,
            free_id_outlive: free_id_outlive,
            is_copy_cache: RefCell::new(FxHashMap()),
            is_sized_cache: RefCell::new(FxHashMap()),
        };
        let cause = traits::ObligationCause::misc(span, free_id_outlive.node_id(&self.region_maps));
        traits::normalize_param_env_or_error(tcx, unnormalized_env, cause)
    }
pub fn construct_parameter_environment ( self , span : Span , def_id : DefId , free_id_outlive : CodeExtent ) -> ParameterEnvironment < ' gcx > { // // Construct the free substs. // let free_substs = self . construct_free_substs ( def_id , free_id_outlive ) ; // // Compute the bounds on Self and the type parameters. // let tcx = self . global_tcx ( ) ; let generic_predicates = tcx . item_predicates ( def_id ) ; let bounds = generic_predicates . instantiate ( tcx , free_substs ) ; let bounds = tcx . liberate_late_bound_regions ( free_id_outlive , & ty :: Binder ( bounds ) ) ; let predicates = bounds . 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 { free_substs : free_substs , implicit_region_bound : tcx . mk_region ( ty :: ReScope ( free_id_outlive ) ) , caller_bounds : predicates , free_id_outlive : free_id_outlive , is_copy_cache : RefCell :: new ( FxHashMap ( ) ) , is_sized_cache : RefCell :: new ( FxHashMap ( ) ) , } ; let cause = traits :: ObligationCause :: misc ( span , free_id_outlive . node_id ( & self . region_maps ) ) ; traits :: normalize_param_env_or_error ( tcx , unnormalized_env , cause ) }
See `ParameterEnvironment` struct def'n for details.
See ` ParameterEnvironment ` struct def ' n for details .
self
span
Span
def_id
DefId
free_id_outlive
CodeExtent