@@ -20,6 +20,7 @@ use log::{debug, info};
2020use rustc_hir:: def:: { CtorKind , CtorOf , DefKind , Res , Res :: Def } ;
2121use rustc_hir:: def_id:: DefId ;
2222use rustc_hir:: hir_id:: HirId ;
23+ use rustc_hir:: lang_items:: LangItem ;
2324use rustc_infer:: infer:: TyCtxtInferExt ;
2425use rustc_middle:: {
2526 hir:: exports:: Export ,
@@ -1144,17 +1145,20 @@ fn diff_trait_impls<'tcx>(
11441145 let to_new = TranslationContext :: target_new ( tcx, id_mapping, false ) ;
11451146 let to_old = TranslationContext :: target_old ( tcx, id_mapping, false ) ;
11461147
1148+ // NOTE: Ignore for now core::marker::Structural{Eq, PartialEq} since
1149+ // these are impl'd via *Eq traits but can we want users to see regular
1150+ // *Eq traits here as the former are a bit auto-magical for the user
1151+ let structural_teq_def_id = tcx. require_lang_item ( LangItem :: StructuralTeq , None ) ;
1152+ let structural_peq_def_id = tcx. require_lang_item ( LangItem :: StructuralPeq , None ) ;
1153+ let structural_trait_def_ids = [ structural_peq_def_id, structural_teq_def_id] ;
1154+
11471155 for ( old_impl_def_id, _) in tcx
11481156 . all_trait_implementations ( id_mapping. get_old_crate ( ) )
11491157 . iter ( )
11501158 {
11511159 let old_trait_def_id = tcx. impl_trait_ref ( * old_impl_def_id) . unwrap ( ) . def_id ;
11521160
1153- // NOTE: Ignore for now core::marker::Structural{Eq, PartialEq} since
1154- // these are impl'd via *Eq traits but can we want users to see regular
1155- // *Eq traits here as the former are a bit auto-magical for the user
1156- let def_path_str = tcx. def_path_str ( * old_impl_def_id) ;
1157- if def_path_str. contains ( "::marker::Structural" ) {
1161+ if structural_trait_def_ids. contains ( & old_trait_def_id) {
11581162 continue ;
11591163 }
11601164
@@ -1177,11 +1181,8 @@ fn diff_trait_impls<'tcx>(
11771181 . iter ( )
11781182 {
11791183 let new_trait_def_id = tcx. impl_trait_ref ( * new_impl_def_id) . unwrap ( ) . def_id ;
1180- // NOTE: Ignore for now core::marker::Structural{Eq, PartialEq} since
1181- // these are impl'd via *Eq traits but can we want users to see regular
1182- // *Eq traits here as the former are a bit auto-magical for the user
1183- let def_path_str = tcx. def_path_str ( new_trait_def_id) ;
1184- if def_path_str. contains ( "::marker::Structural" ) {
1184+
1185+ if structural_trait_def_ids. contains ( & new_trait_def_id) {
11851186 continue ;
11861187 }
11871188
0 commit comments