@@ -89,65 +89,12 @@ impl<'tcx> TypeFoldable<'tcx> for Terminator<'tcx> {
89
89
} ;
90
90
Ok ( Terminator { source_info : self . source_info , kind } )
91
91
}
92
-
93
- fn visit_with < V : TypeVisitor < ' tcx > > ( & self , visitor : & mut V ) -> ControlFlow < V :: BreakTy > {
94
- use crate :: mir:: TerminatorKind :: * ;
95
-
96
- match self . kind {
97
- SwitchInt { ref discr, switch_ty, .. } => {
98
- discr. visit_with ( visitor) ?;
99
- switch_ty. visit_with ( visitor)
100
- }
101
- Drop { ref place, .. } => place. visit_with ( visitor) ,
102
- DropAndReplace { ref place, ref value, .. } => {
103
- place. visit_with ( visitor) ?;
104
- value. visit_with ( visitor)
105
- }
106
- Yield { ref value, .. } => value. visit_with ( visitor) ,
107
- Call { ref func, ref args, ref destination, .. } => {
108
- destination. visit_with ( visitor) ?;
109
- func. visit_with ( visitor) ?;
110
- args. visit_with ( visitor)
111
- }
112
- Assert { ref cond, ref msg, .. } => {
113
- cond. visit_with ( visitor) ?;
114
- use AssertKind :: * ;
115
- match msg {
116
- BoundsCheck { ref len, ref index } => {
117
- len. visit_with ( visitor) ?;
118
- index. visit_with ( visitor)
119
- }
120
- Overflow ( _, l, r) => {
121
- l. visit_with ( visitor) ?;
122
- r. visit_with ( visitor)
123
- }
124
- OverflowNeg ( op) | DivisionByZero ( op) | RemainderByZero ( op) => {
125
- op. visit_with ( visitor)
126
- }
127
- ResumedAfterReturn ( _) | ResumedAfterPanic ( _) => ControlFlow :: CONTINUE ,
128
- }
129
- }
130
- InlineAsm { ref operands, .. } => operands. visit_with ( visitor) ,
131
- Goto { .. }
132
- | Resume
133
- | Abort
134
- | Return
135
- | GeneratorDrop
136
- | Unreachable
137
- | FalseEdge { .. }
138
- | FalseUnwind { .. } => ControlFlow :: CONTINUE ,
139
- }
140
- }
141
92
}
142
93
143
94
impl < ' tcx > TypeFoldable < ' tcx > for GeneratorKind {
144
95
fn try_fold_with < F : FallibleTypeFolder < ' tcx > > ( self , _: & mut F ) -> Result < Self , F :: Error > {
145
96
Ok ( self )
146
97
}
147
-
148
- fn visit_with < V : TypeVisitor < ' tcx > > ( & self , _: & mut V ) -> ControlFlow < V :: BreakTy > {
149
- ControlFlow :: CONTINUE
150
- }
151
98
}
152
99
153
100
impl < ' tcx > TypeFoldable < ' tcx > for Place < ' tcx > {
@@ -157,21 +104,12 @@ impl<'tcx> TypeFoldable<'tcx> for Place<'tcx> {
157
104
projection : self . projection . try_fold_with ( folder) ?,
158
105
} )
159
106
}
160
-
161
- fn visit_with < V : TypeVisitor < ' tcx > > ( & self , visitor : & mut V ) -> ControlFlow < V :: BreakTy > {
162
- self . local . visit_with ( visitor) ?;
163
- self . projection . visit_with ( visitor)
164
- }
165
107
}
166
108
167
109
impl < ' tcx > TypeFoldable < ' tcx > for & ' tcx ty:: List < PlaceElem < ' tcx > > {
168
110
fn try_fold_with < F : FallibleTypeFolder < ' tcx > > ( self , folder : & mut F ) -> Result < Self , F :: Error > {
169
111
ty:: util:: fold_list ( self , folder, |tcx, v| tcx. intern_place_elems ( v) )
170
112
}
171
-
172
- fn visit_with < V : TypeVisitor < ' tcx > > ( & self , visitor : & mut V ) -> ControlFlow < V :: BreakTy > {
173
- self . iter ( ) . try_for_each ( |t| t. visit_with ( visitor) )
174
- }
175
113
}
176
114
177
115
impl < ' tcx > TypeFoldable < ' tcx > for Rvalue < ' tcx > {
@@ -224,55 +162,6 @@ impl<'tcx> TypeFoldable<'tcx> for Rvalue<'tcx> {
224
162
}
225
163
} )
226
164
}
227
-
228
- fn visit_with < V : TypeVisitor < ' tcx > > ( & self , visitor : & mut V ) -> ControlFlow < V :: BreakTy > {
229
- use crate :: mir:: Rvalue :: * ;
230
- match * self {
231
- Use ( ref op) => op. visit_with ( visitor) ,
232
- Repeat ( ref op, _) => op. visit_with ( visitor) ,
233
- ThreadLocalRef ( did) => did. visit_with ( visitor) ,
234
- Ref ( region, _, ref place) => {
235
- region. visit_with ( visitor) ?;
236
- place. visit_with ( visitor)
237
- }
238
- AddressOf ( _, ref place) => place. visit_with ( visitor) ,
239
- Len ( ref place) => place. visit_with ( visitor) ,
240
- Cast ( _, ref op, ty) => {
241
- op. visit_with ( visitor) ?;
242
- ty. visit_with ( visitor)
243
- }
244
- BinaryOp ( _, box ( ref rhs, ref lhs) ) | CheckedBinaryOp ( _, box ( ref rhs, ref lhs) ) => {
245
- rhs. visit_with ( visitor) ?;
246
- lhs. visit_with ( visitor)
247
- }
248
- UnaryOp ( _, ref val) => val. visit_with ( visitor) ,
249
- Discriminant ( ref place) => place. visit_with ( visitor) ,
250
- NullaryOp ( _, ty) => ty. visit_with ( visitor) ,
251
- Aggregate ( ref kind, ref fields) => {
252
- match * * kind {
253
- AggregateKind :: Array ( ty) => {
254
- ty. visit_with ( visitor) ?;
255
- }
256
- AggregateKind :: Tuple => { }
257
- AggregateKind :: Adt ( _, _, substs, user_ty, _) => {
258
- substs. visit_with ( visitor) ?;
259
- user_ty. visit_with ( visitor) ?;
260
- }
261
- AggregateKind :: Closure ( _, substs) => {
262
- substs. visit_with ( visitor) ?;
263
- }
264
- AggregateKind :: Generator ( _, substs, _) => {
265
- substs. visit_with ( visitor) ?;
266
- }
267
- }
268
- fields. visit_with ( visitor)
269
- }
270
- ShallowInitBox ( ref op, ty) => {
271
- op. visit_with ( visitor) ?;
272
- ty. visit_with ( visitor)
273
- }
274
- }
275
- }
276
165
}
277
166
278
167
impl < ' tcx > TypeFoldable < ' tcx > for Operand < ' tcx > {
@@ -283,13 +172,6 @@ impl<'tcx> TypeFoldable<'tcx> for Operand<'tcx> {
283
172
Operand :: Constant ( c) => Operand :: Constant ( c. try_fold_with ( folder) ?) ,
284
173
} )
285
174
}
286
-
287
- fn visit_with < V : TypeVisitor < ' tcx > > ( & self , visitor : & mut V ) -> ControlFlow < V :: BreakTy > {
288
- match * self {
289
- Operand :: Copy ( ref place) | Operand :: Move ( ref place) => place. visit_with ( visitor) ,
290
- Operand :: Constant ( ref c) => c. visit_with ( visitor) ,
291
- }
292
- }
293
175
}
294
176
295
177
impl < ' tcx > TypeFoldable < ' tcx > for PlaceElem < ' tcx > {
@@ -307,43 +189,24 @@ impl<'tcx> TypeFoldable<'tcx> for PlaceElem<'tcx> {
307
189
Subslice { from, to, from_end } => Subslice { from, to, from_end } ,
308
190
} )
309
191
}
310
-
311
- fn visit_with < Vs : TypeVisitor < ' tcx > > ( & self , visitor : & mut Vs ) -> ControlFlow < Vs :: BreakTy > {
312
- use crate :: mir:: ProjectionElem :: * ;
313
-
314
- match self {
315
- Field ( _, ty) => ty. visit_with ( visitor) ,
316
- Index ( v) => v. visit_with ( visitor) ,
317
- _ => ControlFlow :: CONTINUE ,
318
- }
319
- }
320
192
}
321
193
322
194
impl < ' tcx > TypeFoldable < ' tcx > for Field {
323
195
fn try_fold_with < F : FallibleTypeFolder < ' tcx > > ( self , _: & mut F ) -> Result < Self , F :: Error > {
324
196
Ok ( self )
325
197
}
326
- fn visit_with < V : TypeVisitor < ' tcx > > ( & self , _: & mut V ) -> ControlFlow < V :: BreakTy > {
327
- ControlFlow :: CONTINUE
328
- }
329
198
}
330
199
331
200
impl < ' tcx > TypeFoldable < ' tcx > for GeneratorSavedLocal {
332
201
fn try_fold_with < F : FallibleTypeFolder < ' tcx > > ( self , _: & mut F ) -> Result < Self , F :: Error > {
333
202
Ok ( self )
334
203
}
335
- fn visit_with < V : TypeVisitor < ' tcx > > ( & self , _: & mut V ) -> ControlFlow < V :: BreakTy > {
336
- ControlFlow :: CONTINUE
337
- }
338
204
}
339
205
340
206
impl < ' tcx , R : Idx , C : Idx > TypeFoldable < ' tcx > for BitMatrix < R , C > {
341
207
fn try_fold_with < F : FallibleTypeFolder < ' tcx > > ( self , _: & mut F ) -> Result < Self , F :: Error > {
342
208
Ok ( self )
343
209
}
344
- fn visit_with < V : TypeVisitor < ' tcx > > ( & self , _: & mut V ) -> ControlFlow < V :: BreakTy > {
345
- ControlFlow :: CONTINUE
346
- }
347
210
}
348
211
349
212
impl < ' tcx > TypeFoldable < ' tcx > for Constant < ' tcx > {
@@ -354,21 +217,13 @@ impl<'tcx> TypeFoldable<'tcx> for Constant<'tcx> {
354
217
literal : self . literal . try_fold_with ( folder) ?,
355
218
} )
356
219
}
357
- fn visit_with < V : TypeVisitor < ' tcx > > ( & self , visitor : & mut V ) -> ControlFlow < V :: BreakTy > {
358
- self . literal . visit_with ( visitor) ?;
359
- self . user_ty . visit_with ( visitor)
360
- }
361
220
}
362
221
363
222
impl < ' tcx > TypeFoldable < ' tcx > for ConstantKind < ' tcx > {
364
223
#[ inline( always) ]
365
224
fn try_fold_with < F : FallibleTypeFolder < ' tcx > > ( self , folder : & mut F ) -> Result < Self , F :: Error > {
366
225
folder. try_fold_mir_const ( self )
367
226
}
368
-
369
- fn visit_with < V : TypeVisitor < ' tcx > > ( & self , visitor : & mut V ) -> ControlFlow < V :: BreakTy > {
370
- visitor. visit_mir_const ( * self )
371
- }
372
227
}
373
228
374
229
impl < ' tcx > TypeSuperFoldable < ' tcx > for ConstantKind < ' tcx > {
@@ -381,11 +236,4 @@ impl<'tcx> TypeSuperFoldable<'tcx> for ConstantKind<'tcx> {
381
236
ConstantKind :: Val ( v, t) => Ok ( ConstantKind :: Val ( v, t. try_fold_with ( folder) ?) ) ,
382
237
}
383
238
}
384
-
385
- fn super_visit_with < V : TypeVisitor < ' tcx > > ( & self , visitor : & mut V ) -> ControlFlow < V :: BreakTy > {
386
- match * self {
387
- ConstantKind :: Ty ( c) => c. visit_with ( visitor) ,
388
- ConstantKind :: Val ( _, t) => t. visit_with ( visitor) ,
389
- }
390
- }
391
239
}
0 commit comments