@@ -33,144 +33,3 @@ macro_rules! TrivialTypeTraversalImpls {
33
33
) +
34
34
} ;
35
35
}
36
-
37
- macro_rules! EnumTypeTraversalImpl {
38
- ( impl <$( $p: tt) ,* > TypeFoldable <$tcx: tt> for $s: path {
39
- $( $variants: tt) *
40
- } $( where $( $wc: tt) * ) * ) => {
41
- impl <$( $p) ,* > $crate:: fold:: TypeFoldable <$tcx> for $s
42
- $( where $( $wc) * ) *
43
- {
44
- fn try_fold_with<V : $crate:: fold:: FallibleTypeFolder <$tcx>>(
45
- self ,
46
- folder: & mut V ,
47
- ) -> :: std:: result:: Result <Self , V :: Error > {
48
- EnumTypeTraversalImpl !( @FoldVariants ( self , folder) input( $( $variants) * ) output( ) )
49
- }
50
- }
51
- } ;
52
-
53
- ( impl <$( $p: tt) ,* > TypeVisitable <$tcx: tt> for $s: path {
54
- $( $variants: tt) *
55
- } $( where $( $wc: tt) * ) * ) => {
56
- impl <$( $p) ,* > $crate:: visit:: TypeVisitable <$tcx> for $s
57
- $( where $( $wc) * ) *
58
- {
59
- fn visit_with<V : $crate:: visit:: TypeVisitor <$tcx>>(
60
- & self ,
61
- visitor: & mut V ,
62
- ) -> :: std:: ops:: ControlFlow <V :: BreakTy > {
63
- EnumTypeTraversalImpl !( @VisitVariants ( self , visitor) input( $( $variants) * ) output( ) )
64
- }
65
- }
66
- } ;
67
-
68
- ( @FoldVariants ( $this: expr, $folder: expr) input( ) output( $( $output: tt) * ) ) => {
69
- Ok ( match $this {
70
- $( $output) *
71
- } )
72
- } ;
73
-
74
- ( @FoldVariants ( $this: expr, $folder: expr)
75
- input( ( $variant: path) ( $( $variant_arg: ident) ,* ) , $( $input: tt) * )
76
- output( $( $output: tt) * ) ) => {
77
- EnumTypeTraversalImpl !(
78
- @FoldVariants ( $this, $folder)
79
- input( $( $input) * )
80
- output(
81
- $variant ( $( $variant_arg) ,* ) => {
82
- $variant (
83
- $( $crate:: fold:: TypeFoldable :: try_fold_with( $variant_arg, $folder) ?) ,*
84
- )
85
- }
86
- $( $output) *
87
- )
88
- )
89
- } ;
90
-
91
- ( @FoldVariants ( $this: expr, $folder: expr)
92
- input( ( $variant: path) { $( $variant_arg: ident) ,* $( , ) ? } , $( $input: tt) * )
93
- output( $( $output: tt) * ) ) => {
94
- EnumTypeTraversalImpl !(
95
- @FoldVariants ( $this, $folder)
96
- input( $( $input) * )
97
- output(
98
- $variant { $( $variant_arg) ,* } => {
99
- $variant {
100
- $( $variant_arg: $crate:: fold:: TypeFoldable :: fold_with(
101
- $variant_arg, $folder
102
- ) ?) ,* }
103
- }
104
- $( $output) *
105
- )
106
- )
107
- } ;
108
-
109
- ( @FoldVariants ( $this: expr, $folder: expr)
110
- input( ( $variant: path) , $( $input: tt) * )
111
- output( $( $output: tt) * ) ) => {
112
- EnumTypeTraversalImpl !(
113
- @FoldVariants ( $this, $folder)
114
- input( $( $input) * )
115
- output(
116
- $variant => { $variant }
117
- $( $output) *
118
- )
119
- )
120
- } ;
121
-
122
- ( @VisitVariants ( $this: expr, $visitor: expr) input( ) output( $( $output: tt) * ) ) => {
123
- match $this {
124
- $( $output) *
125
- }
126
- } ;
127
-
128
- ( @VisitVariants ( $this: expr, $visitor: expr)
129
- input( ( $variant: path) ( $( $variant_arg: ident) ,* ) , $( $input: tt) * )
130
- output( $( $output: tt) * ) ) => {
131
- EnumTypeTraversalImpl !(
132
- @VisitVariants ( $this, $visitor)
133
- input( $( $input) * )
134
- output(
135
- $variant ( $( $variant_arg) ,* ) => {
136
- $( $crate:: visit:: TypeVisitable :: visit_with(
137
- $variant_arg, $visitor
138
- ) ?; ) *
139
- :: std:: ops:: ControlFlow :: Continue ( ( ) )
140
- }
141
- $( $output) *
142
- )
143
- )
144
- } ;
145
-
146
- ( @VisitVariants ( $this: expr, $visitor: expr)
147
- input( ( $variant: path) { $( $variant_arg: ident) ,* $( , ) ? } , $( $input: tt) * )
148
- output( $( $output: tt) * ) ) => {
149
- EnumTypeTraversalImpl !(
150
- @VisitVariants ( $this, $visitor)
151
- input( $( $input) * )
152
- output(
153
- $variant { $( $variant_arg) ,* } => {
154
- $( $crate:: visit:: TypeVisitable :: visit_with(
155
- $variant_arg, $visitor
156
- ) ?; ) *
157
- :: std:: ops:: ControlFlow :: Continue ( ( ) )
158
- }
159
- $( $output) *
160
- )
161
- )
162
- } ;
163
-
164
- ( @VisitVariants ( $this: expr, $visitor: expr)
165
- input( ( $variant: path) , $( $input: tt) * )
166
- output( $( $output: tt) * ) ) => {
167
- EnumTypeTraversalImpl !(
168
- @VisitVariants ( $this, $visitor)
169
- input( $( $input) * )
170
- output(
171
- $variant => { :: std:: ops:: ControlFlow :: Continue ( ( ) ) }
172
- $( $output) *
173
- )
174
- )
175
- } ;
176
- }
0 commit comments