Struct rustc::middle::mem_categorization::MemCategorizationContextUnstable
[-] [+]
[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) -> McResult<cmt<'tcx>>
fn cat_expr_autoderefd(&self, expr: &Expr, autoderefs: usize) -> McResult<cmt<'tcx>>
fn cat_expr_unadjusted(&self, expr: &Expr) -> McResult<cmt<'tcx>>
fn cat_def(&self, id: NodeId, span: Span, expr_ty: Ty<'tcx>, def: Def) -> McResult<cmt<'tcx>>
fn temporary_scope(&self, id: NodeId) -> Region
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: NodeId, span: Span, expr_ty: Ty<'tcx>) -> cmt<'tcx>
fn cat_rvalue(&self, cmt_id: NodeId, span: Span, temp_scope: Region, expr_ty: Ty<'tcx>) -> cmt<'tcx>
fn cat_field<N: ast_node>(&self, node: &N, base_cmt: cmt<'tcx>, f_name: Name, f_ty: Ty<'tcx>) -> cmt<'tcx>
fn cat_tup_field<N: ast_node>(&self, node: &N, base_cmt: cmt<'tcx>, f_idx: usize, f_ty: Ty<'tcx>) -> cmt<'tcx>
fn cat_index<N: ast_node>(&self, elt: &N, base_cmt: cmt<'tcx>, context: InteriorOffsetKind) -> McResult<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: cmt<'tcx>, slice_pat: &Pat) -> McResult<(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.