@@ -184,7 +184,7 @@ pub enum Note {
184184// dereference (`@T`). So use `cmt.ty` to find the type of the value in
185185// a consistent fashion. For more details, see the method `cat_pattern`
186186#[ derive( Clone , Debug , PartialEq ) ]
187- pub struct cmt_ < ' tcx > {
187+ pub struct Place < ' tcx > {
188188 pub hir_id : hir:: HirId , // HIR id of expr/pat producing this value
189189 pub span : Span , // span of same expr/pat
190190 pub cat : Categorization < ' tcx > , // categorization of expr
@@ -193,7 +193,7 @@ pub struct cmt_<'tcx> {
193193 pub note : Note , // Note about the provenance of this cmt
194194}
195195
196- pub type cmt < ' tcx > = Rc < cmt_ < ' tcx > > ;
196+ pub type cmt < ' tcx > = Rc < Place < ' tcx > > ;
197197
198198pub trait HirNode {
199199 fn hir_id ( & self ) -> hir:: HirId ;
@@ -504,14 +504,14 @@ impl<'a, 'tcx> MemCategorizationContext<'a, 'tcx> {
504504 Ok ( ret_ty)
505505 }
506506
507- pub fn cat_expr ( & self , expr : & hir:: Expr ) -> McResult < cmt_ < ' tcx > > {
507+ pub fn cat_expr ( & self , expr : & hir:: Expr ) -> McResult < Place < ' tcx > > {
508508 // This recursion helper avoids going through *too many*
509509 // adjustments, since *only* non-overloaded deref recurses.
510510 fn helper < ' a , ' tcx > (
511511 mc : & MemCategorizationContext < ' a , ' tcx > ,
512512 expr : & hir:: Expr ,
513513 adjustments : & [ adjustment:: Adjustment < ' tcx > ] ,
514- ) -> McResult < cmt_ < ' tcx > > {
514+ ) -> McResult < Place < ' tcx > > {
515515 match adjustments. split_last ( ) {
516516 None => mc. cat_expr_unadjusted ( expr) ,
517517 Some ( ( adjustment, previous) ) => {
@@ -524,17 +524,17 @@ impl<'a, 'tcx> MemCategorizationContext<'a, 'tcx> {
524524 }
525525
526526 pub fn cat_expr_adjusted ( & self , expr : & hir:: Expr ,
527- previous : cmt_ < ' tcx > ,
527+ previous : Place < ' tcx > ,
528528 adjustment : & adjustment:: Adjustment < ' tcx > )
529- -> McResult < cmt_ < ' tcx > > {
529+ -> McResult < Place < ' tcx > > {
530530 self . cat_expr_adjusted_with ( expr, || Ok ( previous) , adjustment)
531531 }
532532
533533 fn cat_expr_adjusted_with < F > ( & self , expr : & hir:: Expr ,
534534 previous : F ,
535535 adjustment : & adjustment:: Adjustment < ' tcx > )
536- -> McResult < cmt_ < ' tcx > >
537- where F : FnOnce ( ) -> McResult < cmt_ < ' tcx > >
536+ -> McResult < Place < ' tcx > >
537+ where F : FnOnce ( ) -> McResult < Place < ' tcx > >
538538 {
539539 debug ! ( "cat_expr_adjusted_with({:?}): {:?}" , adjustment, expr) ;
540540 let target = self . resolve_vars_if_possible ( & adjustment. target ) ;
@@ -562,7 +562,7 @@ impl<'a, 'tcx> MemCategorizationContext<'a, 'tcx> {
562562 }
563563 }
564564
565- pub fn cat_expr_unadjusted ( & self , expr : & hir:: Expr ) -> McResult < cmt_ < ' tcx > > {
565+ pub fn cat_expr_unadjusted ( & self , expr : & hir:: Expr ) -> McResult < Place < ' tcx > > {
566566 debug ! ( "cat_expr: id={} expr={:?}" , expr. hir_id, expr) ;
567567
568568 let expr_ty = self . expr_ty ( expr) ?;
@@ -630,7 +630,7 @@ impl<'a, 'tcx> MemCategorizationContext<'a, 'tcx> {
630630 span : Span ,
631631 expr_ty : Ty < ' tcx > ,
632632 res : Res )
633- -> McResult < cmt_ < ' tcx > > {
633+ -> McResult < Place < ' tcx > > {
634634 debug ! ( "cat_res: id={:?} expr={:?} def={:?}" ,
635635 hir_id, expr_ty, res) ;
636636
@@ -658,7 +658,7 @@ impl<'a, 'tcx> MemCategorizationContext<'a, 'tcx> {
658658 Categorization :: StaticItem
659659 } ;
660660
661- Ok ( cmt_ {
661+ Ok ( Place {
662662 hir_id,
663663 span,
664664 cat,
@@ -675,7 +675,7 @@ impl<'a, 'tcx> MemCategorizationContext<'a, 'tcx> {
675675 if self . upvars . map_or ( false , |upvars| upvars. contains_key ( & var_id) ) {
676676 self . cat_upvar ( hir_id, span, var_id)
677677 } else {
678- Ok ( cmt_ {
678+ Ok ( Place {
679679 hir_id,
680680 span,
681681 cat : Categorization :: Local ( var_id) ,
@@ -697,7 +697,7 @@ impl<'a, 'tcx> MemCategorizationContext<'a, 'tcx> {
697697 hir_id : hir:: HirId ,
698698 span : Span ,
699699 var_id : hir:: HirId ,
700- ) -> McResult < cmt_ < ' tcx > > {
700+ ) -> McResult < Place < ' tcx > > {
701701 // An upvar can have up to 3 components. We translate first to a
702702 // `Categorization::Upvar`, which is itself a fiction -- it represents the reference to the
703703 // field from the environment.
@@ -758,7 +758,7 @@ impl<'a, 'tcx> MemCategorizationContext<'a, 'tcx> {
758758 // Construct the upvar. This represents access to the field
759759 // from the environment (perhaps we should eventually desugar
760760 // this field further, but it will do for now).
761- let cmt_result = cmt_ {
761+ let cmt_result = Place {
762762 hir_id,
763763 span,
764764 cat : Categorization :: Upvar ( Upvar { id : upvar_id, kind : kind} ) ,
@@ -792,7 +792,7 @@ impl<'a, 'tcx> MemCategorizationContext<'a, 'tcx> {
792792 }
793793 ty:: UpvarCapture :: ByRef ( upvar_borrow) => {
794794 let ptr = BorrowedPtr ( upvar_borrow. kind , upvar_borrow. region ) ;
795- cmt_ {
795+ Place {
796796 hir_id,
797797 span,
798798 cat : Categorization :: Deref ( Rc :: new ( cmt_result) , ptr) ,
@@ -814,8 +814,8 @@ impl<'a, 'tcx> MemCategorizationContext<'a, 'tcx> {
814814 upvar_id : ty:: UpvarId ,
815815 upvar_mutbl : MutabilityCategory ,
816816 env_borrow_kind : ty:: BorrowKind ,
817- cmt_result : cmt_ < ' tcx > )
818- -> cmt_ < ' tcx >
817+ cmt_result : Place < ' tcx > )
818+ -> Place < ' tcx >
819819 {
820820 // Region of environment pointer
821821 let env_region = self . tcx . mk_region ( ty:: ReFree ( ty:: FreeRegion {
@@ -837,7 +837,7 @@ impl<'a, 'tcx> MemCategorizationContext<'a, 'tcx> {
837837 // away with stuffing a `Error` in there
838838 // instead of bothering to construct a proper
839839 // one.
840- let cmt_result = cmt_ {
840+ let cmt_result = Place {
841841 mutbl : McImmutable ,
842842 ty : self . tcx . types . err ,
843843 ..cmt_result
@@ -852,7 +852,7 @@ impl<'a, 'tcx> MemCategorizationContext<'a, 'tcx> {
852852 McDeclared | McInherited => { }
853853 }
854854
855- let ret = cmt_ {
855+ let ret = Place {
856856 hir_id,
857857 span,
858858 cat : Categorization :: Deref ( Rc :: new ( cmt_result) , env_ptr) ,
@@ -870,7 +870,7 @@ impl<'a, 'tcx> MemCategorizationContext<'a, 'tcx> {
870870 hir_id : hir:: HirId ,
871871 span : Span ,
872872 expr_ty : Ty < ' tcx > )
873- -> cmt_ < ' tcx > {
873+ -> Place < ' tcx > {
874874 debug ! ( "cat_rvalue_node(id={:?}, span={:?}, expr_ty={:?})" ,
875875 hir_id, span, expr_ty) ;
876876
@@ -882,8 +882,8 @@ impl<'a, 'tcx> MemCategorizationContext<'a, 'tcx> {
882882 pub fn cat_rvalue ( & self ,
883883 cmt_hir_id : hir:: HirId ,
884884 span : Span ,
885- expr_ty : Ty < ' tcx > ) -> cmt_ < ' tcx > {
886- let ret = cmt_ {
885+ expr_ty : Ty < ' tcx > ) -> Place < ' tcx > {
886+ let ret = Place {
887887 hir_id : cmt_hir_id,
888888 span : span,
889889 cat : Categorization :: Rvalue ,
@@ -901,8 +901,8 @@ impl<'a, 'tcx> MemCategorizationContext<'a, 'tcx> {
901901 f_index : usize ,
902902 f_ident : ast:: Ident ,
903903 f_ty : Ty < ' tcx > )
904- -> cmt_ < ' tcx > {
905- let ret = cmt_ {
904+ -> Place < ' tcx > {
905+ let ret = Place {
906906 hir_id : node. hir_id ( ) ,
907907 span : node. span ( ) ,
908908 mutbl : base_cmt. mutbl . inherit ( ) ,
@@ -920,7 +920,7 @@ impl<'a, 'tcx> MemCategorizationContext<'a, 'tcx> {
920920 expr : & hir:: Expr ,
921921 base : & hir:: Expr ,
922922 note : Note ,
923- ) -> McResult < cmt_ < ' tcx > > {
923+ ) -> McResult < Place < ' tcx > > {
924924 debug ! ( "cat_overloaded_place(expr={:?}, base={:?}, note={:?})" ,
925925 expr,
926926 base,
@@ -950,7 +950,7 @@ impl<'a, 'tcx> MemCategorizationContext<'a, 'tcx> {
950950 node : & impl HirNode ,
951951 base_cmt : cmt < ' tcx > ,
952952 note : Note ,
953- ) -> McResult < cmt_ < ' tcx > > {
953+ ) -> McResult < Place < ' tcx > > {
954954 debug ! ( "cat_deref: base_cmt={:?}" , base_cmt) ;
955955
956956 let base_cmt_ty = base_cmt. ty ;
@@ -971,7 +971,7 @@ impl<'a, 'tcx> MemCategorizationContext<'a, 'tcx> {
971971 }
972972 _ => bug ! ( "unexpected type in cat_deref: {:?}" , base_cmt. ty)
973973 } ;
974- let ret = cmt_ {
974+ let ret = Place {
975975 hir_id : node. hir_id ( ) ,
976976 span : node. span ( ) ,
977977 // For unique ptrs, we inherit mutability from the owning reference.
@@ -989,7 +989,7 @@ impl<'a, 'tcx> MemCategorizationContext<'a, 'tcx> {
989989 base_cmt : cmt < ' tcx > ,
990990 element_ty : Ty < ' tcx > ,
991991 context : InteriorOffsetKind )
992- -> McResult < cmt_ < ' tcx > > {
992+ -> McResult < Place < ' tcx > > {
993993 //! Creates a cmt for an indexing operation (`[]`).
994994 //!
995995 //! One subtle aspect of indexing that may not be
@@ -1018,8 +1018,8 @@ impl<'a, 'tcx> MemCategorizationContext<'a, 'tcx> {
10181018 base_cmt : cmt < ' tcx > ,
10191019 interior_ty : Ty < ' tcx > ,
10201020 interior : InteriorKind )
1021- -> cmt_ < ' tcx > {
1022- let ret = cmt_ {
1021+ -> Place < ' tcx > {
1022+ let ret = Place {
10231023 hir_id : node. hir_id ( ) ,
10241024 span : node. span ( ) ,
10251025 mutbl : base_cmt. mutbl . inherit ( ) ,
@@ -1040,7 +1040,7 @@ impl<'a, 'tcx> MemCategorizationContext<'a, 'tcx> {
10401040 let base_did = self . tcx . parent ( variant_did) . unwrap ( ) ;
10411041 if self . tcx . adt_def ( base_did) . variants . len ( ) != 1 {
10421042 let base_ty = base_cmt. ty ;
1043- let ret = Rc :: new ( cmt_ {
1043+ let ret = Rc :: new ( Place {
10441044 hir_id : node. hir_id ( ) ,
10451045 span : node. span ( ) ,
10461046 mutbl : base_cmt. mutbl . inherit ( ) ,
@@ -1327,8 +1327,8 @@ pub enum AliasableReason {
13271327 AliasableStaticMut ,
13281328}
13291329
1330- impl < ' tcx > cmt_ < ' tcx > {
1331- pub fn guarantor ( & self ) -> cmt_ < ' tcx > {
1330+ impl < ' tcx > Place < ' tcx > {
1331+ pub fn guarantor ( & self ) -> Place < ' tcx > {
13321332 //! Returns `self` after stripping away any derefs or
13331333 //! interior content. The return value is basically the `cmt` which
13341334 //! determines how long the value in `self` remains live.
0 commit comments