Skip to content

Commit db38b10

Browse files
committed
Ignore racing Eq/StructuralEq trait impl warnings
Otherwise we sometimes get warnings about technically breaking changes when adding Eq in std::marker::Structural(Partial)Eq and sometimes in std::cmp::(Partial)Eq. Because structural traits are currently a hack/workaround and not something the user is expected to impl themselves (but is rather done by the compiler), let's ignore changes in structural eq trait impls.
1 parent be321bd commit db38b10

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

src/traverse.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1152,6 +1152,14 @@ fn diff_trait_impls<'tcx>(
11521152
{
11531153
let old_trait_def_id = tcx.impl_trait_ref(*old_impl_def_id).unwrap().def_id;
11541154

1155+
// NOTE: Ignore for now core::marker::Structural{Eq, PartialEq} since
1156+
// these are impl'd via *Eq traits but can we want users to see regular
1157+
// *Eq traits here as the former are a bit auto-magical for the user
1158+
let def_path_str = tcx.def_path_str(*old_impl_def_id);
1159+
if def_path_str.contains("::marker::Structural") {
1160+
continue;
1161+
}
1162+
11551163
if !to_new.can_translate(old_trait_def_id) || !is_impl_trait_public(tcx, *old_impl_def_id) {
11561164
continue;
11571165
}
@@ -1171,6 +1179,13 @@ fn diff_trait_impls<'tcx>(
11711179
.iter()
11721180
{
11731181
let new_trait_def_id = tcx.impl_trait_ref(*new_impl_def_id).unwrap().def_id;
1182+
// NOTE: Ignore for now core::marker::Structural{Eq, PartialEq} since
1183+
// these are impl'd via *Eq traits but can we want users to see regular
1184+
// *Eq traits here as the former are a bit auto-magical for the user
1185+
let def_path_str = tcx.def_path_str(new_trait_def_id);
1186+
if def_path_str.contains("::marker::Structural") {
1187+
continue;
1188+
}
11741189

11751190
if !to_old.can_translate(new_trait_def_id) || !is_impl_trait_public(tcx, *new_impl_def_id) {
11761191
continue;

0 commit comments

Comments
 (0)