@@ -21,15 +21,15 @@ use syntax_pos::Span;
2121/// This trait defines the callbacks you can expect to receive when
2222/// employing the ExprUseVisitor.
2323pub trait Delegate < ' tcx > {
24- // The value found at `cmt ` is either copied or moved, depending
24+ // The value found at `place ` is either copied or moved, depending
2525 // on mode.
26- fn consume ( & mut self , cmt : & mc:: Place < ' tcx > , mode : ConsumeMode ) ;
26+ fn consume ( & mut self , place : & mc:: Place < ' tcx > , mode : ConsumeMode ) ;
2727
28- // The value found at `cmt ` is being borrowed with kind `bk`.
29- fn borrow ( & mut self , cmt : & mc:: Place < ' tcx > , bk : ty:: BorrowKind ) ;
28+ // The value found at `place ` is being borrowed with kind `bk`.
29+ fn borrow ( & mut self , place : & mc:: Place < ' tcx > , bk : ty:: BorrowKind ) ;
3030
31- // The path at `cmt ` is being assigned to.
32- fn mutate ( & mut self , assignee_cmt : & mc:: Place < ' tcx > ) ;
31+ // The path at `place ` is being assigned to.
32+ fn mutate ( & mut self , assignee_place : & mc:: Place < ' tcx > ) ;
3333}
3434
3535#[ derive( Copy , Clone , PartialEq , Debug ) ]
@@ -163,22 +163,22 @@ impl<'a, 'tcx> ExprUseVisitor<'a, 'tcx> {
163163 pub fn consume_expr ( & mut self , expr : & hir:: Expr ) {
164164 debug ! ( "consume_expr(expr={:?})" , expr) ;
165165
166- let cmt = return_if_err ! ( self . mc. cat_expr( expr) ) ;
167- self . delegate_consume ( & cmt ) ;
166+ let place = return_if_err ! ( self . mc. cat_expr( expr) ) ;
167+ self . delegate_consume ( & place ) ;
168168 self . walk_expr ( expr) ;
169169 }
170170
171171 fn mutate_expr ( & mut self , expr : & hir:: Expr ) {
172- let cmt = return_if_err ! ( self . mc. cat_expr( expr) ) ;
173- self . delegate . mutate ( & cmt ) ;
172+ let place = return_if_err ! ( self . mc. cat_expr( expr) ) ;
173+ self . delegate . mutate ( & place ) ;
174174 self . walk_expr ( expr) ;
175175 }
176176
177177 fn borrow_expr ( & mut self , expr : & hir:: Expr , bk : ty:: BorrowKind ) {
178178 debug ! ( "borrow_expr(expr={:?}, bk={:?})" , expr, bk) ;
179179
180- let cmt = return_if_err ! ( self . mc. cat_expr( expr) ) ;
181- self . delegate . borrow ( & cmt , bk) ;
180+ let place = return_if_err ! ( self . mc. cat_expr( expr) ) ;
181+ self . delegate . borrow ( & place , bk) ;
182182
183183 self . walk_expr ( expr)
184184 }
@@ -230,12 +230,12 @@ impl<'a, 'tcx> ExprUseVisitor<'a, 'tcx> {
230230 }
231231
232232 hir:: ExprKind :: Match ( ref discr, ref arms, _) => {
233- let discr_cmt = return_if_err ! ( self . mc. cat_expr( & discr) ) ;
233+ let discr_place = return_if_err ! ( self . mc. cat_expr( & discr) ) ;
234234 self . borrow_expr ( & discr, ty:: ImmBorrow ) ;
235235
236236 // treatment of the discriminant is handled while walking the arms.
237237 for arm in arms {
238- self . walk_arm ( & discr_cmt , arm) ;
238+ self . walk_arm ( & discr_place , arm) ;
239239 }
240240 }
241241
@@ -381,8 +381,8 @@ impl<'a, 'tcx> ExprUseVisitor<'a, 'tcx> {
381381 // "assigns", which is handled by
382382 // `walk_pat`:
383383 self . walk_expr ( & expr) ;
384- let init_cmt = return_if_err ! ( self . mc. cat_expr( & expr) ) ;
385- self . walk_irrefutable_pat ( & init_cmt , & local. pat ) ;
384+ let init_place = return_if_err ! ( self . mc. cat_expr( & expr) ) ;
385+ self . walk_irrefutable_pat ( & init_place , & local. pat ) ;
386386 }
387387 }
388388
@@ -457,15 +457,15 @@ impl<'a, 'tcx> ExprUseVisitor<'a, 'tcx> {
457457 // process.
458458 fn walk_adjustment ( & mut self , expr : & hir:: Expr ) {
459459 let adjustments = self . mc . tables . expr_adjustments ( expr) ;
460- let mut cmt = return_if_err ! ( self . mc. cat_expr_unadjusted( expr) ) ;
460+ let mut place = return_if_err ! ( self . mc. cat_expr_unadjusted( expr) ) ;
461461 for adjustment in adjustments {
462462 debug ! ( "walk_adjustment expr={:?} adj={:?}" , expr, adjustment) ;
463463 match adjustment. kind {
464464 adjustment:: Adjust :: NeverToAny |
465465 adjustment:: Adjust :: Pointer ( _) => {
466466 // Creating a closure/fn-pointer or unsizing consumes
467467 // the input and stores it into the resulting rvalue.
468- self . delegate_consume ( & cmt ) ;
468+ self . delegate_consume ( & place ) ;
469469 }
470470
471471 adjustment:: Adjust :: Deref ( None ) => { }
@@ -477,41 +477,41 @@ impl<'a, 'tcx> ExprUseVisitor<'a, 'tcx> {
477477 // this is an autoref of `x`.
478478 adjustment:: Adjust :: Deref ( Some ( ref deref) ) => {
479479 let bk = ty:: BorrowKind :: from_mutbl ( deref. mutbl ) ;
480- self . delegate . borrow ( & cmt , bk) ;
480+ self . delegate . borrow ( & place , bk) ;
481481 }
482482
483483 adjustment:: Adjust :: Borrow ( ref autoref) => {
484- self . walk_autoref ( expr, & cmt , autoref) ;
484+ self . walk_autoref ( expr, & place , autoref) ;
485485 }
486486 }
487- cmt = return_if_err ! ( self . mc. cat_expr_adjusted( expr, cmt , & adjustment) ) ;
487+ place = return_if_err ! ( self . mc. cat_expr_adjusted( expr, place , & adjustment) ) ;
488488 }
489489 }
490490
491491 /// Walks the autoref `autoref` applied to the autoderef'd
492- /// `expr`. `cmt_base ` is the mem-categorized form of `expr`
492+ /// `expr`. `base_place ` is the mem-categorized form of `expr`
493493 /// after all relevant autoderefs have occurred.
494494 fn walk_autoref ( & mut self ,
495495 expr : & hir:: Expr ,
496- cmt_base : & mc:: Place < ' tcx > ,
496+ base_place : & mc:: Place < ' tcx > ,
497497 autoref : & adjustment:: AutoBorrow < ' tcx > ) {
498- debug ! ( "walk_autoref(expr.hir_id={} cmt_base ={:?} autoref={:?})" ,
498+ debug ! ( "walk_autoref(expr.hir_id={} base_place ={:?} autoref={:?})" ,
499499 expr. hir_id,
500- cmt_base ,
500+ base_place ,
501501 autoref) ;
502502
503503 match * autoref {
504504 adjustment:: AutoBorrow :: Ref ( _, m) => {
505- self . delegate . borrow ( cmt_base , ty:: BorrowKind :: from_mutbl ( m. into ( ) ) ) ;
505+ self . delegate . borrow ( base_place , ty:: BorrowKind :: from_mutbl ( m. into ( ) ) ) ;
506506 }
507507
508508 adjustment:: AutoBorrow :: RawPtr ( m) => {
509- debug ! ( "walk_autoref: expr.hir_id={} cmt_base ={:?}" ,
509+ debug ! ( "walk_autoref: expr.hir_id={} base_place ={:?}" ,
510510 expr. hir_id,
511- cmt_base ) ;
511+ base_place ) ;
512512
513513
514- self . delegate . borrow ( cmt_base , ty:: BorrowKind :: from_mutbl ( m) ) ;
514+ self . delegate . borrow ( base_place , ty:: BorrowKind :: from_mutbl ( m) ) ;
515515 }
516516 }
517517 }
@@ -556,8 +556,8 @@ impl<'a, 'tcx> ExprUseVisitor<'a, 'tcx> {
556556 // Each match binding is effectively an assignment to the
557557 // binding being produced.
558558 let def = Res :: Local ( canonical_id) ;
559- if let Ok ( ref binding_cmt ) = mc. cat_res( pat. hir_id, pat. span, pat_ty, def) {
560- delegate. mutate( binding_cmt ) ;
559+ if let Ok ( ref binding_place ) = mc. cat_res( pat. hir_id, pat. span, pat_ty, def) {
560+ delegate. mutate( binding_place ) ;
561561 }
562562
563563 // It is also a borrow or copy/move of the value being matched.
@@ -590,16 +590,18 @@ impl<'a, 'tcx> ExprUseVisitor<'a, 'tcx> {
590590 closure_expr_id : closure_def_id. to_local ( ) ,
591591 } ;
592592 let upvar_capture = self . mc . tables . upvar_capture ( upvar_id) ;
593- let cmt_var = return_if_err ! ( self . cat_captured_var( closure_expr. hir_id,
594- fn_decl_span,
595- var_id) ) ;
593+ let captured_place = return_if_err ! ( self . cat_captured_var(
594+ closure_expr. hir_id,
595+ fn_decl_span,
596+ var_id,
597+ ) ) ;
596598 match upvar_capture {
597599 ty:: UpvarCapture :: ByValue => {
598- let mode = copy_or_move ( & self . mc , & cmt_var ) ;
599- self . delegate . consume ( & cmt_var , mode) ;
600+ let mode = copy_or_move ( & self . mc , & captured_place ) ;
601+ self . delegate . consume ( & captured_place , mode) ;
600602 }
601603 ty:: UpvarCapture :: ByRef ( upvar_borrow) => {
602- self . delegate . borrow ( & cmt_var , upvar_borrow. kind ) ;
604+ self . delegate . borrow ( & captured_place , upvar_borrow. kind ) ;
603605 }
604606 }
605607 }
@@ -611,7 +613,7 @@ impl<'a, 'tcx> ExprUseVisitor<'a, 'tcx> {
611613 closure_span : Span ,
612614 var_id : hir:: HirId )
613615 -> mc:: McResult < mc:: Place < ' tcx > > {
614- // Create the cmt for the variable being borrowed, from the
616+ // Create the place for the variable being borrowed, from the
615617 // perspective of the creator (parent) of the closure.
616618 let var_ty = self . mc . node_ty ( var_id) ?;
617619 self . mc . cat_res ( closure_hir_id, closure_span, var_ty, Res :: Local ( var_id) )
0 commit comments