@@ -2727,7 +2727,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
27272727 parent_vis : & hir:: Visibility ,
27282728 trait_item_ref : & hir:: TraitItemRef )
27292729 -> AssociatedItem {
2730- let def_id = self . hir ( ) . local_def_id ( trait_item_ref. id . node_id ) ;
2730+ let def_id = self . hir ( ) . local_def_id_from_hir_id ( trait_item_ref. id . hir_id ) ;
27312731 let ( kind, has_self) = match trait_item_ref. kind {
27322732 hir:: AssociatedItemKind :: Const => ( ty:: AssociatedKind :: Const , false ) ,
27332733 hir:: AssociatedItemKind :: Method { has_self } => {
@@ -2737,13 +2737,11 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
27372737 hir:: AssociatedItemKind :: Existential => bug ! ( "only impls can have existentials" ) ,
27382738 } ;
27392739
2740- let hir_id = self . hir ( ) . node_to_hir_id ( trait_item_ref. id . node_id ) ;
2741-
27422740 AssociatedItem {
27432741 ident : trait_item_ref. ident ,
27442742 kind,
27452743 // Visibility of trait items is inherited from their traits.
2746- vis : Visibility :: from_hir ( parent_vis, hir_id, self ) ,
2744+ vis : Visibility :: from_hir ( parent_vis, trait_item_ref . id . hir_id , self ) ,
27472745 defaultness : trait_item_ref. defaultness ,
27482746 def_id,
27492747 container : TraitContainer ( parent_def_id) ,
@@ -2755,7 +2753,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
27552753 parent_def_id : DefId ,
27562754 impl_item_ref : & hir:: ImplItemRef )
27572755 -> AssociatedItem {
2758- let def_id = self . hir ( ) . local_def_id ( impl_item_ref. id . node_id ) ;
2756+ let def_id = self . hir ( ) . local_def_id_from_hir_id ( impl_item_ref. id . hir_id ) ;
27592757 let ( kind, has_self) = match impl_item_ref. kind {
27602758 hir:: AssociatedItemKind :: Const => ( ty:: AssociatedKind :: Const , false ) ,
27612759 hir:: AssociatedItemKind :: Method { has_self } => {
@@ -2765,13 +2763,11 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
27652763 hir:: AssociatedItemKind :: Existential => ( ty:: AssociatedKind :: Existential , false ) ,
27662764 } ;
27672765
2768- let hir_id = self . hir ( ) . node_to_hir_id ( impl_item_ref. id . node_id ) ;
2769-
27702766 AssociatedItem {
27712767 ident : impl_item_ref. ident ,
27722768 kind,
27732769 // Visibility of trait impl items doesn't matter.
2774- vis : ty:: Visibility :: from_hir ( & impl_item_ref. vis , hir_id, self ) ,
2770+ vis : ty:: Visibility :: from_hir ( & impl_item_ref. vis , impl_item_ref . id . hir_id , self ) ,
27752771 defaultness : impl_item_ref. defaultness ,
27762772 def_id,
27772773 container : ImplContainer ( parent_def_id) ,
@@ -3041,13 +3037,13 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
30413037}
30423038
30433039fn associated_item < ' a , ' tcx > ( tcx : TyCtxt < ' a , ' tcx , ' tcx > , def_id : DefId ) -> AssociatedItem {
3044- let id = tcx. hir ( ) . as_local_node_id ( def_id) . unwrap ( ) ;
3045- let parent_id = tcx. hir ( ) . get_parent ( id) ;
3046- let parent_def_id = tcx. hir ( ) . local_def_id ( parent_id) ;
3047- let parent_item = tcx. hir ( ) . expect_item ( parent_id) ;
3040+ let id = tcx. hir ( ) . as_local_hir_id ( def_id) . unwrap ( ) ;
3041+ let parent_id = tcx. hir ( ) . get_parent_item ( id) ;
3042+ let parent_def_id = tcx. hir ( ) . local_def_id_from_hir_id ( parent_id) ;
3043+ let parent_item = tcx. hir ( ) . expect_item_by_hir_id ( parent_id) ;
30483044 match parent_item. node {
30493045 hir:: ItemKind :: Impl ( .., ref impl_item_refs) => {
3050- if let Some ( impl_item_ref) = impl_item_refs. iter ( ) . find ( |i| i. id . node_id == id) {
3046+ if let Some ( impl_item_ref) = impl_item_refs. iter ( ) . find ( |i| i. id . hir_id == id) {
30513047 let assoc_item = tcx. associated_item_from_impl_item_ref ( parent_def_id,
30523048 impl_item_ref) ;
30533049 debug_assert_eq ! ( assoc_item. def_id, def_id) ;
@@ -3056,7 +3052,7 @@ fn associated_item<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> Asso
30563052 }
30573053
30583054 hir:: ItemKind :: Trait ( .., ref trait_item_refs) => {
3059- if let Some ( trait_item_ref) = trait_item_refs. iter ( ) . find ( |i| i. id . node_id == id) {
3055+ if let Some ( trait_item_ref) = trait_item_refs. iter ( ) . find ( |i| i. id . hir_id == id) {
30603056 let assoc_item = tcx. associated_item_from_trait_item_ref ( parent_def_id,
30613057 & parent_item. vis ,
30623058 trait_item_ref) ;
@@ -3110,13 +3106,13 @@ fn associated_item_def_ids<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
31103106 hir:: ItemKind :: Trait ( .., ref trait_item_refs) => {
31113107 trait_item_refs. iter ( )
31123108 . map ( |trait_item_ref| trait_item_ref. id )
3113- . map ( |id| tcx. hir ( ) . local_def_id ( id. node_id ) )
3109+ . map ( |id| tcx. hir ( ) . local_def_id_from_hir_id ( id. hir_id ) )
31143110 . collect ( )
31153111 }
31163112 hir:: ItemKind :: Impl ( .., ref impl_item_refs) => {
31173113 impl_item_refs. iter ( )
31183114 . map ( |impl_item_ref| impl_item_ref. id )
3119- . map ( |id| tcx. hir ( ) . local_def_id ( id. node_id ) )
3115+ . map ( |id| tcx. hir ( ) . local_def_id_from_hir_id ( id. hir_id ) )
31203116 . collect ( )
31213117 }
31223118 hir:: ItemKind :: TraitAlias ( ..) => vec ! [ ] ,
0 commit comments