@@ -7,7 +7,6 @@ use rustc_hir::def::{DefKind, Res};
77use  rustc_hir:: def_id:: { CRATE_DEF_ID ,  LocalDefId } ; 
88use  rustc_hir:: { self  as  hir,  HirId ,  PredicateOrigin } ; 
99use  rustc_index:: { IndexSlice ,  IndexVec } ; 
10- use  rustc_middle:: span_bug; 
1110use  rustc_middle:: ty:: { ResolverAstLowering ,  TyCtxt } ; 
1211use  rustc_span:: edit_distance:: find_best_match_for_name; 
1312use  rustc_span:: { DUMMY_SP ,  DesugaringKind ,  Ident ,  Span ,  Symbol ,  kw,  sym} ; 
@@ -104,10 +103,7 @@ impl<'a, 'hir> ItemLowerer<'a, 'hir> {
104103    } 
105104
106105    fn  lower_assoc_item ( & mut  self ,  item :  & AssocItem ,  ctxt :  AssocCtxt )  { 
107-         let  def_id = self . resolver . node_id_to_def_id [ & item. id ] ; 
108-         let  parent_id = self . tcx . local_parent ( def_id) ; 
109-         let  parent_hir = self . lower_node ( parent_id) . unwrap ( ) ; 
110-         self . with_lctx ( item. id ,  |lctx| lctx. lower_assoc_item ( item,  ctxt,  parent_hir) ) 
106+         self . with_lctx ( item. id ,  |lctx| lctx. lower_assoc_item ( item,  ctxt) ) 
111107    } 
112108
113109    fn  lower_foreign_item ( & mut  self ,  item :  & ForeignItem )  { 
@@ -631,29 +627,18 @@ impl<'hir> LoweringContext<'_, 'hir> {
631627        } 
632628    } 
633629
634-     fn  lower_assoc_item ( 
635-         & mut  self , 
636-         item :  & AssocItem , 
637-         ctxt :  AssocCtxt , 
638-         parent_hir :  & ' hir  hir:: OwnerInfo < ' hir > , 
639-     )  -> hir:: OwnerNode < ' hir >  { 
640-         let  parent_item = parent_hir. node ( ) . expect_item ( ) ; 
641-         match  parent_item. kind  { 
642-             hir:: ItemKind :: Impl ( impl_)  => { 
643-                 self . is_in_trait_impl  = impl_. of_trait . is_some ( ) ; 
644-             } 
645-             hir:: ItemKind :: Trait ( ..)  => { } 
646-             kind => { 
647-                 span_bug ! ( item. span,  "assoc item has unexpected kind of parent: {}" ,  kind. descr( ) ) 
648-             } 
649-         } 
650- 
630+     fn  lower_assoc_item ( & mut  self ,  item :  & AssocItem ,  ctxt :  AssocCtxt )  -> hir:: OwnerNode < ' hir >  { 
651631        // Evaluate with the lifetimes in `params` in-scope. 
652632        // This is used to track which lifetimes have already been defined, 
653633        // and which need to be replicated when lowering an async fn. 
654634        match  ctxt { 
655635            AssocCtxt :: Trait  => hir:: OwnerNode :: TraitItem ( self . lower_trait_item ( item) ) , 
656-             AssocCtxt :: Impl  => hir:: OwnerNode :: ImplItem ( self . lower_impl_item ( item) ) , 
636+             AssocCtxt :: Impl  {  of_trait }  => { 
637+                 if  of_trait { 
638+                     self . is_in_trait_impl  = of_trait; 
639+                 } 
640+                 hir:: OwnerNode :: ImplItem ( self . lower_impl_item ( item) ) 
641+             } 
657642        } 
658643    } 
659644
0 commit comments