Struct rustc_trans::middle::ty::ParameterEnvironmentExperimental [-]  [+] [src]

pub struct ParameterEnvironment<'tcx> {
    pub free_substs: Substs<'tcx>,
    pub implicit_region_bound: Region,
    pub caller_bounds: GenericBounds<'tcx>,
    pub selection_cache: SelectionCache<'tcx>,
}

When type checking, we use the ParameterEnvironment to track details about the type/lifetime parameters that are in scope. It primarily stores the bounds information.

Note: This information might seem to be redundant with the data in tcx.ty_param_defs, but it is not. That table contains the parameter definitions from an "outside" perspective, but this struct will contain the bounds for a parameter as seen from inside the function body. Currently the only real distinction is that bound lifetime parameters are replaced with free ones, but in the future I hope to refine the representation of types so as to make more distinctions clearer.

Fields

free_substs

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.

implicit_region_bound

Each type parameter has an implicit region bound that indicates it must outlive at least the function body (the user may specify stronger requirements). This field indicates the region of the callee.

caller_bounds

Obligations that the caller must satisfy. This is basically the set of bounds on the in-scope type parameters, translated into Obligations.

selection_cache

Caches the results of trait selection. This cache is used for things that have to do with the parameters in scope.

Methods

impl<'tcx> ParameterEnvironment<'tcx>

fn for_item(cx: &ctxt<'tcx>, id: u32) -> ParameterEnvironment<'tcx>

Trait Implementations

Derived Implementations

impl<'tcx> Clone for ParameterEnvironment<'tcx>

fn clone(&self) -> ParameterEnvironment<'tcx>

fn clone_from(&mut self, &ParameterEnvironment<'tcx>)