about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMatthew Jasper <mjjasper1@gmail.com>2019-11-08 21:53:36 +0000
committerMatthew Jasper <mjjasper1@gmail.com>2019-11-27 19:28:15 +0000
commit4195b60323046c86d9431e82665de6d2f71a2289 (patch)
treef05c2b11a1d51f6a758ec8ae82ab3bb35d158770
parent04e69e4f4234beb4f12cc76dcc53e2cc4247a9be (diff)
downloadrust-4195b60323046c86d9431e82665de6d2f71a2289.tar.gz
rust-4195b60323046c86d9431e82665de6d2f71a2289.zip
Rename `cmt_` to `Place`
-rw-r--r--src/librustc/middle/expr_use_visitor.rs14
-rw-r--r--src/librustc/middle/mem_categorization.rs66
-rw-r--r--src/librustc_typeck/check/regionck.rs10
-rw-r--r--src/librustc_typeck/check/upvar.rs14
4 files changed, 52 insertions, 52 deletions
diff --git a/src/librustc/middle/expr_use_visitor.rs b/src/librustc/middle/expr_use_visitor.rs
index 00bddf50c29..2b18ecb169e 100644
--- a/src/librustc/middle/expr_use_visitor.rs
+++ b/src/librustc/middle/expr_use_visitor.rs
@@ -25,13 +25,13 @@ use syntax_pos::Span;
 pub trait Delegate<'tcx> {
     // The value found at `cmt` is either copied or moved, depending
     // on mode.
-    fn consume(&mut self, cmt: &mc::cmt_<'tcx>, mode: ConsumeMode);
+    fn consume(&mut self, cmt: &mc::Place<'tcx>, mode: ConsumeMode);
 
     // The value found at `cmt` is being borrowed with kind `bk`.
-    fn borrow(&mut self, cmt: &mc::cmt_<'tcx>, bk: ty::BorrowKind);
+    fn borrow(&mut self, cmt: &mc::Place<'tcx>, bk: ty::BorrowKind);
 
     // The path at `cmt` is being assigned to.
-    fn mutate(&mut self, assignee_cmt: &mc::cmt_<'tcx>);
+    fn mutate(&mut self, assignee_cmt: &mc::Place<'tcx>);
 }
 
 #[derive(Copy, Clone, PartialEq, Debug)]
@@ -180,7 +180,7 @@ impl<'a, 'tcx> ExprUseVisitor<'a, 'tcx> {
         self.mc.tcx
     }
 
-    fn delegate_consume(&mut self, cmt: &mc::cmt_<'tcx>) {
+    fn delegate_consume(&mut self, cmt: &mc::Place<'tcx>) {
         debug!("delegate_consume(cmt={:?})", cmt);
 
         let mode = copy_or_move(&self.mc, self.param_env, cmt);
@@ -528,7 +528,7 @@ impl<'a, 'tcx> ExprUseVisitor<'a, 'tcx> {
     /// after all relevant autoderefs have occurred.
     fn walk_autoref(&mut self,
                     expr: &hir::Expr,
-                    cmt_base: &mc::cmt_<'tcx>,
+                    cmt_base: &mc::Place<'tcx>,
                     autoref: &adjustment::AutoBorrow<'tcx>) {
         debug!("walk_autoref(expr.hir_id={} cmt_base={:?} autoref={:?})",
                expr.hir_id,
@@ -645,7 +645,7 @@ impl<'a, 'tcx> ExprUseVisitor<'a, 'tcx> {
                         closure_hir_id: hir::HirId,
                         closure_span: Span,
                         var_id: hir::HirId)
-                        -> mc::McResult<mc::cmt_<'tcx>> {
+                        -> mc::McResult<mc::Place<'tcx>> {
         // Create the cmt for the variable being borrowed, from the
         // perspective of the creator (parent) of the closure.
         let var_ty = self.mc.node_ty(var_id)?;
@@ -656,7 +656,7 @@ impl<'a, 'tcx> ExprUseVisitor<'a, 'tcx> {
 fn copy_or_move<'a, 'tcx>(
     mc: &mc::MemCategorizationContext<'a, 'tcx>,
     param_env: ty::ParamEnv<'tcx>,
-    cmt: &mc::cmt_<'tcx>,
+    cmt: &mc::Place<'tcx>,
 ) -> ConsumeMode {
     if !mc.type_is_copy_modulo_regions(param_env, cmt.ty, cmt.span) {
         Move
diff --git a/src/librustc/middle/mem_categorization.rs b/src/librustc/middle/mem_categorization.rs
index 3510fe4d123..1b641cba770 100644
--- a/src/librustc/middle/mem_categorization.rs
+++ b/src/librustc/middle/mem_categorization.rs
@@ -184,7 +184,7 @@ pub enum Note {
 // dereference (`@T`). So use `cmt.ty` to find the type of the value in
 // a consistent fashion. For more details, see the method `cat_pattern`
 #[derive(Clone, Debug, PartialEq)]
-pub struct cmt_<'tcx> {
+pub struct Place<'tcx> {
     pub hir_id: hir::HirId,        // HIR id of expr/pat producing this value
     pub span: Span,                // span of same expr/pat
     pub cat: Categorization<'tcx>, // categorization of expr
@@ -193,7 +193,7 @@ pub struct cmt_<'tcx> {
     pub note: Note,                // Note about the provenance of this cmt
 }
 
-pub type cmt<'tcx> = Rc<cmt_<'tcx>>;
+pub type cmt<'tcx> = Rc<Place<'tcx>>;
 
 pub trait HirNode {
     fn hir_id(&self) -> hir::HirId;
@@ -504,14 +504,14 @@ impl<'a, 'tcx> MemCategorizationContext<'a, 'tcx> {
         Ok(ret_ty)
     }
 
-    pub fn cat_expr(&self, expr: &hir::Expr) -> McResult<cmt_<'tcx>> {
+    pub fn cat_expr(&self, expr: &hir::Expr) -> McResult<Place<'tcx>> {
         // This recursion helper avoids going through *too many*
         // adjustments, since *only* non-overloaded deref recurses.
         fn helper<'a, 'tcx>(
             mc: &MemCategorizationContext<'a, 'tcx>,
             expr: &hir::Expr,
             adjustments: &[adjustment::Adjustment<'tcx>],
-        ) -> McResult<cmt_<'tcx>> {
+        ) -> McResult<Place<'tcx>> {
             match adjustments.split_last() {
                 None => mc.cat_expr_unadjusted(expr),
                 Some((adjustment, previous)) => {
@@ -524,17 +524,17 @@ impl<'a, 'tcx> MemCategorizationContext<'a, 'tcx> {
     }
 
     pub fn cat_expr_adjusted(&self, expr: &hir::Expr,
-                             previous: cmt_<'tcx>,
+                             previous: Place<'tcx>,
                              adjustment: &adjustment::Adjustment<'tcx>)
-                             -> McResult<cmt_<'tcx>> {
+                             -> McResult<Place<'tcx>> {
         self.cat_expr_adjusted_with(expr, || Ok(previous), adjustment)
     }
 
     fn cat_expr_adjusted_with<F>(&self, expr: &hir::Expr,
                                  previous: F,
                                  adjustment: &adjustment::Adjustment<'tcx>)
-                                 -> McResult<cmt_<'tcx>>
-        where F: FnOnce() -> McResult<cmt_<'tcx>>
+                                 -> McResult<Place<'tcx>>
+        where F: FnOnce() -> McResult<Place<'tcx>>
     {
         debug!("cat_expr_adjusted_with({:?}): {:?}", adjustment, expr);
         let target = self.resolve_vars_if_possible(&adjustment.target);
@@ -562,7 +562,7 @@ impl<'a, 'tcx> MemCategorizationContext<'a, 'tcx> {
         }
     }
 
-    pub fn cat_expr_unadjusted(&self, expr: &hir::Expr) -> McResult<cmt_<'tcx>> {
+    pub fn cat_expr_unadjusted(&self, expr: &hir::Expr) -> McResult<Place<'tcx>> {
         debug!("cat_expr: id={} expr={:?}", expr.hir_id, expr);
 
         let expr_ty = self.expr_ty(expr)?;
@@ -630,7 +630,7 @@ impl<'a, 'tcx> MemCategorizationContext<'a, 'tcx> {
                    span: Span,
                    expr_ty: Ty<'tcx>,
                    res: Res)
-                   -> McResult<cmt_<'tcx>> {
+                   -> McResult<Place<'tcx>> {
         debug!("cat_res: id={:?} expr={:?} def={:?}",
                hir_id, expr_ty, res);
 
@@ -658,7 +658,7 @@ impl<'a, 'tcx> MemCategorizationContext<'a, 'tcx> {
                     Categorization::StaticItem
                 };
 
-                Ok(cmt_ {
+                Ok(Place {
                     hir_id,
                     span,
                     cat,
@@ -675,7 +675,7 @@ impl<'a, 'tcx> MemCategorizationContext<'a, 'tcx> {
                 if self.upvars.map_or(false, |upvars| upvars.contains_key(&var_id)) {
                     self.cat_upvar(hir_id, span, var_id)
                 } else {
-                    Ok(cmt_ {
+                    Ok(Place {
                         hir_id,
                         span,
                         cat: Categorization::Local(var_id),
@@ -697,7 +697,7 @@ impl<'a, 'tcx> MemCategorizationContext<'a, 'tcx> {
         hir_id: hir::HirId,
         span: Span,
         var_id: hir::HirId,
-    ) -> McResult<cmt_<'tcx>> {
+    ) -> McResult<Place<'tcx>> {
         // An upvar can have up to 3 components. We translate first to a
         // `Categorization::Upvar`, which is itself a fiction -- it represents the reference to the
         // field from the environment.
@@ -758,7 +758,7 @@ impl<'a, 'tcx> MemCategorizationContext<'a, 'tcx> {
         // Construct the upvar. This represents access to the field
         // from the environment (perhaps we should eventually desugar
         // this field further, but it will do for now).
-        let cmt_result = cmt_ {
+        let cmt_result = Place {
             hir_id,
             span,
             cat: Categorization::Upvar(Upvar {id: upvar_id, kind: kind}),
@@ -792,7 +792,7 @@ impl<'a, 'tcx> MemCategorizationContext<'a, 'tcx> {
             }
             ty::UpvarCapture::ByRef(upvar_borrow) => {
                 let ptr = BorrowedPtr(upvar_borrow.kind, upvar_borrow.region);
-                cmt_ {
+                Place {
                     hir_id,
                     span,
                     cat: Categorization::Deref(Rc::new(cmt_result), ptr),
@@ -814,8 +814,8 @@ impl<'a, 'tcx> MemCategorizationContext<'a, 'tcx> {
                  upvar_id: ty::UpvarId,
                  upvar_mutbl: MutabilityCategory,
                  env_borrow_kind: ty::BorrowKind,
-                 cmt_result: cmt_<'tcx>)
-                 -> cmt_<'tcx>
+                 cmt_result: Place<'tcx>)
+                 -> Place<'tcx>
     {
         // Region of environment pointer
         let env_region = self.tcx.mk_region(ty::ReFree(ty::FreeRegion {
@@ -837,7 +837,7 @@ impl<'a, 'tcx> MemCategorizationContext<'a, 'tcx> {
         // away with stuffing a `Error` in there
         // instead of bothering to construct a proper
         // one.
-        let cmt_result = cmt_ {
+        let cmt_result = Place {
             mutbl: McImmutable,
             ty: self.tcx.types.err,
             ..cmt_result
@@ -852,7 +852,7 @@ impl<'a, 'tcx> MemCategorizationContext<'a, 'tcx> {
             McDeclared | McInherited => { }
         }
 
-        let ret = cmt_ {
+        let ret = Place {
             hir_id,
             span,
             cat: Categorization::Deref(Rc::new(cmt_result), env_ptr),
@@ -870,7 +870,7 @@ impl<'a, 'tcx> MemCategorizationContext<'a, 'tcx> {
                            hir_id: hir::HirId,
                            span: Span,
                            expr_ty: Ty<'tcx>)
-                           -> cmt_<'tcx> {
+                           -> Place<'tcx> {
         debug!("cat_rvalue_node(id={:?}, span={:?}, expr_ty={:?})",
                hir_id, span, expr_ty);
 
@@ -882,8 +882,8 @@ impl<'a, 'tcx> MemCategorizationContext<'a, 'tcx> {
     pub fn cat_rvalue(&self,
                       cmt_hir_id: hir::HirId,
                       span: Span,
-                      expr_ty: Ty<'tcx>) -> cmt_<'tcx> {
-        let ret = cmt_ {
+                      expr_ty: Ty<'tcx>) -> Place<'tcx> {
+        let ret = Place {
             hir_id: cmt_hir_id,
             span:span,
             cat:Categorization::Rvalue,
@@ -901,8 +901,8 @@ impl<'a, 'tcx> MemCategorizationContext<'a, 'tcx> {
                                  f_index: usize,
                                  f_ident: ast::Ident,
                                  f_ty: Ty<'tcx>)
-                                 -> cmt_<'tcx> {
-        let ret = cmt_ {
+                                 -> Place<'tcx> {
+        let ret = Place {
             hir_id: node.hir_id(),
             span: node.span(),
             mutbl: base_cmt.mutbl.inherit(),
@@ -920,7 +920,7 @@ impl<'a, 'tcx> MemCategorizationContext<'a, 'tcx> {
         expr: &hir::Expr,
         base: &hir::Expr,
         note: Note,
-    ) -> McResult<cmt_<'tcx>> {
+    ) -> McResult<Place<'tcx>> {
         debug!("cat_overloaded_place(expr={:?}, base={:?}, note={:?})",
                expr,
                base,
@@ -950,7 +950,7 @@ impl<'a, 'tcx> MemCategorizationContext<'a, 'tcx> {
         node: &impl HirNode,
         base_cmt: cmt<'tcx>,
         note: Note,
-    ) -> McResult<cmt_<'tcx>> {
+    ) -> McResult<Place<'tcx>> {
         debug!("cat_deref: base_cmt={:?}", base_cmt);
 
         let base_cmt_ty = base_cmt.ty;
@@ -971,7 +971,7 @@ impl<'a, 'tcx> MemCategorizationContext<'a, 'tcx> {
             }
             _ => bug!("unexpected type in cat_deref: {:?}", base_cmt.ty)
         };
-        let ret = cmt_ {
+        let ret = Place {
             hir_id: node.hir_id(),
             span: node.span(),
             // For unique ptrs, we inherit mutability from the owning reference.
@@ -989,7 +989,7 @@ impl<'a, 'tcx> MemCategorizationContext<'a, 'tcx> {
                              base_cmt: cmt<'tcx>,
                              element_ty: Ty<'tcx>,
                              context: InteriorOffsetKind)
-                             -> McResult<cmt_<'tcx>> {
+                             -> McResult<Place<'tcx>> {
         //! Creates a cmt for an indexing operation (`[]`).
         //!
         //! One subtle aspect of indexing that may not be
@@ -1018,8 +1018,8 @@ impl<'a, 'tcx> MemCategorizationContext<'a, 'tcx> {
                                        base_cmt: cmt<'tcx>,
                                        interior_ty: Ty<'tcx>,
                                        interior: InteriorKind)
-                                       -> cmt_<'tcx> {
-        let ret = cmt_ {
+                                       -> Place<'tcx> {
+        let ret = Place {
             hir_id: node.hir_id(),
             span: node.span(),
             mutbl: base_cmt.mutbl.inherit(),
@@ -1040,7 +1040,7 @@ impl<'a, 'tcx> MemCategorizationContext<'a, 'tcx> {
         let base_did = self.tcx.parent(variant_did).unwrap();
         if self.tcx.adt_def(base_did).variants.len() != 1 {
             let base_ty = base_cmt.ty;
-            let ret = Rc::new(cmt_ {
+            let ret = Rc::new(Place {
                 hir_id: node.hir_id(),
                 span: node.span(),
                 mutbl: base_cmt.mutbl.inherit(),
@@ -1327,8 +1327,8 @@ pub enum AliasableReason {
     AliasableStaticMut,
 }
 
-impl<'tcx> cmt_<'tcx> {
-    pub fn guarantor(&self) -> cmt_<'tcx> {
+impl<'tcx> Place<'tcx> {
+    pub fn guarantor(&self) -> Place<'tcx> {
         //! Returns `self` after stripping away any derefs or
         //! interior content. The return value is basically the `cmt` which
         //! determines how long the value in `self` remains live.
diff --git a/src/librustc_typeck/check/regionck.rs b/src/librustc_typeck/check/regionck.rs
index f4fdc2882e7..170c4acad8b 100644
--- a/src/librustc_typeck/check/regionck.rs
+++ b/src/librustc_typeck/check/regionck.rs
@@ -825,7 +825,7 @@ impl<'a, 'tcx> RegionCtxt<'a, 'tcx> {
 
     /// Invoked on any adjustments that occur. Checks that if this is a region pointer being
     /// dereferenced, the lifetime of the pointer includes the deref expr.
-    fn constrain_adjustments(&mut self, expr: &hir::Expr) -> mc::McResult<mc::cmt_<'tcx>> {
+    fn constrain_adjustments(&mut self, expr: &hir::Expr) -> mc::McResult<mc::Place<'tcx>> {
         debug!("constrain_adjustments(expr={:?})", expr);
 
         let mut cmt = self.with_mc(|mc| mc.cat_expr_unadjusted(expr))?;
@@ -921,7 +921,7 @@ impl<'a, 'tcx> RegionCtxt<'a, 'tcx> {
         )
     }
 
-    fn check_safety_of_rvalue_destructor_if_necessary(&mut self, cmt: &mc::cmt_<'tcx>, span: Span) {
+    fn check_safety_of_rvalue_destructor_if_necessary(&mut self, cmt: &mc::Place<'tcx>, span: Span) {
         if let Categorization::Rvalue = cmt.cat {
             let typ = self.resolve_type(cmt.ty);
             let body_id = self.body_id;
@@ -1100,7 +1100,7 @@ impl<'a, 'tcx> RegionCtxt<'a, 'tcx> {
     fn link_autoref(
         &self,
         expr: &hir::Expr,
-        expr_cmt: &mc::cmt_<'tcx>,
+        expr_cmt: &mc::Place<'tcx>,
         autoref: &adjustment::AutoBorrow<'tcx>,
     ) {
         debug!(
@@ -1130,7 +1130,7 @@ impl<'a, 'tcx> RegionCtxt<'a, 'tcx> {
         span: Span,
         id: hir::HirId,
         mutbl: hir::Mutability,
-        cmt_borrowed: &mc::cmt_<'tcx>,
+        cmt_borrowed: &mc::Place<'tcx>,
     ) {
         debug!(
             "link_region_from_node_type(id={:?}, mutbl={:?}, cmt_borrowed={:?})",
@@ -1153,7 +1153,7 @@ impl<'a, 'tcx> RegionCtxt<'a, 'tcx> {
         span: Span,
         borrow_region: ty::Region<'tcx>,
         borrow_kind: ty::BorrowKind,
-        borrow_cmt: &mc::cmt_<'tcx>,
+        borrow_cmt: &mc::Place<'tcx>,
     ) {
         let origin = infer::DataBorrowed(borrow_cmt.ty, span);
         self.type_must_outlive(origin, borrow_cmt.ty, borrow_region);
diff --git a/src/librustc_typeck/check/upvar.rs b/src/librustc_typeck/check/upvar.rs
index 390ee0d0f83..5d17074e65e 100644
--- a/src/librustc_typeck/check/upvar.rs
+++ b/src/librustc_typeck/check/upvar.rs
@@ -312,7 +312,7 @@ struct InferBorrowKind<'a, 'tcx> {
 impl<'a, 'tcx> InferBorrowKind<'a, 'tcx> {
     fn adjust_upvar_borrow_kind_for_consume(
         &mut self,
-        cmt: &mc::cmt_<'tcx>,
+        cmt: &mc::Place<'tcx>,
         mode: euv::ConsumeMode,
     ) {
         debug!(
@@ -388,7 +388,7 @@ impl<'a, 'tcx> InferBorrowKind<'a, 'tcx> {
     /// Indicates that `cmt` is being directly mutated (e.g., assigned
     /// to). If cmt contains any by-ref upvars, this implies that
     /// those upvars must be borrowed using an `&mut` borrow.
-    fn adjust_upvar_borrow_kind_for_mut(&mut self, cmt: &mc::cmt_<'tcx>) {
+    fn adjust_upvar_borrow_kind_for_mut(&mut self, cmt: &mc::Place<'tcx>) {
         debug!("adjust_upvar_borrow_kind_for_mut(cmt={:?})", cmt);
 
         match cmt.cat.clone() {
@@ -421,7 +421,7 @@ impl<'a, 'tcx> InferBorrowKind<'a, 'tcx> {
         }
     }
 
-    fn adjust_upvar_borrow_kind_for_unique(&mut self, cmt: &mc::cmt_<'tcx>) {
+    fn adjust_upvar_borrow_kind_for_unique(&mut self, cmt: &mc::Place<'tcx>) {
         debug!("adjust_upvar_borrow_kind_for_unique(cmt={:?})", cmt);
 
         match cmt.cat.clone() {
@@ -452,7 +452,7 @@ impl<'a, 'tcx> InferBorrowKind<'a, 'tcx> {
 
     fn try_adjust_upvar_deref(
         &mut self,
-        cmt: &mc::cmt_<'tcx>,
+        cmt: &mc::Place<'tcx>,
         borrow_kind: ty::BorrowKind,
     ) -> bool {
         assert!(match borrow_kind {
@@ -586,12 +586,12 @@ impl<'a, 'tcx> InferBorrowKind<'a, 'tcx> {
 }
 
 impl<'a, 'tcx> euv::Delegate<'tcx> for InferBorrowKind<'a, 'tcx> {
-    fn consume(&mut self, cmt: &mc::cmt_<'tcx>,mode: euv::ConsumeMode) {
+    fn consume(&mut self, cmt: &mc::Place<'tcx>,mode: euv::ConsumeMode) {
         debug!("consume(cmt={:?},mode={:?})", cmt, mode);
         self.adjust_upvar_borrow_kind_for_consume(cmt, mode);
     }
 
-    fn borrow(&mut self, cmt: &mc::cmt_<'tcx>, bk: ty::BorrowKind) {
+    fn borrow(&mut self, cmt: &mc::Place<'tcx>, bk: ty::BorrowKind) {
         debug!("borrow(cmt={:?}, bk={:?})", cmt, bk);
 
         match bk {
@@ -605,7 +605,7 @@ impl<'a, 'tcx> euv::Delegate<'tcx> for InferBorrowKind<'a, 'tcx> {
         }
     }
 
-    fn mutate(&mut self, assignee_cmt: &mc::cmt_<'tcx>) {
+    fn mutate(&mut self, assignee_cmt: &mc::Place<'tcx>) {
         debug!("mutate(assignee_cmt={:?})", assignee_cmt);
 
         self.adjust_upvar_borrow_kind_for_mut(assignee_cmt);