Struct rustc_lint::middle::mem_categorization::MemCategorizationContextUnstable [-] [+] [src]

pub struct MemCategorizationContext<'t, TYPER> where TYPER: 't {
    // some fields omitted
}

Methods

impl<'t, 'tcx, TYPER> MemCategorizationContext<'t, TYPER> where TYPER: Typer<'tcx>

fn new(typer: &'t TYPER) -> MemCategorizationContext<'t, TYPER>

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

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

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 indexed
  • base_cmt: the cmt of elt

fn cat_slice_pattern(&self, vec_cmt: Rc<cmt_<'tcx>>, slice_pat: &Pat) -> Result<(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.

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<'t, TYPER>, Rc<cmt_<'tcx>>, &Pat) -> ()

Trait Implementations

impl<'t, TYPER> Copy for MemCategorizationContext<'t, TYPER> where TYPER: 't

impl<'t, TYPER> Clone for MemCategorizationContext<'t, TYPER> where TYPER: 't

fn clone(&self) -> MemCategorizationContext<'t, TYPER>

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