Struct rustc::middle::ty::ParameterEnvironmentUnstable [-] [+] [src]

pub struct ParameterEnvironment<'a, 'tcx> {
    pub tcx: &'a ctxt<'tcx>,
    pub free_substs: Substs<'tcx>,
    pub implicit_region_bound: Region,
    pub caller_bounds: Vec<Predicate<'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

tcx
free_substs

See construct_free_substs for details.

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<'a, 'tcx> ParameterEnvironment<'a, 'tcx>

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

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

Trait Implementations

impl<'a, 'tcx> Typer<'tcx> for ParameterEnvironment<'a, 'tcx>

fn node_ty(&self, id: NodeId) -> McResult<Ty<'tcx>>

fn expr_ty_adjusted(&self, expr: &Expr) -> McResult<Ty<'tcx>>

fn node_method_ty(&self, method_call: MethodCall) -> Option<Ty<'tcx>>

fn node_method_origin(&self, method_call: MethodCall) -> Option<MethodOrigin<'tcx>>

fn adjustments(&self) -> &RefCell<NodeMap<AutoAdjustment<'tcx>>>

fn is_method_call(&self, id: NodeId) -> bool

fn temporary_scope(&self, rvalue_id: NodeId) -> Option<CodeExtent>

fn upvar_capture(&self, upvar_id: UpvarId) -> Option<UpvarCapture>

fn type_moves_by_default(&self, span: Span, ty: Ty<'tcx>) -> bool

impl<'a, 'tcx> ClosureTyper<'tcx> for ParameterEnvironment<'a, 'tcx>

fn param_env<'b>(&'b self) -> &'b ParameterEnvironment<'b, 'tcx>

fn closure_kind(&self, def_id: DefId) -> Option<ClosureKind>

fn closure_type(&self, def_id: DefId, substs: &Substs<'tcx>) -> ClosureTy<'tcx>

fn closure_upvars(&self, def_id: DefId, substs: &Substs<'tcx>) -> Option<Vec<ClosureUpvar<'tcx>>>

fn tcx(&self) -> &ctxt<'tcx>

impl<'a, 'tcx> Repr<'tcx> for ParameterEnvironment<'a, 'tcx>

fn repr(&self, tcx: &ctxt<'tcx>) -> String

impl<'a, 'tcx> TypeFoldable<'tcx> for ParameterEnvironment<'a, 'tcx> where 'tcx: 'a

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

Derived Implementations

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

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

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