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>>, }
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>
rustc_private
)See construct_free_substs
for details.
implicit_region_bound: &'tcx Region
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>>
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
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.
is_copy_cache: RefCell<FxHashMap<Ty<'tcx>, bool>>
rustc_private
)A cache for moves_by_default
.
is_sized_cache: RefCell<FxHashMap<Ty<'tcx>, bool>>
rustc_private
)A cache for type_is_sized
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>
tcx: TyCtxt<'a, 'tcx, 'tcx>,
self_type: Ty<'tcx>,
span: Span)
-> Result<(), CopyImplementationError>
rustc_private
)impl<'a, 'tcx> ParameterEnvironment<'tcx>
[src]
fn with_caller_bounds(&self,
caller_bounds: Vec<Predicate<'tcx>>)
-> ParameterEnvironment<'tcx>
caller_bounds: Vec<Predicate<'tcx>>)
-> ParameterEnvironment<'tcx>
rustc_private
)fn for_item(tcx: TyCtxt<'a, 'tcx, 'tcx>,
id: NodeId)
-> ParameterEnvironment<'tcx>
id: NodeId)
-> ParameterEnvironment<'tcx>
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]
fn to_parts(self,
_: TyCtxt<'a, 'tcx, 'tcx>)
-> (Option<&'a TypeckTables<'tcx>>, Option<TypeckTables<'tcx>>, Option<ParameterEnvironment<'tcx>>)
_: TyCtxt<'a, 'tcx, 'tcx>)
-> (Option<&'a TypeckTables<'tcx>>, Option<TypeckTables<'tcx>>, Option<ParameterEnvironment<'tcx>>)
rustc_private
)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