@@ -129,12 +129,12 @@ impl<'a, 'tcx> Visitor<'tcx> for CollectItemTypesVisitor<'a, 'tcx> {
129129 hir:: GenericParamKind :: Type {
130130 default : Some ( _) , ..
131131 } => {
132- let def_id = self . tcx . hir ( ) . local_def_id ( param. id ) ;
132+ let def_id = self . tcx . hir ( ) . local_def_id_from_hir_id ( param. hir_id ) ;
133133 self . tcx . type_of ( def_id) ;
134134 }
135135 hir:: GenericParamKind :: Type { .. } => { }
136136 hir:: GenericParamKind :: Const { .. } => {
137- let def_id = self . tcx . hir ( ) . local_def_id ( param. id ) ;
137+ let def_id = self . tcx . hir ( ) . local_def_id_from_hir_id ( param. hir_id ) ;
138138 self . tcx . type_of ( def_id) ;
139139 }
140140 }
@@ -322,9 +322,10 @@ fn type_param_predicates<'a, 'tcx>(
322322 } ;
323323
324324 let icx = ItemCtxt :: new ( tcx, item_def_id) ;
325+ let param_hir_id = tcx. hir ( ) . node_to_hir_id ( param_id) ;
325326 Lrc :: make_mut ( & mut result)
326327 . predicates
327- . extend ( icx. type_parameter_bounds_in_generics ( ast_generics, param_id , ty,
328+ . extend ( icx. type_parameter_bounds_in_generics ( ast_generics, param_hir_id , ty,
328329 OnlySelfBounds ( true ) ) ) ;
329330 result
330331}
@@ -337,15 +338,15 @@ impl<'a, 'tcx> ItemCtxt<'a, 'tcx> {
337338 fn type_parameter_bounds_in_generics (
338339 & self ,
339340 ast_generics : & hir:: Generics ,
340- param_id : ast :: NodeId ,
341+ param_id : hir :: HirId ,
341342 ty : Ty < ' tcx > ,
342343 only_self_bounds : OnlySelfBounds ,
343344 ) -> Vec < ( ty:: Predicate < ' tcx > , Span ) > {
344345 let from_ty_params = ast_generics
345346 . params
346347 . iter ( )
347348 . filter_map ( |param| match param. kind {
348- GenericParamKind :: Type { .. } if param. id == param_id => Some ( & param. bounds ) ,
349+ GenericParamKind :: Type { .. } if param. hir_id == param_id => Some ( & param. bounds ) ,
349350 _ => None ,
350351 } )
351352 . flat_map ( |bounds| bounds. iter ( ) )
@@ -382,12 +383,12 @@ impl<'a, 'tcx> ItemCtxt<'a, 'tcx> {
382383fn is_param < ' a , ' tcx > (
383384 tcx : TyCtxt < ' a , ' tcx , ' tcx > ,
384385 ast_ty : & hir:: Ty ,
385- param_id : ast :: NodeId ,
386+ param_id : hir :: HirId ,
386387) -> bool {
387388 if let hir:: TyKind :: Path ( hir:: QPath :: Resolved ( None , ref path) ) = ast_ty. node {
388389 match path. def {
389390 Def :: SelfTy ( Some ( def_id) , None ) | Def :: TyParam ( def_id) => {
390- def_id == tcx. hir ( ) . local_def_id ( param_id)
391+ def_id == tcx. hir ( ) . local_def_id_from_hir_id ( param_id)
391392 }
392393 _ => false ,
393394 }
@@ -721,7 +722,7 @@ fn super_predicates_of<'a, 'tcx>(
721722 // as one of its "superpredicates".
722723 let is_trait_alias = tcx. is_trait_alias ( trait_def_id) ;
723724 let superbounds2 = icx. type_parameter_bounds_in_generics (
724- generics, item. id , self_param_ty, OnlySelfBounds ( !is_trait_alias) ) ;
725+ generics, item. hir_id , self_param_ty, OnlySelfBounds ( !is_trait_alias) ) ;
725726
726727 // Combine the two lists to form the complete set of superbounds:
727728 let superbounds: Vec < _ > = superbounds1. into_iter ( ) . chain ( superbounds2) . collect ( ) ;
@@ -987,7 +988,7 @@ fn generics_of<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> &'tcx ty
987988 . map ( |( i, param) | ty:: GenericParamDef {
988989 name : param. name . ident ( ) . as_interned_str ( ) ,
989990 index : own_start + i as u32 ,
990- def_id : tcx. hir ( ) . local_def_id ( param. id ) ,
991+ def_id : tcx. hir ( ) . local_def_id_from_hir_id ( param. hir_id ) ,
991992 pure_wrt_drop : param. pure_wrt_drop ,
992993 kind : ty:: GenericParamDefKind :: Lifetime ,
993994 } ) ,
@@ -1018,9 +1019,9 @@ fn generics_of<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> &'tcx ty
10181019
10191020 if !allow_defaults && default. is_some ( ) {
10201021 if !tcx. features ( ) . default_type_parameter_fallback {
1021- tcx. lint_node (
1022+ tcx. lint_hir (
10221023 lint:: builtin:: INVALID_TYPE_PARAM_DEFAULT ,
1023- param. id ,
1024+ param. hir_id ,
10241025 param. span ,
10251026 & format ! (
10261027 "defaults for type parameters are only allowed in \
@@ -1033,7 +1034,7 @@ fn generics_of<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> &'tcx ty
10331034 let ty_param = ty:: GenericParamDef {
10341035 index : type_start + i as u32 ,
10351036 name : param. name . ident ( ) . as_interned_str ( ) ,
1036- def_id : tcx. hir ( ) . local_def_id ( param. id ) ,
1037+ def_id : tcx. hir ( ) . local_def_id_from_hir_id ( param. hir_id ) ,
10371038 pure_wrt_drop : param. pure_wrt_drop ,
10381039 kind : ty:: GenericParamDefKind :: Type {
10391040 has_default : default. is_some ( ) ,
@@ -1704,8 +1705,7 @@ fn early_bound_lifetimes_from_generics<'a, 'tcx>(
17041705 . iter ( )
17051706 . filter ( move |param| match param. kind {
17061707 GenericParamKind :: Lifetime { .. } => {
1707- let hir_id = tcx. hir ( ) . node_to_hir_id ( param. id ) ;
1708- !tcx. is_late_bound ( hir_id)
1708+ !tcx. is_late_bound ( param. hir_id )
17091709 }
17101710 _ => false ,
17111711 } )
@@ -1942,7 +1942,7 @@ fn explicit_predicates_of<'a, 'tcx>(
19421942 let mut index = parent_count + has_own_self as u32 ;
19431943 for param in early_bound_lifetimes_from_generics ( tcx, ast_generics) {
19441944 let region = tcx. mk_region ( ty:: ReEarlyBound ( ty:: EarlyBoundRegion {
1945- def_id : tcx. hir ( ) . local_def_id ( param. id ) ,
1945+ def_id : tcx. hir ( ) . local_def_id_from_hir_id ( param. hir_id ) ,
19461946 index,
19471947 name : param. name . ident ( ) . as_interned_str ( ) ,
19481948 } ) ) ;
0 commit comments