@@ -328,23 +328,14 @@ fn check_trait_item<'tcx>(
328
328
) -> Result < ( ) , ErrorGuaranteed > {
329
329
let def_id = trait_item. owner_id . def_id ;
330
330
331
- let span = match trait_item. kind {
332
- hir:: TraitItemKind :: Type ( _bounds, Some ( ty) ) => ty. span ,
333
- _ => trait_item. span ,
334
- } ;
335
-
336
331
// Check that an item definition in a subtrait is shadowing a supertrait item.
337
332
lint_item_shadowing_supertrait_item ( tcx, def_id) ;
338
333
339
- let mut res = check_associated_item ( tcx, def_id, span ) ;
334
+ let mut res = check_associated_item ( tcx, def_id) ;
340
335
341
336
if matches ! ( trait_item. kind, hir:: TraitItemKind :: Fn ( ..) ) {
342
337
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 ( ) ) ) ;
348
339
}
349
340
}
350
341
res
@@ -827,12 +818,7 @@ fn check_impl_item<'tcx>(
827
818
tcx : TyCtxt < ' tcx > ,
828
819
impl_item : & ' tcx hir:: ImplItem < ' tcx > ,
829
820
) -> 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 )
836
822
}
837
823
838
824
fn 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
960
946
}
961
947
}
962
948
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 > {
969
951
let loc = Some ( WellFormedLoc :: Ty ( item_id) ) ;
970
952
enter_wf_checking_ctxt ( tcx, item_id, |wfcx| {
971
953
let item = tcx. associated_item ( item_id) ;
@@ -982,6 +964,8 @@ fn check_associated_item(
982
964
}
983
965
} ;
984
966
967
+ let span = tcx. def_span ( item_id) ;
968
+
985
969
match item. kind {
986
970
ty:: AssocKind :: Const { .. } => {
987
971
let ty = tcx. type_of ( item. def_id ) . instantiate_identity ( ) ;
0 commit comments