Struct rustc_trans::middle::mem_categorization::MemCategorizationContextExperimental
[-]
[+]
[src]
pub struct MemCategorizationContext<'t, TYPER: 't> { // some fields omitted }
Methods
impl<'t, 'tcx, TYPER: Typer<'tcx>> MemCategorizationContext<'t, TYPER>
fn new(typer: &'t TYPER) -> MemCategorizationContext<'t, TYPER>
fn cat_expr(&self, expr: &Expr) -> Rc<cmt_<'tcx>>
fn cat_expr_autoderefd(&self, expr: &Expr, autoderefs: uint) -> Rc<cmt_<'tcx>>
fn cat_expr_unadjusted(&self, expr: &Expr) -> Rc<cmt_<'tcx>>
fn cat_def(&self, id: u32, span: Span, expr_ty: &'tcx TyS<'tcx>, def: Def) -> Rc<cmt_<'tcx>>
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: ast_node>(&self, node: &N, base_cmt: Rc<cmt_<'tcx>>, f_name: Name, f_ty: &'tcx TyS<'tcx>) -> Rc<cmt_<'tcx>>
fn cat_tup_field<N: ast_node>(&self, node: &N, base_cmt: Rc<cmt_<'tcx>>, f_idx: uint, f_ty: &'tcx TyS<'tcx>) -> Rc<cmt_<'tcx>>
fn cat_index<N: ast_node>(&self, elt: &N, base_cmt: Rc<cmt_<'tcx>>) -> Rc<cmt_<'tcx>>
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) -> (Rc<cmt_<'tcx>>, Mutability, Region)
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.