@@ -4,6 +4,7 @@ use std::ops::ControlFlow;
4
4
use rustc_abi:: { BackendRepr , TagEncoding , VariantIdx , Variants , WrappingRange } ;
5
5
use rustc_data_structures:: fx:: FxHashSet ;
6
6
use rustc_errors:: DiagMessage ;
7
+ use rustc_hir:: def:: DefKind ;
7
8
use rustc_hir:: intravisit:: VisitorExt ;
8
9
use rustc_hir:: { AmbigArg , Expr , ExprKind , HirId , LangItem } ;
9
10
use rustc_middle:: bug;
@@ -1904,10 +1905,10 @@ impl InvalidAtomicOrdering {
1904
1905
if let ExprKind :: MethodCall ( method_path, _, args, _) = & expr. kind
1905
1906
&& recognized_names. contains ( & method_path. ident . name )
1906
1907
&& 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)
1909
1909
// 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 ( )
1911
1912
&& let parent = cx. tcx . parent ( adt. did ( ) )
1912
1913
&& cx. tcx . is_diagnostic_item ( sym:: atomic_mod, parent)
1913
1914
&& ATOMIC_TYPES . contains ( & cx. tcx . item_name ( adt. did ( ) ) )
0 commit comments