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

pub struct ParameterEnvironment<'tcx> {
    pub free_substs: &'tcx Substs<'tcx>,
    pub implicit_region_bound: Region,
    pub caller_bounds: Vec<Predicate<'tcx>>,
    pub free_id_outlive: CodeExtent,
}
Unstable (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

free_substs: &'tcx Substs<'tcx>
Unstable (rustc_private)

See construct_free_substs for details.

implicit_region_bound: Region
Unstable (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.

caller_bounds: Vec<Predicate<'tcx>>
Unstable (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.

free_id_outlive: CodeExtent
Unstable (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.

Methods

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

fn can_type_implement_copy<'a>(&self, tcx: TyCtxt<'a, 'tcx, 'tcx>, self_type: Ty<'tcx>, span: Span) -> Result<()CopyImplementationError>

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

fn with_caller_bounds(&self, caller_bounds: Vec<Predicate<'tcx>>) -> ParameterEnvironment<'tcx>

fn for_item(tcx: TyCtxt<'a, 'tcx, 'tcx>, id: NodeId) -> ParameterEnvironment<'tcx>

Unstable (rustc_private)

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

Trait Implementations

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

fn super_fold_with<'gcx: 'tcx, F: TypeFolder<'gcx, 'tcx>>(&self, folder: &mut F) -> Self

fn super_visit_with<V: TypeVisitor<'tcx>>(&self, visitor: &mut V) -> bool

fn fold_with<'gcx: 'tcx, F: TypeFolder<'gcx, 'tcx>>(&self, folder: &mut F) -> Self

fn visit_with<V: TypeVisitor<'tcx>>(&self, visitor: &mut V) -> bool

fn has_regions_escaping_depth(&self, depth: u32) -> bool

fn has_escaping_regions(&self) -> bool

fn has_type_flags(&self, flags: TypeFlags) -> bool

fn has_projection_types(&self) -> bool

fn references_error(&self) -> bool

fn has_param_types(&self) -> bool

fn has_self_ty(&self) -> bool

fn has_infer_types(&self) -> bool

fn needs_infer(&self) -> bool

fn needs_subst(&self) -> bool

fn has_closure_types(&self) -> bool

fn has_erasable_regions(&self) -> bool

fn is_global(&self) -> bool

Indicates whether this value references only 'global' types/lifetimes that are the same regardless of what fn we are in. This is used for caching. Errs on the side of returning false. Read more

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

fn fmt(&self, f: &mut Formatter) -> Result

Formats the value using the given formatter.

Derived Implementations

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

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

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)
1.0.0

Performs copy-assignment from source. Read more