@@ -449,6 +449,7 @@ pub fn eq_item_kind(l: &ItemKind, r: &ItemKind) -> bool {
449449 constness : lc,
450450 is_auto : la,
451451 safety : lu,
452+ impl_restriction : liprt,
452453 ident : li,
453454 generics : lg,
454455 bounds : lb,
@@ -458,6 +459,7 @@ pub fn eq_item_kind(l: &ItemKind, r: &ItemKind) -> bool {
458459 constness : rc,
459460 is_auto : ra,
460461 safety : ru,
462+ impl_restriction : riprt,
461463 ident : ri,
462464 generics : rg,
463465 bounds : rb,
@@ -467,6 +469,7 @@ pub fn eq_item_kind(l: &ItemKind, r: &ItemKind) -> bool {
467469 matches ! ( lc, ast:: Const :: No ) == matches ! ( rc, ast:: Const :: No )
468470 && la == ra
469471 && matches ! ( lu, Safety :: Default ) == matches ! ( ru, Safety :: Default )
472+ && eq_impl_restriction ( liprt, riprt)
470473 && eq_id ( * li, * ri)
471474 && eq_generics ( lg, rg)
472475 && over ( lb, rb, eq_generic_bound)
@@ -834,6 +837,29 @@ pub fn eq_vis(l: &Visibility, r: &Visibility) -> bool {
834837 }
835838}
836839
840+ pub fn eq_impl_restriction ( l : & ImplRestriction , r : & ImplRestriction ) -> bool {
841+ eq_restriction_kind ( & l. kind , & r. kind )
842+ }
843+
844+ fn eq_restriction_kind ( l : & RestrictionKind , r : & RestrictionKind ) -> bool {
845+ match ( l, r) {
846+ ( RestrictionKind :: Unrestricted , RestrictionKind :: Unrestricted ) => true ,
847+ (
848+ RestrictionKind :: Restricted {
849+ path : l_path,
850+ shorthand : l_short,
851+ id : _,
852+ } ,
853+ RestrictionKind :: Restricted {
854+ path : r_path,
855+ shorthand : r_short,
856+ id : _,
857+ } ,
858+ ) => l_short == r_short && eq_path ( l_path, r_path) ,
859+ _ => false ,
860+ }
861+ }
862+
837863pub fn eq_fn_decl ( l : & FnDecl , r : & FnDecl ) -> bool {
838864 eq_fn_ret_ty ( & l. output , & r. output )
839865 && over ( & l. inputs , & r. inputs , |l, r| {
0 commit comments