@@ -199,15 +199,19 @@ impl<'tcx> fmt::Debug for AliasTy<'tcx> {
199199// For things that don't carry any arena-allocated data (and are
200200// copy...), just add them to this list.
201201
202- TrivialTypeTraversalAndLiftImpls ! {
202+ TrivialTypeFoldableAndLiftImpls ! {
203203 ( ) ,
204204 bool ,
205205 usize ,
206- :: rustc_target:: abi:: VariantIdx ,
207206 u16 ,
208207 u32 ,
209208 u64 ,
210209 String ,
210+ rustc_type_ir:: DebruijnIndex ,
211+ }
212+
213+ TrivialTypeTraversalAndLiftImpls ! {
214+ :: rustc_target:: abi:: VariantIdx ,
211215 crate :: middle:: region:: Scope ,
212216 crate :: ty:: FloatTy ,
213217 :: rustc_ast:: InlineAsmOptions ,
@@ -259,7 +263,6 @@ TrivialTypeTraversalAndLiftImpls! {
259263 Field ,
260264 interpret:: Scalar ,
261265 rustc_target:: abi:: Size ,
262- rustc_type_ir:: DebruijnIndex ,
263266 ty:: BoundVar ,
264267 ty:: Placeholder <ty:: BoundVar >,
265268}
@@ -389,13 +392,6 @@ impl<I: Interner, T: TypeFoldable<I>, U: TypeFoldable<I>> TypeFoldable<I> for (T
389392 }
390393}
391394
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-
399395impl < I : Interner , A : TypeFoldable < I > , B : TypeFoldable < I > , C : TypeFoldable < I > > TypeFoldable < I >
400396 for ( A , B , C )
401397{
@@ -411,41 +407,19 @@ impl<I: Interner, A: TypeFoldable<I>, B: TypeFoldable<I>, C: TypeFoldable<I>> Ty
411407 }
412408}
413409
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-
424410EnumTypeTraversalImpl ! {
425411 impl <I , T > TypeFoldable <I > for Option <T > {
426412 ( Some ) ( a) ,
427413 ( None ) ,
428414 } where I : Interner , T : TypeFoldable <I >
429415}
430- EnumTypeTraversalImpl ! {
431- impl <I , T > TypeVisitable <I > for Option <T > {
432- ( Some ) ( a) ,
433- ( None ) ,
434- } where I : Interner , T : TypeVisitable <I >
435- }
436416
437417EnumTypeTraversalImpl ! {
438418 impl <I , T , E > TypeFoldable <I > for Result <T , E > {
439419 ( Ok ) ( a) ,
440420 ( Err ) ( a) ,
441421 } where I : Interner , T : TypeFoldable <I >, E : TypeFoldable <I >,
442422}
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- }
449423
450424impl < I : Interner , T : TypeFoldable < I > > TypeFoldable < I > for Rc < T > {
451425 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> {
484458 }
485459}
486460
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-
493461impl < I : Interner , T : TypeFoldable < I > > TypeFoldable < I > for Arc < T > {
494462 fn try_fold_with < F : FallibleTypeFolder < I > > ( mut self , folder : & mut F ) -> Result < Self , F :: Error > {
495463 // 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> {
527495 }
528496}
529497
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-
536498impl < I : Interner , T : TypeFoldable < I > > TypeFoldable < I > for Box < T > {
537499 fn try_fold_with < F : FallibleTypeFolder < I > > ( self , folder : & mut F ) -> Result < Self , F :: Error > {
538500 self . try_map_id ( |value| value. try_fold_with ( folder) )
539501 }
540502}
541503
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-
548504impl < I : Interner , T : TypeFoldable < I > > TypeFoldable < I > for Vec < T > {
549505 fn try_fold_with < F : FallibleTypeFolder < I > > ( self , folder : & mut F ) -> Result < Self , F :: Error > {
550506 self . try_map_id ( |t| t. try_fold_with ( folder) )
551507 }
552508}
553509
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-
566510impl < I : Interner , T : TypeFoldable < I > > TypeFoldable < I > for Box < [ T ] > {
567511 fn try_fold_with < F : FallibleTypeFolder < I > > ( self , folder : & mut F ) -> Result < Self , F :: Error > {
568512 self . try_map_id ( |t| t. try_fold_with ( folder) )
569513 }
570514}
571515
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-
578516impl < ' tcx , T : TypeFoldable < TyCtxt < ' tcx > > > TypeFoldable < TyCtxt < ' tcx > > for ty:: Binder < ' tcx , T > {
579517 fn try_fold_with < F : FallibleTypeFolder < TyCtxt < ' tcx > > > (
580518 self ,
@@ -841,12 +779,6 @@ impl<I: Interner, T: TypeFoldable<I>, Ix: Idx> TypeFoldable<I> for IndexVec<Ix,
841779 }
842780}
843781
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-
850782impl < ' tcx > TypeFoldable < TyCtxt < ' tcx > > for ty:: Const < ' tcx > {
851783 fn try_fold_with < F : FallibleTypeFolder < TyCtxt < ' tcx > > > (
852784 self ,
0 commit comments