1
1
//! A set of high-level utility fixture methods to use in tests.
2
- use std:: { mem, str:: FromStr , sync} ;
2
+ use std:: { any :: TypeId , mem, str:: FromStr , sync} ;
3
3
4
4
use base_db:: {
5
5
Crate , CrateDisplayName , CrateGraphBuilder , CrateName , CrateOrigin , CrateWorkspaceData ,
@@ -677,6 +677,10 @@ impl ProcMacroExpander for IdentityProcMacroExpander {
677
677
) -> Result < TopSubtree , ProcMacroExpansionError > {
678
678
Ok ( subtree. clone ( ) )
679
679
}
680
+
681
+ fn eq_dyn ( & self , other : & dyn ProcMacroExpander ) -> bool {
682
+ other. type_id ( ) == TypeId :: of :: < Self > ( )
683
+ }
680
684
}
681
685
682
686
// Expands to a macro_rules! macro, for issue #18089.
@@ -708,6 +712,10 @@ impl ProcMacroExpander for Issue18089ProcMacroExpander {
708
712
#subtree
709
713
} )
710
714
}
715
+
716
+ fn eq_dyn ( & self , other : & dyn ProcMacroExpander ) -> bool {
717
+ other. type_id ( ) == TypeId :: of :: < Self > ( )
718
+ }
711
719
}
712
720
713
721
// Pastes the attribute input as its output
@@ -728,6 +736,10 @@ impl ProcMacroExpander for AttributeInputReplaceProcMacroExpander {
728
736
. cloned ( )
729
737
. ok_or_else ( || ProcMacroExpansionError :: Panic ( "Expected attribute input" . into ( ) ) )
730
738
}
739
+
740
+ fn eq_dyn ( & self , other : & dyn ProcMacroExpander ) -> bool {
741
+ other. type_id ( ) == TypeId :: of :: < Self > ( )
742
+ }
731
743
}
732
744
733
745
#[ derive( Debug ) ]
@@ -759,6 +771,10 @@ impl ProcMacroExpander for Issue18840ProcMacroExpander {
759
771
top_subtree_delimiter_mut. close = def_site;
760
772
Ok ( result)
761
773
}
774
+
775
+ fn eq_dyn ( & self , other : & dyn ProcMacroExpander ) -> bool {
776
+ other. type_id ( ) == TypeId :: of :: < Self > ( )
777
+ }
762
778
}
763
779
764
780
#[ derive( Debug ) ]
@@ -790,6 +806,10 @@ impl ProcMacroExpander for MirrorProcMacroExpander {
790
806
traverse ( & mut builder, input. iter ( ) ) ;
791
807
Ok ( builder. build ( ) )
792
808
}
809
+
810
+ fn eq_dyn ( & self , other : & dyn ProcMacroExpander ) -> bool {
811
+ other. type_id ( ) == TypeId :: of :: < Self > ( )
812
+ }
793
813
}
794
814
795
815
// Replaces every literal with an empty string literal and every identifier with its first letter,
@@ -830,6 +850,10 @@ impl ProcMacroExpander for ShortenProcMacroExpander {
830
850
}
831
851
}
832
852
}
853
+
854
+ fn eq_dyn ( & self , other : & dyn ProcMacroExpander ) -> bool {
855
+ other. type_id ( ) == TypeId :: of :: < Self > ( )
856
+ }
833
857
}
834
858
835
859
// Reads ident type within string quotes, for issue #17479.
@@ -855,6 +879,10 @@ impl ProcMacroExpander for Issue17479ProcMacroExpander {
855
879
#symbol( )
856
880
} )
857
881
}
882
+
883
+ fn eq_dyn ( & self , other : & dyn ProcMacroExpander ) -> bool {
884
+ other. type_id ( ) == TypeId :: of :: < Self > ( )
885
+ }
858
886
}
859
887
860
888
// Reads ident type within string quotes, for issue #17479.
@@ -906,6 +934,10 @@ impl ProcMacroExpander for Issue18898ProcMacroExpander {
906
934
}
907
935
} )
908
936
}
937
+
938
+ fn eq_dyn ( & self , other : & dyn ProcMacroExpander ) -> bool {
939
+ other. type_id ( ) == TypeId :: of :: < Self > ( )
940
+ }
909
941
}
910
942
911
943
// Reads ident type within string quotes, for issue #17479.
@@ -933,6 +965,10 @@ impl ProcMacroExpander for DisallowCfgProcMacroExpander {
933
965
}
934
966
Ok ( subtree. clone ( ) )
935
967
}
968
+
969
+ fn eq_dyn ( & self , other : & dyn ProcMacroExpander ) -> bool {
970
+ other. type_id ( ) == TypeId :: of :: < Self > ( )
971
+ }
936
972
}
937
973
938
974
// Generates a new type by adding a suffix to the original name
@@ -987,4 +1023,8 @@ impl ProcMacroExpander for GenerateSuffixedTypeProcMacroExpander {
987
1023
988
1024
Ok ( ret)
989
1025
}
1026
+
1027
+ fn eq_dyn ( & self , other : & dyn ProcMacroExpander ) -> bool {
1028
+ other. type_id ( ) == TypeId :: of :: < Self > ( )
1029
+ }
990
1030
}
0 commit comments