@@ -189,7 +189,7 @@ pub enum Note {
189189// fashion. For more details, see the method `cat_pattern`
190190#[ derive( Clone , Debug , PartialEq ) ]
191191pub struct cmt_ < ' tcx > {
192- pub id : ast :: NodeId , // id of expr/pat producing this value
192+ pub hir_id : hir :: HirId , // HIR id of expr/pat producing this value
193193 pub span : Span , // span of same expr/pat
194194 pub cat : Categorization < ' tcx > , // categorization of expr
195195 pub mutbl : MutabilityCategory , // mutability of expr as place
@@ -271,18 +271,18 @@ impl<'tcx> cmt_<'tcx> {
271271 }
272272}
273273
274- pub trait ast_node {
275- fn id ( & self ) -> ast :: NodeId ;
274+ pub trait HirNode {
275+ fn hir_id ( & self ) -> hir :: HirId ;
276276 fn span ( & self ) -> Span ;
277277}
278278
279- impl ast_node for hir:: Expr {
280- fn id ( & self ) -> ast :: NodeId { self . id }
279+ impl HirNode for hir:: Expr {
280+ fn hir_id ( & self ) -> hir :: HirId { self . hir_id }
281281 fn span ( & self ) -> Span { self . span }
282282}
283283
284- impl ast_node for hir:: Pat {
285- fn id ( & self ) -> ast :: NodeId { self . id }
284+ impl HirNode for hir:: Pat {
285+ fn hir_id ( & self ) -> hir :: HirId { self . hir_id }
286286 fn span ( & self ) -> Span { self . span }
287287}
288288
@@ -610,7 +610,7 @@ impl<'a, 'gcx, 'tcx> MemCategorizationContext<'a, 'gcx, 'tcx> {
610610 ty : target,
611611 mutbl : deref. mutbl ,
612612 } ) ;
613- self . cat_rvalue_node ( expr. id , expr. span , ref_ty)
613+ self . cat_rvalue_node ( expr. hir_id , expr. span , ref_ty)
614614 } else {
615615 previous ( ) ?
616616 } ) ;
@@ -625,7 +625,7 @@ impl<'a, 'gcx, 'tcx> MemCategorizationContext<'a, 'gcx, 'tcx> {
625625 adjustment:: Adjust :: Borrow ( _) |
626626 adjustment:: Adjust :: Unsize => {
627627 // Result is an rvalue.
628- Ok ( self . cat_rvalue_node ( expr. id , expr. span , target) )
628+ Ok ( self . cat_rvalue_node ( expr. hir_id , expr. span , target) )
629629 }
630630 }
631631 }
@@ -669,8 +669,8 @@ impl<'a, 'gcx, 'tcx> MemCategorizationContext<'a, 'gcx, 'tcx> {
669669 }
670670
671671 hir:: ExprPath ( ref qpath) => {
672- let def = self . tables . qpath_def ( qpath, expr. hir_id ) ;
673- self . cat_def ( expr. id , expr. span , expr_ty, def)
672+ let def = self . tables . qpath_def ( qpath, expr. hir_id ) ;
673+ self . cat_def ( expr. hir_id , expr. span , expr_ty, def)
674674 }
675675
676676 hir:: ExprType ( ref e, _) => {
@@ -688,35 +688,35 @@ impl<'a, 'gcx, 'tcx> MemCategorizationContext<'a, 'gcx, 'tcx> {
688688 hir:: ExprLit ( ..) | hir:: ExprBreak ( ..) |
689689 hir:: ExprContinue ( ..) | hir:: ExprStruct ( ..) | hir:: ExprRepeat ( ..) |
690690 hir:: ExprInlineAsm ( ..) | hir:: ExprBox ( ..) => {
691- Ok ( self . cat_rvalue_node ( expr. id ( ) , expr. span ( ) , expr_ty) )
691+ Ok ( self . cat_rvalue_node ( expr. hir_id , expr. span , expr_ty) )
692692 }
693693 }
694694 }
695695
696696 pub fn cat_def ( & self ,
697- id : ast :: NodeId ,
697+ hir_id : hir :: HirId ,
698698 span : Span ,
699699 expr_ty : Ty < ' tcx > ,
700700 def : Def )
701701 -> McResult < cmt_ < ' tcx > > {
702- debug ! ( "cat_def: id={} expr={:?} def={:?}" ,
703- id , expr_ty, def) ;
702+ debug ! ( "cat_def: id={:? } expr={:?} def={:?}" ,
703+ hir_id , expr_ty, def) ;
704704
705705 match def {
706706 Def :: StructCtor ( ..) | Def :: VariantCtor ( ..) | Def :: Const ( ..) |
707707 Def :: AssociatedConst ( ..) | Def :: Fn ( ..) | Def :: Method ( ..) => {
708- Ok ( self . cat_rvalue_node ( id , span, expr_ty) )
708+ Ok ( self . cat_rvalue_node ( hir_id , span, expr_ty) )
709709 }
710710
711711 Def :: Static ( def_id, mutbl) => {
712712 // `#[thread_local]` statics may not outlive the current function.
713713 for attr in & self . tcx . get_attrs ( def_id) [ ..] {
714714 if attr. check_name ( "thread_local" ) {
715- return Ok ( self . cat_rvalue_node ( id , span, expr_ty) ) ;
715+ return Ok ( self . cat_rvalue_node ( hir_id , span, expr_ty) ) ;
716716 }
717717 }
718718 Ok ( cmt_ {
719- id : id ,
719+ hir_id ,
720720 span : span,
721721 cat : Categorization :: StaticItem ,
722722 mutbl : if mutbl { McDeclared } else { McImmutable } ,
@@ -726,12 +726,12 @@ impl<'a, 'gcx, 'tcx> MemCategorizationContext<'a, 'gcx, 'tcx> {
726726 }
727727
728728 Def :: Upvar ( var_id, _, fn_node_id) => {
729- self . cat_upvar ( id , span, var_id, fn_node_id)
729+ self . cat_upvar ( hir_id , span, var_id, fn_node_id)
730730 }
731731
732732 Def :: Local ( vid) => {
733733 Ok ( cmt_ {
734- id ,
734+ hir_id ,
735735 span,
736736 cat : Categorization :: Local ( vid) ,
737737 mutbl : MutabilityCategory :: from_local ( self . tcx , self . tables , vid) ,
@@ -747,7 +747,7 @@ impl<'a, 'gcx, 'tcx> MemCategorizationContext<'a, 'gcx, 'tcx> {
747747 // Categorize an upvar, complete with invisible derefs of closure
748748 // environment and upvar reference as appropriate.
749749 fn cat_upvar ( & self ,
750- id : ast :: NodeId ,
750+ hir_id : hir :: HirId ,
751751 span : Span ,
752752 var_id : ast:: NodeId ,
753753 fn_node_id : ast:: NodeId )
@@ -814,7 +814,7 @@ impl<'a, 'gcx, 'tcx> MemCategorizationContext<'a, 'gcx, 'tcx> {
814814 // from the environment (perhaps we should eventually desugar
815815 // this field further, but it will do for now).
816816 let cmt_result = cmt_ {
817- id ,
817+ hir_id ,
818818 span,
819819 cat : Categorization :: Upvar ( Upvar { id : upvar_id, kind : kind} ) ,
820820 mutbl : var_mutbl,
@@ -830,10 +830,10 @@ impl<'a, 'gcx, 'tcx> MemCategorizationContext<'a, 'gcx, 'tcx> {
830830 cmt_result
831831 }
832832 ty:: ClosureKind :: FnMut => {
833- self . env_deref ( id , span, upvar_id, var_mutbl, ty:: MutBorrow , cmt_result)
833+ self . env_deref ( hir_id , span, upvar_id, var_mutbl, ty:: MutBorrow , cmt_result)
834834 }
835835 ty:: ClosureKind :: Fn => {
836- self . env_deref ( id , span, upvar_id, var_mutbl, ty:: ImmBorrow , cmt_result)
836+ self . env_deref ( hir_id , span, upvar_id, var_mutbl, ty:: ImmBorrow , cmt_result)
837837 }
838838 } ;
839839
@@ -848,7 +848,7 @@ impl<'a, 'gcx, 'tcx> MemCategorizationContext<'a, 'gcx, 'tcx> {
848848 ty:: UpvarCapture :: ByRef ( upvar_borrow) => {
849849 let ptr = BorrowedPtr ( upvar_borrow. kind , upvar_borrow. region ) ;
850850 cmt_ {
851- id ,
851+ hir_id ,
852852 span,
853853 cat : Categorization :: Deref ( Rc :: new ( cmt_result) , ptr) ,
854854 mutbl : MutabilityCategory :: from_borrow_kind ( upvar_borrow. kind ) ,
@@ -864,7 +864,7 @@ impl<'a, 'gcx, 'tcx> MemCategorizationContext<'a, 'gcx, 'tcx> {
864864 }
865865
866866 fn env_deref ( & self ,
867- id : ast :: NodeId ,
867+ hir_id : hir :: HirId ,
868868 span : Span ,
869869 upvar_id : ty:: UpvarId ,
870870 upvar_mutbl : MutabilityCategory ,
@@ -908,7 +908,7 @@ impl<'a, 'gcx, 'tcx> MemCategorizationContext<'a, 'gcx, 'tcx> {
908908 }
909909
910910 let ret = cmt_ {
911- id ,
911+ hir_id ,
912912 span,
913913 cat : Categorization :: Deref ( Rc :: new ( cmt_result) , env_ptr) ,
914914 mutbl : deref_mutbl,
@@ -932,17 +932,16 @@ impl<'a, 'gcx, 'tcx> MemCategorizationContext<'a, 'gcx, 'tcx> {
932932 }
933933
934934 pub fn cat_rvalue_node ( & self ,
935- id : ast :: NodeId ,
935+ hir_id : hir :: HirId ,
936936 span : Span ,
937937 expr_ty : Ty < ' tcx > )
938938 -> cmt_ < ' tcx > {
939939 debug ! (
940940 "cat_rvalue_node(id={:?}, span={:?}, expr_ty={:?})" ,
941- id ,
941+ hir_id ,
942942 span,
943943 expr_ty,
944944 ) ;
945- let hir_id = self . tcx . hir . node_to_hir_id ( id) ;
946945 let promotable = self . rvalue_promotable_map . as_ref ( ) . map ( |m| m. contains ( & hir_id. local_id ) )
947946 . unwrap_or ( false ) ;
948947
@@ -970,18 +969,18 @@ impl<'a, 'gcx, 'tcx> MemCategorizationContext<'a, 'gcx, 'tcx> {
970969 } else {
971970 self . temporary_scope ( hir_id. local_id )
972971 } ;
973- let ret = self . cat_rvalue ( id , span, re, expr_ty) ;
972+ let ret = self . cat_rvalue ( hir_id , span, re, expr_ty) ;
974973 debug ! ( "cat_rvalue_node ret {:?}" , ret) ;
975974 ret
976975 }
977976
978977 pub fn cat_rvalue ( & self ,
979- cmt_id : ast :: NodeId ,
978+ cmt_hir_id : hir :: HirId ,
980979 span : Span ,
981980 temp_scope : ty:: Region < ' tcx > ,
982981 expr_ty : Ty < ' tcx > ) -> cmt_ < ' tcx > {
983982 let ret = cmt_ {
984- id : cmt_id ,
983+ hir_id : cmt_hir_id ,
985984 span : span,
986985 cat : Categorization :: Rvalue ( temp_scope) ,
987986 mutbl : McDeclared ,
@@ -992,15 +991,15 @@ impl<'a, 'gcx, 'tcx> MemCategorizationContext<'a, 'gcx, 'tcx> {
992991 ret
993992 }
994993
995- pub fn cat_field < N : ast_node > ( & self ,
994+ pub fn cat_field < N : HirNode > ( & self ,
996995 node : & N ,
997996 base_cmt : cmt < ' tcx > ,
998997 f_index : usize ,
999998 f_ident : ast:: Ident ,
1000999 f_ty : Ty < ' tcx > )
10011000 -> cmt_ < ' tcx > {
10021001 let ret = cmt_ {
1003- id : node. id ( ) ,
1002+ hir_id : node. hir_id ( ) ,
10041003 span : node. span ( ) ,
10051004 mutbl : base_cmt. mutbl . inherit ( ) ,
10061005 cat : Categorization :: Interior ( base_cmt,
@@ -1042,13 +1041,13 @@ impl<'a, 'gcx, 'tcx> MemCategorizationContext<'a, 'gcx, 'tcx> {
10421041 mutbl,
10431042 } ) ;
10441043
1045- let base_cmt = Rc :: new ( self . cat_rvalue_node ( expr. id , expr. span , ref_ty) ) ;
1044+ let base_cmt = Rc :: new ( self . cat_rvalue_node ( expr. hir_id , expr. span , ref_ty) ) ;
10461045 self . cat_deref ( expr, base_cmt, note)
10471046 }
10481047
10491048 pub fn cat_deref (
10501049 & self ,
1051- node : & impl ast_node ,
1050+ node : & impl HirNode ,
10521051 base_cmt : cmt < ' tcx > ,
10531052 note : Note ,
10541053 ) -> McResult < cmt_ < ' tcx > > {
@@ -1074,7 +1073,7 @@ impl<'a, 'gcx, 'tcx> MemCategorizationContext<'a, 'gcx, 'tcx> {
10741073 ref ty => bug ! ( "unexpected type in cat_deref: {:?}" , ty)
10751074 } ;
10761075 let ret = cmt_ {
1077- id : node. id ( ) ,
1076+ hir_id : node. hir_id ( ) ,
10781077 span : node. span ( ) ,
10791078 // For unique ptrs, we inherit mutability from the owning reference.
10801079 mutbl : MutabilityCategory :: from_pointer_kind ( base_cmt. mutbl , ptr) ,
@@ -1086,7 +1085,7 @@ impl<'a, 'gcx, 'tcx> MemCategorizationContext<'a, 'gcx, 'tcx> {
10861085 Ok ( ret)
10871086 }
10881087
1089- fn cat_index < N : ast_node > ( & self ,
1088+ fn cat_index < N : HirNode > ( & self ,
10901089 elt : & N ,
10911090 base_cmt : cmt < ' tcx > ,
10921091 element_ty : Ty < ' tcx > ,
@@ -1106,7 +1105,7 @@ impl<'a, 'gcx, 'tcx> MemCategorizationContext<'a, 'gcx, 'tcx> {
11061105 //! presuming that `base_cmt` is not of fixed-length type.
11071106 //!
11081107 //! # Parameters
1109- //! - `elt`: the AST node being indexed
1108+ //! - `elt`: the HIR node being indexed
11101109 //! - `base_cmt`: the cmt of `elt`
11111110
11121111 let interior_elem = InteriorElement ( context) ;
@@ -1115,14 +1114,14 @@ impl<'a, 'gcx, 'tcx> MemCategorizationContext<'a, 'gcx, 'tcx> {
11151114 return Ok ( ret) ;
11161115 }
11171116
1118- pub fn cat_imm_interior < N : ast_node > ( & self ,
1117+ pub fn cat_imm_interior < N : HirNode > ( & self ,
11191118 node : & N ,
11201119 base_cmt : cmt < ' tcx > ,
11211120 interior_ty : Ty < ' tcx > ,
11221121 interior : InteriorKind )
11231122 -> cmt_ < ' tcx > {
11241123 let ret = cmt_ {
1125- id : node. id ( ) ,
1124+ hir_id : node. hir_id ( ) ,
11261125 span : node. span ( ) ,
11271126 mutbl : base_cmt. mutbl . inherit ( ) ,
11281127 cat : Categorization :: Interior ( base_cmt, interior) ,
@@ -1133,7 +1132,7 @@ impl<'a, 'gcx, 'tcx> MemCategorizationContext<'a, 'gcx, 'tcx> {
11331132 ret
11341133 }
11351134
1136- pub fn cat_downcast_if_needed < N : ast_node > ( & self ,
1135+ pub fn cat_downcast_if_needed < N : HirNode > ( & self ,
11371136 node : & N ,
11381137 base_cmt : cmt < ' tcx > ,
11391138 variant_did : DefId )
@@ -1143,7 +1142,7 @@ impl<'a, 'gcx, 'tcx> MemCategorizationContext<'a, 'gcx, 'tcx> {
11431142 if self . tcx . adt_def ( base_did) . variants . len ( ) != 1 {
11441143 let base_ty = base_cmt. ty ;
11451144 let ret = Rc :: new ( cmt_ {
1146- id : node. id ( ) ,
1145+ hir_id : node. hir_id ( ) ,
11471146 span : node. span ( ) ,
11481147 mutbl : base_cmt. mutbl . inherit ( ) ,
11491148 cat : Categorization :: Downcast ( base_cmt, variant_did) ,
0 commit comments