@@ -86,7 +86,7 @@ pub trait TypeFoldable<'tcx>: fmt::Debug + Clone {
86
86
/// A convenient alternative to `try_fold_with` for use with infallible
87
87
/// folders. Do not override this method, to ensure coherence with
88
88
/// `try_fold_with`.
89
- fn fold_with < F : TypeFolder < ' tcx , Error = ! > > ( self , folder : & mut F ) -> Self {
89
+ fn fold_with < F : TypeFolder < ' tcx > > ( self , folder : & mut F ) -> Self {
90
90
self . try_fold_with ( folder) . into_ok ( )
91
91
}
92
92
@@ -216,7 +216,7 @@ pub trait TypeSuperFoldable<'tcx>: TypeFoldable<'tcx> {
216
216
/// A convenient alternative to `try_super_fold_with` for use with
217
217
/// infallible folders. Do not override this method, to ensure coherence
218
218
/// with `try_super_fold_with`.
219
- fn super_fold_with < F : TypeFolder < ' tcx , Error = ! > > ( self , folder : & mut F ) -> Self {
219
+ fn super_fold_with < F : TypeFolder < ' tcx > > ( self , folder : & mut F ) -> Self {
220
220
self . try_super_fold_with ( folder) . into_ok ( )
221
221
}
222
222
@@ -229,16 +229,13 @@ pub trait TypeSuperFoldable<'tcx>: TypeFoldable<'tcx> {
229
229
fn super_visit_with < V : TypeVisitor < ' tcx > > ( & self , visitor : & mut V ) -> ControlFlow < V :: BreakTy > ;
230
230
}
231
231
232
- /// This trait is implemented for every folding traversal. There is a fold
233
- /// method defined for every type of interest. Each such method has a default
234
- /// that does an "identity" fold. Implementations of these methods often fall
235
- /// back to a `super_fold_with` method if the primary argument doesn't
236
- /// satisfy a particular condition.
232
+ /// This trait is implemented for every infallible folding traversal. There is
233
+ /// a fold method defined for every type of interest. Each such method has a
234
+ /// default that does an "identity" fold. Implementations of these methods
235
+ /// often fall back to a `super_fold_with` method if the primary argument
236
+ /// doesn't satisfy a particular condition.
237
237
///
238
- /// If this folder is fallible (and therefore its [`Error`][`TypeFolder::Error`]
239
- /// associated type is something other than the default `!`) then
240
- /// [`FallibleTypeFolder`] should be implemented manually. Otherwise,
241
- /// a blanket implementation of [`FallibleTypeFolder`] will defer to
238
+ /// A blanket implementation of [`FallibleTypeFolder`] will defer to
242
239
/// the infallible methods of this trait to ensure that the two APIs
243
240
/// are coherent.
244
241
pub trait TypeFolder < ' tcx > : FallibleTypeFolder < ' tcx , Error = !> {
@@ -341,43 +338,40 @@ where
341
338
TypeFolder :: tcx ( self )
342
339
}
343
340
344
- fn try_fold_binder < T > ( & mut self , t : Binder < ' tcx , T > ) -> Result < Binder < ' tcx , T > , Self :: Error >
341
+ fn try_fold_binder < T > ( & mut self , t : Binder < ' tcx , T > ) -> Result < Binder < ' tcx , T > , ! >
345
342
where
346
343
T : TypeFoldable < ' tcx > ,
347
344
{
348
345
Ok ( self . fold_binder ( t) )
349
346
}
350
347
351
- fn try_fold_ty ( & mut self , t : Ty < ' tcx > ) -> Result < Ty < ' tcx > , Self :: Error > {
348
+ fn try_fold_ty ( & mut self , t : Ty < ' tcx > ) -> Result < Ty < ' tcx > , ! > {
352
349
Ok ( self . fold_ty ( t) )
353
350
}
354
351
355
- fn try_fold_region ( & mut self , r : ty:: Region < ' tcx > ) -> Result < ty:: Region < ' tcx > , Self :: Error > {
352
+ fn try_fold_region ( & mut self , r : ty:: Region < ' tcx > ) -> Result < ty:: Region < ' tcx > , ! > {
356
353
Ok ( self . fold_region ( r) )
357
354
}
358
355
359
- fn try_fold_const ( & mut self , c : ty:: Const < ' tcx > ) -> Result < ty:: Const < ' tcx > , Self :: Error > {
356
+ fn try_fold_const ( & mut self , c : ty:: Const < ' tcx > ) -> Result < ty:: Const < ' tcx > , ! > {
360
357
Ok ( self . fold_const ( c) )
361
358
}
362
359
363
360
fn try_fold_unevaluated (
364
361
& mut self ,
365
362
c : ty:: Unevaluated < ' tcx > ,
366
- ) -> Result < ty:: Unevaluated < ' tcx > , Self :: Error > {
363
+ ) -> Result < ty:: Unevaluated < ' tcx > , ! > {
367
364
Ok ( self . fold_unevaluated ( c) )
368
365
}
369
366
370
- fn try_fold_predicate (
371
- & mut self ,
372
- p : ty:: Predicate < ' tcx > ,
373
- ) -> Result < ty:: Predicate < ' tcx > , Self :: Error > {
367
+ fn try_fold_predicate ( & mut self , p : ty:: Predicate < ' tcx > ) -> Result < ty:: Predicate < ' tcx > , !> {
374
368
Ok ( self . fold_predicate ( p) )
375
369
}
376
370
377
371
fn try_fold_mir_const (
378
372
& mut self ,
379
373
c : mir:: ConstantKind < ' tcx > ,
380
- ) -> Result < mir:: ConstantKind < ' tcx > , Self :: Error > {
374
+ ) -> Result < mir:: ConstantKind < ' tcx > , ! > {
381
375
Ok ( self . fold_mir_const ( c) )
382
376
}
383
377
}
0 commit comments