@@ -89,65 +89,12 @@ impl<'tcx> TypeFoldable<'tcx> for Terminator<'tcx> {
8989 } ;
9090 Ok ( Terminator { source_info : self . source_info , kind } )
9191 }
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- }
14192}
14293
14394impl < ' tcx > TypeFoldable < ' tcx > for GeneratorKind {
14495 fn try_fold_with < F : FallibleTypeFolder < ' tcx > > ( self , _: & mut F ) -> Result < Self , F :: Error > {
14596 Ok ( self )
14697 }
147-
148- fn visit_with < V : TypeVisitor < ' tcx > > ( & self , _: & mut V ) -> ControlFlow < V :: BreakTy > {
149- ControlFlow :: CONTINUE
150- }
15198}
15299
153100impl < ' tcx > TypeFoldable < ' tcx > for Place < ' tcx > {
@@ -157,21 +104,12 @@ impl<'tcx> TypeFoldable<'tcx> for Place<'tcx> {
157104 projection : self . projection . try_fold_with ( folder) ?,
158105 } )
159106 }
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- }
165107}
166108
167109impl < ' tcx > TypeFoldable < ' tcx > for & ' tcx ty:: List < PlaceElem < ' tcx > > {
168110 fn try_fold_with < F : FallibleTypeFolder < ' tcx > > ( self , folder : & mut F ) -> Result < Self , F :: Error > {
169111 ty:: util:: fold_list ( self , folder, |tcx, v| tcx. intern_place_elems ( v) )
170112 }
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- }
175113}
176114
177115impl < ' tcx > TypeFoldable < ' tcx > for Rvalue < ' tcx > {
@@ -224,55 +162,6 @@ impl<'tcx> TypeFoldable<'tcx> for Rvalue<'tcx> {
224162 }
225163 } )
226164 }
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- }
276165}
277166
278167impl < ' tcx > TypeFoldable < ' tcx > for Operand < ' tcx > {
@@ -283,13 +172,6 @@ impl<'tcx> TypeFoldable<'tcx> for Operand<'tcx> {
283172 Operand :: Constant ( c) => Operand :: Constant ( c. try_fold_with ( folder) ?) ,
284173 } )
285174 }
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- }
293175}
294176
295177impl < ' tcx > TypeFoldable < ' tcx > for PlaceElem < ' tcx > {
@@ -307,43 +189,24 @@ impl<'tcx> TypeFoldable<'tcx> for PlaceElem<'tcx> {
307189 Subslice { from, to, from_end } => Subslice { from, to, from_end } ,
308190 } )
309191 }
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- }
320192}
321193
322194impl < ' tcx > TypeFoldable < ' tcx > for Field {
323195 fn try_fold_with < F : FallibleTypeFolder < ' tcx > > ( self , _: & mut F ) -> Result < Self , F :: Error > {
324196 Ok ( self )
325197 }
326- fn visit_with < V : TypeVisitor < ' tcx > > ( & self , _: & mut V ) -> ControlFlow < V :: BreakTy > {
327- ControlFlow :: CONTINUE
328- }
329198}
330199
331200impl < ' tcx > TypeFoldable < ' tcx > for GeneratorSavedLocal {
332201 fn try_fold_with < F : FallibleTypeFolder < ' tcx > > ( self , _: & mut F ) -> Result < Self , F :: Error > {
333202 Ok ( self )
334203 }
335- fn visit_with < V : TypeVisitor < ' tcx > > ( & self , _: & mut V ) -> ControlFlow < V :: BreakTy > {
336- ControlFlow :: CONTINUE
337- }
338204}
339205
340206impl < ' tcx , R : Idx , C : Idx > TypeFoldable < ' tcx > for BitMatrix < R , C > {
341207 fn try_fold_with < F : FallibleTypeFolder < ' tcx > > ( self , _: & mut F ) -> Result < Self , F :: Error > {
342208 Ok ( self )
343209 }
344- fn visit_with < V : TypeVisitor < ' tcx > > ( & self , _: & mut V ) -> ControlFlow < V :: BreakTy > {
345- ControlFlow :: CONTINUE
346- }
347210}
348211
349212impl < ' tcx > TypeFoldable < ' tcx > for Constant < ' tcx > {
@@ -354,21 +217,13 @@ impl<'tcx> TypeFoldable<'tcx> for Constant<'tcx> {
354217 literal : self . literal . try_fold_with ( folder) ?,
355218 } )
356219 }
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- }
361220}
362221
363222impl < ' tcx > TypeFoldable < ' tcx > for ConstantKind < ' tcx > {
364223 #[ inline( always) ]
365224 fn try_fold_with < F : FallibleTypeFolder < ' tcx > > ( self , folder : & mut F ) -> Result < Self , F :: Error > {
366225 folder. try_fold_mir_const ( self )
367226 }
368-
369- fn visit_with < V : TypeVisitor < ' tcx > > ( & self , visitor : & mut V ) -> ControlFlow < V :: BreakTy > {
370- visitor. visit_mir_const ( * self )
371- }
372227}
373228
374229impl < ' tcx > TypeSuperFoldable < ' tcx > for ConstantKind < ' tcx > {
@@ -381,11 +236,4 @@ impl<'tcx> TypeSuperFoldable<'tcx> for ConstantKind<'tcx> {
381236 ConstantKind :: Val ( v, t) => Ok ( ConstantKind :: Val ( v, t. try_fold_with ( folder) ?) ) ,
382237 }
383238 }
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- }
391239}
0 commit comments