/// Walks the autoref `opt_autoref` applied to the autoderef'd
/// `expr`. `cmt_derefd` is the mem-categorized form of `expr`
/// after all relevant autoderefs have occurred. Because AutoRefs
/// can be recursive, this function is recursive: it first walks
/// deeply all the way down the autoref chain, and then processes
/// the autorefs on the way out. At each point, it returns the
/// `cmt` for the rvalue that will be produced by introduced an
/// autoref.
Walks the autoref `opt_autoref` applied to the autoderef'd
`expr`. `cmt_derefd` is the mem-categorized form of `expr`
after all relevant autoderefs have occurred. Because AutoRefs
can be recursive, this function is recursive: it first walks
deeply all the way down the autoref chain, and then processes
the autorefs on the way out. At each point, it returns the
`cmt` for the rvalue that will be produced by introduced an
autoref.
Walks the autoref ` opt_autoref ` applied to the autoderef ' d ` expr ` . ` cmt_derefd ` is the mem - categorized form of ` expr ` after all relevant autoderefs have occurred . Because AutoRefs can be recursive this function is recursive : it first walks deeply all the way down the autoref chain and then processes the autorefs on the way out . At each point it returns the ` cmt ` for the rvalue that will be produced by introduced an autoref .
fn walk_autoref(&mut self,
                    expr: &hir::Expr,
                    cmt_base: mc::cmt<'tcx>,
                    opt_autoref: Option<ty::AutoRef<'tcx>>)
                    -> mc::cmt<'tcx>
    {
        debug!("walk_autoref(expr.id={} cmt_derefd={:?} opt_autoref={:?})",
               expr.id,
               cmt_base,
               opt_autoref);
        let cmt_base_ty = cmt_base.ty;
        let autoref = match opt_autoref {
            Some(ref autoref) => autoref,
            None => {
                // No AutoRef.
                return cmt_base;
            }
        };
        match *autoref {
            ty::AutoPtr(r, m) => {
                self.delegate.borrow(expr.id,
                                     expr.span,
                                     cmt_base,
                                     *r,
                                     ty::BorrowKind::from_mutbl(m),
                                     AutoRef);
            }
            ty::AutoUnsafe(m) => {
                debug!("walk_autoref: expr.id={} cmt_base={:?}",
                       expr.id,
                       cmt_base);
                // Converting from a &T to *T (or &mut T to *mut T) is
                // treated as borrowing it for the enclosing temporary
                // scope.
                let r = ty::ReScope(self.tcx().region_maps.node_extent(expr.id));
                self.delegate.borrow(expr.id,
                                     expr.span,
                                     cmt_base,
                                     r,
                                     ty::BorrowKind::from_mutbl(m),
                                     AutoUnsafe);
            }
        }
        // Construct the categorization for the result of the autoref.
        // This is always an rvalue, since we are producing a new
        // (temporary) indirection.
        let adj_ty = cmt_base_ty.adjust_for_autoref(self.tcx(), opt_autoref);
        self.mc.cat_rvalue_node(expr.id, expr.span, adj_ty)
    }
fn walk_autoref ( & mut self , expr : & hir :: Expr , cmt_base : mc :: cmt < ' tcx > , opt_autoref : Option < ty :: AutoRef < ' tcx > > ) -> mc :: cmt < ' tcx > { debug ! ( " " expr id cmt_base opt_autoref ) ; let cmt_base_ty = cmt_base . ty ; let autoref = match opt_autoref { Some ( ref autoref ) => autoref , None => { // No AutoRef. return cmt_base ; } } ; match * autoref { ty :: AutoPtr ( r , m ) => { self . delegate . borrow ( expr . id , expr . span , cmt_base , * r , ty :: BorrowKind :: from_mutbl ( m ) , AutoRef ) ; } ty :: AutoUnsafe ( m ) => { debug ! ( " " expr id cmt_base ) ; // Converting from a &T to *T (or &mut T to *mut T) is // treated as borrowing it for the enclosing temporary // scope. let r = ty :: ReScope ( self . tcx ( ) . region_maps . node_extent ( expr . id ) ) ; self . delegate . borrow ( expr . id , expr . span , cmt_base , r , ty :: BorrowKind :: from_mutbl ( m ) , AutoUnsafe ) ; } } // Construct the categorization for the result of the autoref. // This is always an rvalue, since we are producing a new // (temporary) indirection. let adj_ty = cmt_base_ty . adjust_for_autoref ( self . tcx ( ) , opt_autoref ) ; self . mc . cat_rvalue_node ( expr . id , expr . span , adj_ty ) }
Walks the autoref `opt_autoref` applied to the autoderef'd
`expr`.
Walks the autoref ` opt_autoref ` applied to the autoderef ' d ` expr ` .
&mut self
expr
&hir::Expr
cmt_base
mc::cmt<'tcx>
opt_autoref
Option<ty::AutoRef<'tcx>>