@@ -532,7 +532,7 @@ fn convert_enum_variant_types<'a, 'tcx>(
532532 let wrapped_discr = prev_discr. map_or ( initial, |d| d. wrap_incr ( tcx) ) ;
533533 prev_discr = Some (
534534 if let Some ( ref e) = variant. node . disr_expr {
535- let expr_did = tcx. hir ( ) . local_def_id ( e. id ) ;
535+ let expr_did = tcx. hir ( ) . local_def_id_from_hir_id ( e. hir_id ) ;
536536 def. eval_explicit_discr ( tcx, expr_did)
537537 } else if let Some ( discr) = repr_type. disr_incr ( tcx, prev_discr) {
538538 Some ( discr)
@@ -637,7 +637,7 @@ fn adt_def<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> &'tcx ty::Ad
637637 let did = tcx. hir ( ) . local_def_id ( v. node . data . id ( ) ) ;
638638 let discr = if let Some ( ref e) = v. node . disr_expr {
639639 distance_from_explicit = 0 ;
640- ty:: VariantDiscr :: Explicit ( tcx. hir ( ) . local_def_id ( e. id ) )
640+ ty:: VariantDiscr :: Explicit ( tcx. hir ( ) . local_def_id_from_hir_id ( e. hir_id ) )
641641 } else {
642642 ty:: VariantDiscr :: Relative ( distance_from_explicit)
643643 } ;
@@ -1142,11 +1142,11 @@ fn report_assoc_ty_on_inherent_impl<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, span:
11421142fn type_of < ' a , ' tcx > ( tcx : TyCtxt < ' a , ' tcx , ' tcx > , def_id : DefId ) -> Ty < ' tcx > {
11431143 use rustc:: hir:: * ;
11441144
1145- let node_id = tcx. hir ( ) . as_local_node_id ( def_id) . unwrap ( ) ;
1145+ let hir_id = tcx. hir ( ) . as_local_hir_id ( def_id) . unwrap ( ) ;
11461146
11471147 let icx = ItemCtxt :: new ( tcx, def_id) ;
11481148
1149- match tcx. hir ( ) . get ( node_id ) {
1149+ match tcx. hir ( ) . get_by_hir_id ( hir_id ) {
11501150 Node :: TraitItem ( item) => match item. node {
11511151 TraitItemKind :: Method ( ..) => {
11521152 let substs = InternalSubsts :: identity_for_item ( tcx, def_id) ;
@@ -1166,7 +1166,7 @@ fn type_of<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> Ty<'tcx> {
11661166 ImplItemKind :: Const ( ref ty, _) => icx. to_ty ( ty) ,
11671167 ImplItemKind :: Existential ( _) => {
11681168 if tcx
1169- . impl_trait_ref ( tcx. hir ( ) . get_parent_did ( node_id ) )
1169+ . impl_trait_ref ( tcx. hir ( ) . get_parent_did_by_hir_id ( hir_id ) )
11701170 . is_none ( )
11711171 {
11721172 report_assoc_ty_on_inherent_impl ( tcx, item. span ) ;
@@ -1176,7 +1176,7 @@ fn type_of<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> Ty<'tcx> {
11761176 }
11771177 ImplItemKind :: Type ( ref ty) => {
11781178 if tcx
1179- . impl_trait_ref ( tcx. hir ( ) . get_parent_did ( node_id ) )
1179+ . impl_trait_ref ( tcx. hir ( ) . get_parent_did_by_hir_id ( hir_id ) )
11801180 . is_none ( )
11811181 {
11821182 report_assoc_ty_on_inherent_impl ( tcx, item. span ) ;
@@ -1259,7 +1259,7 @@ fn type_of<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> Ty<'tcx> {
12591259 ..
12601260 } ) => match * def {
12611261 VariantData :: Unit ( ..) | VariantData :: Struct ( ..) => {
1262- tcx. type_of ( tcx. hir ( ) . get_parent_did ( node_id ) )
1262+ tcx. type_of ( tcx. hir ( ) . get_parent_did_by_hir_id ( hir_id ) )
12631263 }
12641264 VariantData :: Tuple ( ..) => {
12651265 let substs = InternalSubsts :: identity_for_item ( tcx, def_id) ;
@@ -1274,7 +1274,6 @@ fn type_of<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> Ty<'tcx> {
12741274 ..
12751275 } ) => {
12761276 if gen. is_some ( ) {
1277- let hir_id = tcx. hir ( ) . node_to_hir_id ( node_id) ;
12781277 return tcx. typeck_tables_of ( def_id) . node_type ( hir_id) ;
12791278 }
12801279
@@ -1285,7 +1284,9 @@ fn type_of<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> Ty<'tcx> {
12851284 tcx. mk_closure ( def_id, substs)
12861285 }
12871286
1288- Node :: AnonConst ( _) => match tcx. hir ( ) . get ( tcx. hir ( ) . get_parent_node ( node_id) ) {
1287+ Node :: AnonConst ( _) => match tcx. hir ( ) . get_by_hir_id (
1288+ tcx. hir ( ) . get_parent_node_by_hir_id ( hir_id) )
1289+ {
12891290 Node :: Ty ( & hir:: Ty {
12901291 node : hir:: TyKind :: Array ( _, ref constant) ,
12911292 ..
@@ -1297,7 +1298,7 @@ fn type_of<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> Ty<'tcx> {
12971298 | Node :: Expr ( & hir:: Expr {
12981299 node : ExprKind :: Repeat ( _, ref constant) ,
12991300 ..
1300- } ) if constant. id == node_id =>
1301+ } ) if constant. hir_id == hir_id =>
13011302 {
13021303 tcx. types . usize
13031304 }
@@ -1309,9 +1310,9 @@ fn type_of<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> Ty<'tcx> {
13091310 ..
13101311 } ,
13111312 ..
1312- } ) if e. id == node_id =>
1313+ } ) if e. hir_id == hir_id =>
13131314 {
1314- tcx. adt_def ( tcx. hir ( ) . get_parent_did ( node_id ) )
1315+ tcx. adt_def ( tcx. hir ( ) . get_parent_did_by_hir_id ( hir_id ) )
13151316 . repr
13161317 . discr_type ( )
13171318 . to_ty ( tcx)
0 commit comments