Struct rustc::ty::ParameterEnvironment [] [src]

pub struct ParameterEnvironment<'tcx> {
    pub free_substs: &'tcx Substs<'tcx>,
    pub implicit_region_bound: &'tcx Region,
    pub caller_bounds: Vec<Predicate<'tcx>>,
    pub free_id_outlive: CodeExtent,
    pub is_copy_cache: RefCell<FxHashMap<Ty<'tcx>, bool>>,
    pub is_sized_cache: RefCell<FxHashMap<Ty<'tcx>, bool>>,
}
🔬 This is a nightly-only experimental API. (rustc_private)

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

🔬 This is a nightly-only experimental API. (rustc_private)

See construct_free_substs for details.

🔬 This is a nightly-only experimental API. (rustc_private)

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.

🔬 This is a nightly-only experimental API. (rustc_private)

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

🔬 This is a nightly-only experimental API. (rustc_private)

Scope that is attached to free regions for this scope. This is usually the id of the fn body, but for more abstract scopes like structs we often use the node-id of the struct.

FIXME(#3696). It would be nice to refactor so that free regions don't have this implicit scope and instead introduce relationships in the environment.

🔬 This is a nightly-only experimental API. (rustc_private)

A cache for moves_by_default.

🔬 This is a nightly-only experimental API. (rustc_private)

A cache for type_is_sized

Methods

impl<'tcx> ParameterEnvironment<'tcx>
[src]

🔬 This is a nightly-only experimental API. (rustc_private)

impl<'a, 'tcx> ParameterEnvironment<'tcx>
[src]

🔬 This is a nightly-only experimental API. (rustc_private)

🔬 This is a nightly-only experimental API. (rustc_private)

Construct a parameter environment given an item, impl item, or trait item

Trait Implementations

impl<'a, 'tcx> InferEnv<'a, 'tcx> for ParameterEnvironment<'tcx>
[src]

🔬 This is a nightly-only experimental API. (rustc_private)

impl<'tcx> Clone for ParameterEnvironment<'tcx>
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl<'tcx> Debug for ParameterEnvironment<'tcx>
[src]

Formats the value using the given formatter.