@@ -4,6 +4,7 @@ use std::ops::ControlFlow;
44use rustc_abi:: { BackendRepr , TagEncoding , VariantIdx , Variants , WrappingRange } ;
55use rustc_data_structures:: fx:: FxHashSet ;
66use rustc_errors:: DiagMessage ;
7+ use rustc_hir:: def:: DefKind ;
78use rustc_hir:: intravisit:: VisitorExt ;
89use rustc_hir:: { AmbigArg , Expr , ExprKind , HirId , LangItem } ;
910use rustc_middle:: bug;
@@ -1904,10 +1905,10 @@ impl InvalidAtomicOrdering {
19041905 if let ExprKind :: MethodCall ( method_path, _, args, _) = & expr. kind
19051906 && recognized_names. contains ( & method_path. ident . name )
19061907 && let Some ( m_def_id) = cx. typeck_results ( ) . type_dependent_def_id ( expr. hir_id )
1907- && let Some ( impl_did) = cx. tcx . impl_of_assoc ( m_def_id)
1908- && let Some ( adt) = cx. tcx . type_of ( impl_did) . instantiate_identity ( ) . ty_adt_def ( )
1908+ && let impl_did = cx. tcx . parent ( m_def_id)
19091909 // skip extension traits, only lint functions from the standard library
1910- && cx. tcx . trait_id_of_impl ( impl_did) . is_none ( )
1910+ && cx. tcx . def_kind ( impl_did) == ( DefKind :: Impl { of_trait : false } )
1911+ && let Some ( adt) = cx. tcx . type_of ( impl_did) . instantiate_identity ( ) . ty_adt_def ( )
19111912 && let parent = cx. tcx . parent ( adt. did ( ) )
19121913 && cx. tcx . is_diagnostic_item ( sym:: atomic_mod, parent)
19131914 && ATOMIC_TYPES . contains ( & cx. tcx . item_name ( adt. did ( ) ) )
0 commit comments