@@ -328,23 +328,14 @@ fn check_trait_item<'tcx>(
328328) -> Result < ( ) , ErrorGuaranteed > {
329329 let def_id = trait_item. owner_id . def_id ;
330330
331- let span = match trait_item. kind {
332- hir:: TraitItemKind :: Type ( _bounds, Some ( ty) ) => ty. span ,
333- _ => trait_item. span ,
334- } ;
335-
336331 // Check that an item definition in a subtrait is shadowing a supertrait item.
337332 lint_item_shadowing_supertrait_item ( tcx, def_id) ;
338333
339- let mut res = check_associated_item ( tcx, def_id, span ) ;
334+ let mut res = check_associated_item ( tcx, def_id) ;
340335
341336 if matches ! ( trait_item. kind, hir:: TraitItemKind :: Fn ( ..) ) {
342337 for & assoc_ty_def_id in tcx. associated_types_for_impl_traits_in_associated_fn ( def_id) {
343- res = res. and ( check_associated_item (
344- tcx,
345- assoc_ty_def_id. expect_local ( ) ,
346- tcx. def_span ( assoc_ty_def_id) ,
347- ) ) ;
338+ res = res. and ( check_associated_item ( tcx, assoc_ty_def_id. expect_local ( ) ) ) ;
348339 }
349340 }
350341 res
@@ -827,12 +818,7 @@ fn check_impl_item<'tcx>(
827818 tcx : TyCtxt < ' tcx > ,
828819 impl_item : & ' tcx hir:: ImplItem < ' tcx > ,
829820) -> Result < ( ) , ErrorGuaranteed > {
830- let span = match impl_item. kind {
831- // Constrain binding and overflow error spans to `<Ty>` in `type foo = <Ty>`.
832- hir:: ImplItemKind :: Type ( ty) if ty. span != DUMMY_SP => ty. span ,
833- _ => impl_item. span ,
834- } ;
835- check_associated_item ( tcx, impl_item. owner_id . def_id , span)
821+ check_associated_item ( tcx, impl_item. owner_id . def_id )
836822}
837823
838824fn check_param_wf ( tcx : TyCtxt < ' _ > , param : & ty:: GenericParamDef ) -> Result < ( ) , ErrorGuaranteed > {
@@ -960,12 +946,8 @@ fn check_param_wf(tcx: TyCtxt<'_>, param: &ty::GenericParamDef) -> Result<(), Er
960946 }
961947}
962948
963- #[ instrument( level = "debug" , skip( tcx, span) ) ]
964- fn check_associated_item (
965- tcx : TyCtxt < ' _ > ,
966- item_id : LocalDefId ,
967- span : Span ,
968- ) -> Result < ( ) , ErrorGuaranteed > {
949+ #[ instrument( level = "debug" , skip( tcx) ) ]
950+ fn check_associated_item ( tcx : TyCtxt < ' _ > , item_id : LocalDefId ) -> Result < ( ) , ErrorGuaranteed > {
969951 let loc = Some ( WellFormedLoc :: Ty ( item_id) ) ;
970952 enter_wf_checking_ctxt ( tcx, item_id, |wfcx| {
971953 let item = tcx. associated_item ( item_id) ;
@@ -982,6 +964,8 @@ fn check_associated_item(
982964 }
983965 } ;
984966
967+ let span = tcx. def_span ( item_id) ;
968+
985969 match item. kind {
986970 ty:: AssocKind :: Const { .. } => {
987971 let ty = tcx. type_of ( item. def_id ) . instantiate_identity ( ) ;
0 commit comments