Struct rustc_trans::middle::mem_categorization::MemCategorizationContext
[−]
[src]
pub struct MemCategorizationContext<'a, 'gcx, 'tcx> where 'gcx: 'a, 'gcx: 'tcx, 'tcx: 'a {
pub infcx: &'a InferCtxt<'a, 'gcx, 'tcx>,
}rustc_private)Fields
infcx: &'a InferCtxt<'a, 'gcx, 'tcx>
rustc_private)Methods
impl<'a, 'gcx, 'tcx> MemCategorizationContext<'a, 'gcx, 'tcx>
fn new(infcx: &'a InferCtxt<'a, 'gcx, 'tcx>) -> MemCategorizationContext<'a, 'gcx, 'tcx>
fn cat_expr(&self, expr: &Expr) -> Result<Rc<cmt_<'tcx>>, ()>
fn cat_expr_autoderefd(&self, expr: &Expr, autoderefs: usize) -> Result<Rc<cmt_<'tcx>>, ()>
fn cat_expr_unadjusted(&self, expr: &Expr) -> Result<Rc<cmt_<'tcx>>, ()>
fn cat_def(&self, id: u32, span: Span, expr_ty: &'tcx TyS<'tcx>, def: Def) -> Result<Rc<cmt_<'tcx>>, ()>
fn temporary_scope(&self, id: u32) -> Region
rustc_private)Returns the lifetime of a temporary created by expr with id id.
This could be 'static if id is part of a constant expression.
fn cat_rvalue_node(&self, id: u32, span: Span, expr_ty: &'tcx TyS<'tcx>) -> Rc<cmt_<'tcx>>
fn cat_rvalue(&self, cmt_id: u32, span: Span, temp_scope: Region, expr_ty: &'tcx TyS<'tcx>) -> Rc<cmt_<'tcx>>
fn cat_field<N>(&self, node: &N, base_cmt: Rc<cmt_<'tcx>>, f_name: Name, f_ty: &'tcx TyS<'tcx>) -> Rc<cmt_<'tcx>> where N: ast_node
fn cat_tup_field<N>(&self, node: &N, base_cmt: Rc<cmt_<'tcx>>, f_idx: usize, f_ty: &'tcx TyS<'tcx>) -> Rc<cmt_<'tcx>> where N: ast_node
fn cat_index<N>(&self, elt: &N, base_cmt: Rc<cmt_<'tcx>>, context: InteriorOffsetKind) -> Result<Rc<cmt_<'tcx>>, ()> where N: ast_node
rustc_private)Creates a cmt for an indexing operation ([]).
One subtle aspect of indexing that may not be
immediately obvious: for anything other than a fixed-length
vector, an operation like x[y] actually consists of two
disjoint (from the point of view of borrowck) operations.
The first is a deref of x to create a pointer p that points
at the first element in the array. The second operation is
an index which adds y*sizeof(T) to p to obtain the
pointer to x[y]. cat_index will produce a resulting
cmt containing both this deref and the indexing,
presuming that base_cmt is not of fixed-length type.
Parameters
elt: the AST node being indexedbase_cmt: the cmt ofelt
fn cat_slice_pattern(&self, vec_cmt: Rc<cmt_<'tcx>>, slice_pat: &Pat) -> Result<(Rc<cmt_<'tcx>>, Mutability, Region), ()>
rustc_private)Given a pattern P like: [_, ..Q, _], where vec_cmt is the cmt for P, slice_pat is
the pattern Q, returns:
- a cmt for
Q - the mutability and region of the slice
Q
These last two bits of info happen to be things that borrowck needs.
fn cat_imm_interior<N>(&self, node: &N, base_cmt: Rc<cmt_<'tcx>>, interior_ty: &'tcx TyS<'tcx>, interior: InteriorKind) -> Rc<cmt_<'tcx>> where N: ast_node
fn cat_downcast<N>(&self, node: &N, base_cmt: Rc<cmt_<'tcx>>, downcast_ty: &'tcx TyS<'tcx>, variant_did: DefId) -> Rc<cmt_<'tcx>> where N: ast_node
fn cat_pattern<F>(&self, cmt: Rc<cmt_<'tcx>>, pat: &Pat, op: F) -> Result<(), ()> where F: FnMut(&MemCategorizationContext<'a, 'gcx, 'tcx>, Rc<cmt_<'tcx>>, &Pat) -> ()
Trait Implementations
Derived Implementations
impl<'a, 'gcx, 'tcx> Clone for MemCategorizationContext<'a, 'gcx, 'tcx> where 'gcx: 'a, 'gcx: 'tcx, 'tcx: 'a
fn clone(&self) -> MemCategorizationContext<'a, 'gcx, '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