@@ -184,7 +184,7 @@ pub enum Note {
184
184
// dereference (`@T`). So use `cmt.ty` to find the type of the value in
185
185
// a consistent fashion. For more details, see the method `cat_pattern`
186
186
#[ derive( Clone , Debug , PartialEq ) ]
187
- pub struct cmt_ < ' tcx > {
187
+ pub struct Place < ' tcx > {
188
188
pub hir_id : hir:: HirId , // HIR id of expr/pat producing this value
189
189
pub span : Span , // span of same expr/pat
190
190
pub cat : Categorization < ' tcx > , // categorization of expr
@@ -193,7 +193,7 @@ pub struct cmt_<'tcx> {
193
193
pub note : Note , // Note about the provenance of this cmt
194
194
}
195
195
196
- pub type cmt < ' tcx > = Rc < cmt_ < ' tcx > > ;
196
+ pub type cmt < ' tcx > = Rc < Place < ' tcx > > ;
197
197
198
198
pub trait HirNode {
199
199
fn hir_id ( & self ) -> hir:: HirId ;
@@ -504,14 +504,14 @@ impl<'a, 'tcx> MemCategorizationContext<'a, 'tcx> {
504
504
Ok ( ret_ty)
505
505
}
506
506
507
- pub fn cat_expr ( & self , expr : & hir:: Expr ) -> McResult < cmt_ < ' tcx > > {
507
+ pub fn cat_expr ( & self , expr : & hir:: Expr ) -> McResult < Place < ' tcx > > {
508
508
// This recursion helper avoids going through *too many*
509
509
// adjustments, since *only* non-overloaded deref recurses.
510
510
fn helper < ' a , ' tcx > (
511
511
mc : & MemCategorizationContext < ' a , ' tcx > ,
512
512
expr : & hir:: Expr ,
513
513
adjustments : & [ adjustment:: Adjustment < ' tcx > ] ,
514
- ) -> McResult < cmt_ < ' tcx > > {
514
+ ) -> McResult < Place < ' tcx > > {
515
515
match adjustments. split_last ( ) {
516
516
None => mc. cat_expr_unadjusted ( expr) ,
517
517
Some ( ( adjustment, previous) ) => {
@@ -524,17 +524,17 @@ impl<'a, 'tcx> MemCategorizationContext<'a, 'tcx> {
524
524
}
525
525
526
526
pub fn cat_expr_adjusted ( & self , expr : & hir:: Expr ,
527
- previous : cmt_ < ' tcx > ,
527
+ previous : Place < ' tcx > ,
528
528
adjustment : & adjustment:: Adjustment < ' tcx > )
529
- -> McResult < cmt_ < ' tcx > > {
529
+ -> McResult < Place < ' tcx > > {
530
530
self . cat_expr_adjusted_with ( expr, || Ok ( previous) , adjustment)
531
531
}
532
532
533
533
fn cat_expr_adjusted_with < F > ( & self , expr : & hir:: Expr ,
534
534
previous : F ,
535
535
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 > >
538
538
{
539
539
debug ! ( "cat_expr_adjusted_with({:?}): {:?}" , adjustment, expr) ;
540
540
let target = self . resolve_vars_if_possible ( & adjustment. target ) ;
@@ -562,7 +562,7 @@ impl<'a, 'tcx> MemCategorizationContext<'a, 'tcx> {
562
562
}
563
563
}
564
564
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 > > {
566
566
debug ! ( "cat_expr: id={} expr={:?}" , expr. hir_id, expr) ;
567
567
568
568
let expr_ty = self . expr_ty ( expr) ?;
@@ -630,7 +630,7 @@ impl<'a, 'tcx> MemCategorizationContext<'a, 'tcx> {
630
630
span : Span ,
631
631
expr_ty : Ty < ' tcx > ,
632
632
res : Res )
633
- -> McResult < cmt_ < ' tcx > > {
633
+ -> McResult < Place < ' tcx > > {
634
634
debug ! ( "cat_res: id={:?} expr={:?} def={:?}" ,
635
635
hir_id, expr_ty, res) ;
636
636
@@ -658,7 +658,7 @@ impl<'a, 'tcx> MemCategorizationContext<'a, 'tcx> {
658
658
Categorization :: StaticItem
659
659
} ;
660
660
661
- Ok ( cmt_ {
661
+ Ok ( Place {
662
662
hir_id,
663
663
span,
664
664
cat,
@@ -675,7 +675,7 @@ impl<'a, 'tcx> MemCategorizationContext<'a, 'tcx> {
675
675
if self . upvars . map_or ( false , |upvars| upvars. contains_key ( & var_id) ) {
676
676
self . cat_upvar ( hir_id, span, var_id)
677
677
} else {
678
- Ok ( cmt_ {
678
+ Ok ( Place {
679
679
hir_id,
680
680
span,
681
681
cat : Categorization :: Local ( var_id) ,
@@ -697,7 +697,7 @@ impl<'a, 'tcx> MemCategorizationContext<'a, 'tcx> {
697
697
hir_id : hir:: HirId ,
698
698
span : Span ,
699
699
var_id : hir:: HirId ,
700
- ) -> McResult < cmt_ < ' tcx > > {
700
+ ) -> McResult < Place < ' tcx > > {
701
701
// An upvar can have up to 3 components. We translate first to a
702
702
// `Categorization::Upvar`, which is itself a fiction -- it represents the reference to the
703
703
// field from the environment.
@@ -758,7 +758,7 @@ impl<'a, 'tcx> MemCategorizationContext<'a, 'tcx> {
758
758
// Construct the upvar. This represents access to the field
759
759
// from the environment (perhaps we should eventually desugar
760
760
// this field further, but it will do for now).
761
- let cmt_result = cmt_ {
761
+ let cmt_result = Place {
762
762
hir_id,
763
763
span,
764
764
cat : Categorization :: Upvar ( Upvar { id : upvar_id, kind : kind} ) ,
@@ -792,7 +792,7 @@ impl<'a, 'tcx> MemCategorizationContext<'a, 'tcx> {
792
792
}
793
793
ty:: UpvarCapture :: ByRef ( upvar_borrow) => {
794
794
let ptr = BorrowedPtr ( upvar_borrow. kind , upvar_borrow. region ) ;
795
- cmt_ {
795
+ Place {
796
796
hir_id,
797
797
span,
798
798
cat : Categorization :: Deref ( Rc :: new ( cmt_result) , ptr) ,
@@ -814,8 +814,8 @@ impl<'a, 'tcx> MemCategorizationContext<'a, 'tcx> {
814
814
upvar_id : ty:: UpvarId ,
815
815
upvar_mutbl : MutabilityCategory ,
816
816
env_borrow_kind : ty:: BorrowKind ,
817
- cmt_result : cmt_ < ' tcx > )
818
- -> cmt_ < ' tcx >
817
+ cmt_result : Place < ' tcx > )
818
+ -> Place < ' tcx >
819
819
{
820
820
// Region of environment pointer
821
821
let env_region = self . tcx . mk_region ( ty:: ReFree ( ty:: FreeRegion {
@@ -837,7 +837,7 @@ impl<'a, 'tcx> MemCategorizationContext<'a, 'tcx> {
837
837
// away with stuffing a `Error` in there
838
838
// instead of bothering to construct a proper
839
839
// one.
840
- let cmt_result = cmt_ {
840
+ let cmt_result = Place {
841
841
mutbl : McImmutable ,
842
842
ty : self . tcx . types . err ,
843
843
..cmt_result
@@ -852,7 +852,7 @@ impl<'a, 'tcx> MemCategorizationContext<'a, 'tcx> {
852
852
McDeclared | McInherited => { }
853
853
}
854
854
855
- let ret = cmt_ {
855
+ let ret = Place {
856
856
hir_id,
857
857
span,
858
858
cat : Categorization :: Deref ( Rc :: new ( cmt_result) , env_ptr) ,
@@ -870,7 +870,7 @@ impl<'a, 'tcx> MemCategorizationContext<'a, 'tcx> {
870
870
hir_id : hir:: HirId ,
871
871
span : Span ,
872
872
expr_ty : Ty < ' tcx > )
873
- -> cmt_ < ' tcx > {
873
+ -> Place < ' tcx > {
874
874
debug ! ( "cat_rvalue_node(id={:?}, span={:?}, expr_ty={:?})" ,
875
875
hir_id, span, expr_ty) ;
876
876
@@ -882,8 +882,8 @@ impl<'a, 'tcx> MemCategorizationContext<'a, 'tcx> {
882
882
pub fn cat_rvalue ( & self ,
883
883
cmt_hir_id : hir:: HirId ,
884
884
span : Span ,
885
- expr_ty : Ty < ' tcx > ) -> cmt_ < ' tcx > {
886
- let ret = cmt_ {
885
+ expr_ty : Ty < ' tcx > ) -> Place < ' tcx > {
886
+ let ret = Place {
887
887
hir_id : cmt_hir_id,
888
888
span : span,
889
889
cat : Categorization :: Rvalue ,
@@ -901,8 +901,8 @@ impl<'a, 'tcx> MemCategorizationContext<'a, 'tcx> {
901
901
f_index : usize ,
902
902
f_ident : ast:: Ident ,
903
903
f_ty : Ty < ' tcx > )
904
- -> cmt_ < ' tcx > {
905
- let ret = cmt_ {
904
+ -> Place < ' tcx > {
905
+ let ret = Place {
906
906
hir_id : node. hir_id ( ) ,
907
907
span : node. span ( ) ,
908
908
mutbl : base_cmt. mutbl . inherit ( ) ,
@@ -920,7 +920,7 @@ impl<'a, 'tcx> MemCategorizationContext<'a, 'tcx> {
920
920
expr : & hir:: Expr ,
921
921
base : & hir:: Expr ,
922
922
note : Note ,
923
- ) -> McResult < cmt_ < ' tcx > > {
923
+ ) -> McResult < Place < ' tcx > > {
924
924
debug ! ( "cat_overloaded_place(expr={:?}, base={:?}, note={:?})" ,
925
925
expr,
926
926
base,
@@ -950,7 +950,7 @@ impl<'a, 'tcx> MemCategorizationContext<'a, 'tcx> {
950
950
node : & impl HirNode ,
951
951
base_cmt : cmt < ' tcx > ,
952
952
note : Note ,
953
- ) -> McResult < cmt_ < ' tcx > > {
953
+ ) -> McResult < Place < ' tcx > > {
954
954
debug ! ( "cat_deref: base_cmt={:?}" , base_cmt) ;
955
955
956
956
let base_cmt_ty = base_cmt. ty ;
@@ -971,7 +971,7 @@ impl<'a, 'tcx> MemCategorizationContext<'a, 'tcx> {
971
971
}
972
972
_ => bug ! ( "unexpected type in cat_deref: {:?}" , base_cmt. ty)
973
973
} ;
974
- let ret = cmt_ {
974
+ let ret = Place {
975
975
hir_id : node. hir_id ( ) ,
976
976
span : node. span ( ) ,
977
977
// For unique ptrs, we inherit mutability from the owning reference.
@@ -989,7 +989,7 @@ impl<'a, 'tcx> MemCategorizationContext<'a, 'tcx> {
989
989
base_cmt : cmt < ' tcx > ,
990
990
element_ty : Ty < ' tcx > ,
991
991
context : InteriorOffsetKind )
992
- -> McResult < cmt_ < ' tcx > > {
992
+ -> McResult < Place < ' tcx > > {
993
993
//! Creates a cmt for an indexing operation (`[]`).
994
994
//!
995
995
//! One subtle aspect of indexing that may not be
@@ -1018,8 +1018,8 @@ impl<'a, 'tcx> MemCategorizationContext<'a, 'tcx> {
1018
1018
base_cmt : cmt < ' tcx > ,
1019
1019
interior_ty : Ty < ' tcx > ,
1020
1020
interior : InteriorKind )
1021
- -> cmt_ < ' tcx > {
1022
- let ret = cmt_ {
1021
+ -> Place < ' tcx > {
1022
+ let ret = Place {
1023
1023
hir_id : node. hir_id ( ) ,
1024
1024
span : node. span ( ) ,
1025
1025
mutbl : base_cmt. mutbl . inherit ( ) ,
@@ -1040,7 +1040,7 @@ impl<'a, 'tcx> MemCategorizationContext<'a, 'tcx> {
1040
1040
let base_did = self . tcx . parent ( variant_did) . unwrap ( ) ;
1041
1041
if self . tcx . adt_def ( base_did) . variants . len ( ) != 1 {
1042
1042
let base_ty = base_cmt. ty ;
1043
- let ret = Rc :: new ( cmt_ {
1043
+ let ret = Rc :: new ( Place {
1044
1044
hir_id : node. hir_id ( ) ,
1045
1045
span : node. span ( ) ,
1046
1046
mutbl : base_cmt. mutbl . inherit ( ) ,
@@ -1327,8 +1327,8 @@ pub enum AliasableReason {
1327
1327
AliasableStaticMut ,
1328
1328
}
1329
1329
1330
- impl < ' tcx > cmt_ < ' tcx > {
1331
- pub fn guarantor ( & self ) -> cmt_ < ' tcx > {
1330
+ impl < ' tcx > Place < ' tcx > {
1331
+ pub fn guarantor ( & self ) -> Place < ' tcx > {
1332
1332
//! Returns `self` after stripping away any derefs or
1333
1333
//! interior content. The return value is basically the `cmt` which
1334
1334
//! determines how long the value in `self` remains live.
0 commit comments