@@ -199,15 +199,19 @@ impl<'tcx> fmt::Debug for AliasTy<'tcx> {
199
199
// For things that don't carry any arena-allocated data (and are
200
200
// copy...), just add them to this list.
201
201
202
- TrivialTypeTraversalAndLiftImpls ! {
202
+ TrivialTypeFoldableAndLiftImpls ! {
203
203
( ) ,
204
204
bool ,
205
205
usize ,
206
- :: rustc_target:: abi:: VariantIdx ,
207
206
u16 ,
208
207
u32 ,
209
208
u64 ,
210
209
String ,
210
+ rustc_type_ir:: DebruijnIndex ,
211
+ }
212
+
213
+ TrivialTypeTraversalAndLiftImpls ! {
214
+ :: rustc_target:: abi:: VariantIdx ,
211
215
crate :: middle:: region:: Scope ,
212
216
crate :: ty:: FloatTy ,
213
217
:: rustc_ast:: InlineAsmOptions ,
@@ -259,7 +263,6 @@ TrivialTypeTraversalAndLiftImpls! {
259
263
Field ,
260
264
interpret:: Scalar ,
261
265
rustc_target:: abi:: Size ,
262
- rustc_type_ir:: DebruijnIndex ,
263
266
ty:: BoundVar ,
264
267
ty:: Placeholder <ty:: BoundVar >,
265
268
}
@@ -389,13 +392,6 @@ impl<I: Interner, T: TypeFoldable<I>, U: TypeFoldable<I>> TypeFoldable<I> for (T
389
392
}
390
393
}
391
394
392
- impl < I : Interner , T : TypeVisitable < I > , U : TypeVisitable < I > > TypeVisitable < I > for ( T , U ) {
393
- fn visit_with < V : TypeVisitor < I > > ( & self , visitor : & mut V ) -> ControlFlow < V :: BreakTy > {
394
- self . 0 . visit_with ( visitor) ?;
395
- self . 1 . visit_with ( visitor)
396
- }
397
- }
398
-
399
395
impl < I : Interner , A : TypeFoldable < I > , B : TypeFoldable < I > , C : TypeFoldable < I > > TypeFoldable < I >
400
396
for ( A , B , C )
401
397
{
@@ -411,41 +407,19 @@ impl<I: Interner, A: TypeFoldable<I>, B: TypeFoldable<I>, C: TypeFoldable<I>> Ty
411
407
}
412
408
}
413
409
414
- impl < I : Interner , A : TypeVisitable < I > , B : TypeVisitable < I > , C : TypeVisitable < I > > TypeVisitable < I >
415
- for ( A , B , C )
416
- {
417
- fn visit_with < V : TypeVisitor < I > > ( & self , visitor : & mut V ) -> ControlFlow < V :: BreakTy > {
418
- self . 0 . visit_with ( visitor) ?;
419
- self . 1 . visit_with ( visitor) ?;
420
- self . 2 . visit_with ( visitor)
421
- }
422
- }
423
-
424
410
EnumTypeTraversalImpl ! {
425
411
impl <I , T > TypeFoldable <I > for Option <T > {
426
412
( Some ) ( a) ,
427
413
( None ) ,
428
414
} where I : Interner , T : TypeFoldable <I >
429
415
}
430
- EnumTypeTraversalImpl ! {
431
- impl <I , T > TypeVisitable <I > for Option <T > {
432
- ( Some ) ( a) ,
433
- ( None ) ,
434
- } where I : Interner , T : TypeVisitable <I >
435
- }
436
416
437
417
EnumTypeTraversalImpl ! {
438
418
impl <I , T , E > TypeFoldable <I > for Result <T , E > {
439
419
( Ok ) ( a) ,
440
420
( Err ) ( a) ,
441
421
} where I : Interner , T : TypeFoldable <I >, E : TypeFoldable <I >,
442
422
}
443
- EnumTypeTraversalImpl ! {
444
- impl <I , T , E > TypeVisitable <I > for Result <T , E > {
445
- ( Ok ) ( a) ,
446
- ( Err ) ( a) ,
447
- } where I : Interner , T : TypeVisitable <I >, E : TypeVisitable <I >,
448
- }
449
423
450
424
impl < I : Interner , T : TypeFoldable < I > > TypeFoldable < I > for Rc < T > {
451
425
fn try_fold_with < F : FallibleTypeFolder < I > > ( mut self , folder : & mut F ) -> Result < Self , F :: Error > {
@@ -484,12 +458,6 @@ impl<I: Interner, T: TypeFoldable<I>> TypeFoldable<I> for Rc<T> {
484
458
}
485
459
}
486
460
487
- impl < I : Interner , T : TypeVisitable < I > > TypeVisitable < I > for Rc < T > {
488
- fn visit_with < V : TypeVisitor < I > > ( & self , visitor : & mut V ) -> ControlFlow < V :: BreakTy > {
489
- ( * * self ) . visit_with ( visitor)
490
- }
491
- }
492
-
493
461
impl < I : Interner , T : TypeFoldable < I > > TypeFoldable < I > for Arc < T > {
494
462
fn try_fold_with < F : FallibleTypeFolder < I > > ( mut self , folder : & mut F ) -> Result < Self , F :: Error > {
495
463
// We merely want to replace the contained `T`, if at all possible,
@@ -527,54 +495,24 @@ impl<I: Interner, T: TypeFoldable<I>> TypeFoldable<I> for Arc<T> {
527
495
}
528
496
}
529
497
530
- impl < I : Interner , T : TypeVisitable < I > > TypeVisitable < I > for Arc < T > {
531
- fn visit_with < V : TypeVisitor < I > > ( & self , visitor : & mut V ) -> ControlFlow < V :: BreakTy > {
532
- ( * * self ) . visit_with ( visitor)
533
- }
534
- }
535
-
536
498
impl < I : Interner , T : TypeFoldable < I > > TypeFoldable < I > for Box < T > {
537
499
fn try_fold_with < F : FallibleTypeFolder < I > > ( self , folder : & mut F ) -> Result < Self , F :: Error > {
538
500
self . try_map_id ( |value| value. try_fold_with ( folder) )
539
501
}
540
502
}
541
503
542
- impl < I : Interner , T : TypeVisitable < I > > TypeVisitable < I > for Box < T > {
543
- fn visit_with < V : TypeVisitor < I > > ( & self , visitor : & mut V ) -> ControlFlow < V :: BreakTy > {
544
- ( * * self ) . visit_with ( visitor)
545
- }
546
- }
547
-
548
504
impl < I : Interner , T : TypeFoldable < I > > TypeFoldable < I > for Vec < T > {
549
505
fn try_fold_with < F : FallibleTypeFolder < I > > ( self , folder : & mut F ) -> Result < Self , F :: Error > {
550
506
self . try_map_id ( |t| t. try_fold_with ( folder) )
551
507
}
552
508
}
553
509
554
- impl < I : Interner , T : TypeVisitable < I > > TypeVisitable < I > for Vec < T > {
555
- fn visit_with < V : TypeVisitor < I > > ( & self , visitor : & mut V ) -> ControlFlow < V :: BreakTy > {
556
- self . iter ( ) . try_for_each ( |t| t. visit_with ( visitor) )
557
- }
558
- }
559
-
560
- impl < I : Interner , T : TypeVisitable < I > > TypeVisitable < I > for & [ T ] {
561
- fn visit_with < V : TypeVisitor < I > > ( & self , visitor : & mut V ) -> ControlFlow < V :: BreakTy > {
562
- self . iter ( ) . try_for_each ( |t| t. visit_with ( visitor) )
563
- }
564
- }
565
-
566
510
impl < I : Interner , T : TypeFoldable < I > > TypeFoldable < I > for Box < [ T ] > {
567
511
fn try_fold_with < F : FallibleTypeFolder < I > > ( self , folder : & mut F ) -> Result < Self , F :: Error > {
568
512
self . try_map_id ( |t| t. try_fold_with ( folder) )
569
513
}
570
514
}
571
515
572
- impl < I : Interner , T : TypeVisitable < I > > TypeVisitable < I > for Box < [ T ] > {
573
- fn visit_with < V : TypeVisitor < I > > ( & self , visitor : & mut V ) -> ControlFlow < V :: BreakTy > {
574
- self . iter ( ) . try_for_each ( |t| t. visit_with ( visitor) )
575
- }
576
- }
577
-
578
516
impl < ' tcx , T : TypeFoldable < TyCtxt < ' tcx > > > TypeFoldable < TyCtxt < ' tcx > > for ty:: Binder < ' tcx , T > {
579
517
fn try_fold_with < F : FallibleTypeFolder < TyCtxt < ' tcx > > > (
580
518
self ,
@@ -841,12 +779,6 @@ impl<I: Interner, T: TypeFoldable<I>, Ix: Idx> TypeFoldable<I> for IndexVec<Ix,
841
779
}
842
780
}
843
781
844
- impl < I : Interner , T : TypeVisitable < I > , Ix : Idx > TypeVisitable < I > for IndexVec < Ix , T > {
845
- fn visit_with < V : TypeVisitor < I > > ( & self , visitor : & mut V ) -> ControlFlow < V :: BreakTy > {
846
- self . iter ( ) . try_for_each ( |t| t. visit_with ( visitor) )
847
- }
848
- }
849
-
850
782
impl < ' tcx > TypeFoldable < TyCtxt < ' tcx > > for ty:: Const < ' tcx > {
851
783
fn try_fold_with < F : FallibleTypeFolder < TyCtxt < ' tcx > > > (
852
784
self ,
0 commit comments