File tree Expand file tree Collapse file tree 1 file changed +13
-16
lines changed
compiler/rustc_passes/src Expand file tree Collapse file tree 1 file changed +13
-16
lines changed Original file line number Diff line number Diff line change @@ -325,26 +325,23 @@ fn check_item<'tcx>(
325325 }
326326
327327 // We need only trait impls here, not inherent impls, and only non-exported ones
328- let item = tcx. hir ( ) . item ( id) ;
329- if let hir:: ItemKind :: Impl ( hir:: Impl { of_trait : Some ( ref trait_ref) , ref items, .. } ) =
330- item. kind
331- {
332- if !effective_visibilities. is_reachable ( item. owner_id . def_id ) {
333- worklist. extend ( items. iter ( ) . map ( |ii_ref| ii_ref. id . owner_id . def_id ) ) ;
328+ if effective_visibilities. is_reachable ( id. owner_id . def_id ) {
329+ return ;
330+ }
334331
335- let Res :: Def ( DefKind :: Trait , trait_def_id) = trait_ref. path . res else {
336- unreachable ! ( ) ;
337- } ;
332+ let items = tcx. associated_item_def_ids ( id. owner_id ) ;
333+ worklist. extend ( items. iter ( ) . map ( |ii_ref| ii_ref. expect_local ( ) ) ) ;
338334
339- if !trait_def_id . is_local ( ) {
340- return ;
341- }
335+ let Some ( trait_def_id ) = tcx . trait_id_of_impl ( id . owner_id . to_def_id ( ) ) else {
336+ unreachable ! ( ) ;
337+ } ;
342338
343- worklist. extend (
344- tcx. provided_trait_methods ( trait_def_id) . map ( |assoc| assoc. def_id . expect_local ( ) ) ,
345- ) ;
346- }
339+ if !trait_def_id. is_local ( ) {
340+ return ;
347341 }
342+
343+ worklist
344+ . extend ( tcx. provided_trait_methods ( trait_def_id) . map ( |assoc| assoc. def_id . expect_local ( ) ) ) ;
348345}
349346
350347fn has_custom_linkage ( tcx : TyCtxt < ' _ > , def_id : LocalDefId ) -> bool {
You can’t perform that action at this time.
0 commit comments