@@ -20,6 +20,7 @@ use log::{debug, info};
20
20
use rustc_hir:: def:: { CtorKind , CtorOf , DefKind , Res , Res :: Def } ;
21
21
use rustc_hir:: def_id:: DefId ;
22
22
use rustc_hir:: hir_id:: HirId ;
23
+ use rustc_hir:: lang_items:: LangItem ;
23
24
use rustc_infer:: infer:: TyCtxtInferExt ;
24
25
use rustc_middle:: {
25
26
hir:: exports:: Export ,
@@ -1144,17 +1145,20 @@ fn diff_trait_impls<'tcx>(
1144
1145
let to_new = TranslationContext :: target_new ( tcx, id_mapping, false ) ;
1145
1146
let to_old = TranslationContext :: target_old ( tcx, id_mapping, false ) ;
1146
1147
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
+
1147
1155
for ( old_impl_def_id, _) in tcx
1148
1156
. all_trait_implementations ( id_mapping. get_old_crate ( ) )
1149
1157
. iter ( )
1150
1158
{
1151
1159
let old_trait_def_id = tcx. impl_trait_ref ( * old_impl_def_id) . unwrap ( ) . def_id ;
1152
1160
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) {
1158
1162
continue ;
1159
1163
}
1160
1164
@@ -1177,11 +1181,8 @@ fn diff_trait_impls<'tcx>(
1177
1181
. iter ( )
1178
1182
{
1179
1183
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) {
1185
1186
continue ;
1186
1187
}
1187
1188
0 commit comments