@@ -7,7 +7,7 @@ use crate::mir::{Field, ProjectionKind};
77use crate :: ty:: fold:: { ir:: TypeSuperFoldable , FallibleTypeFolder , TypeFoldable } ;
88use crate :: ty:: print:: { with_no_trimmed_paths, FmtPrinter , Printer } ;
99use crate :: ty:: visit:: { ir:: TypeSuperVisitable , TypeVisitable , TypeVisitor } ;
10- use crate :: ty:: { self , ir, AliasTy , InferConst , Lift , Term , TermKind , Ty , TyCtxt } ;
10+ use crate :: ty:: { self , ir, AliasTy , InferConst , Interner , Lift , Term , TermKind , Ty , TyCtxt } ;
1111use rustc_data_structures:: functor:: IdFunctor ;
1212use rustc_hir:: def:: Namespace ;
1313use rustc_index:: vec:: { Idx , IndexVec } ;
@@ -375,28 +375,28 @@ impl<'tcx> ir::TypeVisitable<TyCtxt<'tcx>> for ty::AdtDef<'tcx> {
375375 }
376376}
377377
378- impl < ' tcx , T : TypeFoldable < ' tcx > , U : TypeFoldable < ' tcx > > ir:: TypeFoldable < TyCtxt < ' tcx > > for ( T , U ) {
379- fn try_fold_with < F : FallibleTypeFolder < ' tcx > > (
378+ impl < I : Interner , T : ir :: TypeFoldable < I > , U : ir :: TypeFoldable < I > > ir:: TypeFoldable < I > for ( T , U ) {
379+ fn try_fold_with < F : ir :: FallibleTypeFolder < I > > (
380380 self ,
381381 folder : & mut F ,
382382 ) -> Result < ( T , U ) , F :: Error > {
383383 Ok ( ( self . 0 . try_fold_with ( folder) ?, self . 1 . try_fold_with ( folder) ?) )
384384 }
385385}
386386
387- impl < ' tcx , T : TypeVisitable < ' tcx > , U : TypeVisitable < ' tcx > > ir:: TypeVisitable < TyCtxt < ' tcx > >
387+ impl < I : Interner , T : ir :: TypeVisitable < I > , U : ir :: TypeVisitable < I > > ir:: TypeVisitable < I >
388388 for ( T , U )
389389{
390- fn visit_with < V : TypeVisitor < ' tcx > > ( & self , visitor : & mut V ) -> ControlFlow < V :: BreakTy > {
390+ fn visit_with < V : ir :: TypeVisitor < I > > ( & self , visitor : & mut V ) -> ControlFlow < V :: BreakTy > {
391391 self . 0 . visit_with ( visitor) ?;
392392 self . 1 . visit_with ( visitor)
393393 }
394394}
395395
396- impl < ' tcx , A : TypeFoldable < ' tcx > , B : TypeFoldable < ' tcx > , C : TypeFoldable < ' tcx > >
397- ir:: TypeFoldable < TyCtxt < ' tcx > > for ( A , B , C )
396+ impl < I : Interner , A : ir :: TypeFoldable < I > , B : ir :: TypeFoldable < I > , C : ir :: TypeFoldable < I > >
397+ ir:: TypeFoldable < I > for ( A , B , C )
398398{
399- fn try_fold_with < F : FallibleTypeFolder < ' tcx > > (
399+ fn try_fold_with < F : ir :: FallibleTypeFolder < I > > (
400400 self ,
401401 folder : & mut F ,
402402 ) -> Result < ( A , B , C ) , F :: Error > {
@@ -408,44 +408,44 @@ impl<'tcx, A: TypeFoldable<'tcx>, B: TypeFoldable<'tcx>, C: TypeFoldable<'tcx>>
408408 }
409409}
410410
411- impl < ' tcx , A : TypeVisitable < ' tcx > , B : TypeVisitable < ' tcx > , C : TypeVisitable < ' tcx > >
412- ir:: TypeVisitable < TyCtxt < ' tcx > > for ( A , B , C )
411+ impl < I : Interner , A : ir :: TypeVisitable < I > , B : ir :: TypeVisitable < I > , C : ir :: TypeVisitable < I > >
412+ ir:: TypeVisitable < I > for ( A , B , C )
413413{
414- fn visit_with < V : TypeVisitor < ' tcx > > ( & self , visitor : & mut V ) -> ControlFlow < V :: BreakTy > {
414+ fn visit_with < V : ir :: TypeVisitor < I > > ( & self , visitor : & mut V ) -> ControlFlow < V :: BreakTy > {
415415 self . 0 . visit_with ( visitor) ?;
416416 self . 1 . visit_with ( visitor) ?;
417417 self . 2 . visit_with ( visitor)
418418 }
419419}
420420
421421EnumTypeTraversalImpl ! {
422- impl <' tcx , T > TypeFoldable <' tcx > for Option <T > {
422+ impl <I , T > TypeFoldable <I > for Option <T > {
423423 ( Some ) ( a) ,
424424 ( None ) ,
425- } where T : TypeFoldable <' tcx >
425+ } where I : Interner , T : ir :: TypeFoldable <I >
426426}
427427EnumTypeTraversalImpl ! {
428- impl <' tcx , T > TypeVisitable <' tcx > for Option <T > {
428+ impl <I , T > TypeVisitable <I > for Option <T > {
429429 ( Some ) ( a) ,
430430 ( None ) ,
431- } where T : TypeVisitable <' tcx >
431+ } where I : Interner , T : ir :: TypeVisitable <I >
432432}
433433
434434EnumTypeTraversalImpl ! {
435- impl <' tcx , T , E > TypeFoldable <' tcx > for Result <T , E > {
435+ impl <I , T , E > TypeFoldable <I > for Result <T , E > {
436436 ( Ok ) ( a) ,
437437 ( Err ) ( a) ,
438- } where T : TypeFoldable <' tcx >, E : TypeFoldable <' tcx >,
438+ } where I : Interner , T : ir :: TypeFoldable <I >, E : ir :: TypeFoldable <I >,
439439}
440440EnumTypeTraversalImpl ! {
441- impl <' tcx , T , E > TypeVisitable <' tcx > for Result <T , E > {
441+ impl <I , T , E > TypeVisitable <I > for Result <T , E > {
442442 ( Ok ) ( a) ,
443443 ( Err ) ( a) ,
444- } where T : TypeVisitable <' tcx >, E : TypeVisitable <' tcx >,
444+ } where I : Interner , T : ir :: TypeVisitable <I >, E : ir :: TypeVisitable <I >,
445445}
446446
447- impl < ' tcx , T : TypeFoldable < ' tcx > > ir:: TypeFoldable < TyCtxt < ' tcx > > for Rc < T > {
448- fn try_fold_with < F : FallibleTypeFolder < ' tcx > > (
447+ impl < I : Interner , T : ir :: TypeFoldable < I > > ir:: TypeFoldable < I > for Rc < T > {
448+ fn try_fold_with < F : ir :: FallibleTypeFolder < I > > (
449449 mut self ,
450450 folder : & mut F ,
451451 ) -> Result < Self , F :: Error > {
@@ -484,14 +484,14 @@ impl<'tcx, T: TypeFoldable<'tcx>> ir::TypeFoldable<TyCtxt<'tcx>> for Rc<T> {
484484 }
485485}
486486
487- impl < ' tcx , T : TypeVisitable < ' tcx > > ir:: TypeVisitable < TyCtxt < ' tcx > > for Rc < T > {
488- fn visit_with < V : TypeVisitor < ' tcx > > ( & self , visitor : & mut V ) -> ControlFlow < V :: BreakTy > {
487+ impl < I : Interner , T : ir :: TypeVisitable < I > > ir:: TypeVisitable < I > for Rc < T > {
488+ fn visit_with < V : ir :: TypeVisitor < I > > ( & self , visitor : & mut V ) -> ControlFlow < V :: BreakTy > {
489489 ( * * self ) . visit_with ( visitor)
490490 }
491491}
492492
493- impl < ' tcx , T : TypeFoldable < ' tcx > > ir:: TypeFoldable < TyCtxt < ' tcx > > for Arc < T > {
494- fn try_fold_with < F : FallibleTypeFolder < ' tcx > > (
493+ impl < I : Interner , T : ir :: TypeFoldable < I > > ir:: TypeFoldable < I > for Arc < T > {
494+ fn try_fold_with < F : ir :: FallibleTypeFolder < I > > (
495495 mut self ,
496496 folder : & mut F ,
497497 ) -> Result < Self , F :: Error > {
@@ -530,50 +530,50 @@ impl<'tcx, T: TypeFoldable<'tcx>> ir::TypeFoldable<TyCtxt<'tcx>> for Arc<T> {
530530 }
531531}
532532
533- impl < ' tcx , T : TypeVisitable < ' tcx > > ir:: TypeVisitable < TyCtxt < ' tcx > > for Arc < T > {
534- fn visit_with < V : TypeVisitor < ' tcx > > ( & self , visitor : & mut V ) -> ControlFlow < V :: BreakTy > {
533+ impl < I : Interner , T : ir :: TypeVisitable < I > > ir:: TypeVisitable < I > for Arc < T > {
534+ fn visit_with < V : ir :: TypeVisitor < I > > ( & self , visitor : & mut V ) -> ControlFlow < V :: BreakTy > {
535535 ( * * self ) . visit_with ( visitor)
536536 }
537537}
538538
539- impl < ' tcx , T : TypeFoldable < ' tcx > > ir:: TypeFoldable < TyCtxt < ' tcx > > for Box < T > {
540- fn try_fold_with < F : FallibleTypeFolder < ' tcx > > ( self , folder : & mut F ) -> Result < Self , F :: Error > {
539+ impl < I : Interner , T : ir :: TypeFoldable < I > > ir:: TypeFoldable < I > for Box < T > {
540+ fn try_fold_with < F : ir :: FallibleTypeFolder < I > > ( self , folder : & mut F ) -> Result < Self , F :: Error > {
541541 self . try_map_id ( |value| value. try_fold_with ( folder) )
542542 }
543543}
544544
545- impl < ' tcx , T : TypeVisitable < ' tcx > > ir:: TypeVisitable < TyCtxt < ' tcx > > for Box < T > {
546- fn visit_with < V : TypeVisitor < ' tcx > > ( & self , visitor : & mut V ) -> ControlFlow < V :: BreakTy > {
545+ impl < I : Interner , T : ir :: TypeVisitable < I > > ir:: TypeVisitable < I > for Box < T > {
546+ fn visit_with < V : ir :: TypeVisitor < I > > ( & self , visitor : & mut V ) -> ControlFlow < V :: BreakTy > {
547547 ( * * self ) . visit_with ( visitor)
548548 }
549549}
550550
551- impl < ' tcx , T : TypeFoldable < ' tcx > > ir:: TypeFoldable < TyCtxt < ' tcx > > for Vec < T > {
552- fn try_fold_with < F : FallibleTypeFolder < ' tcx > > ( self , folder : & mut F ) -> Result < Self , F :: Error > {
551+ impl < I : Interner , T : ir :: TypeFoldable < I > > ir:: TypeFoldable < I > for Vec < T > {
552+ fn try_fold_with < F : ir :: FallibleTypeFolder < I > > ( self , folder : & mut F ) -> Result < Self , F :: Error > {
553553 self . try_map_id ( |t| t. try_fold_with ( folder) )
554554 }
555555}
556556
557- impl < ' tcx , T : TypeVisitable < ' tcx > > ir:: TypeVisitable < TyCtxt < ' tcx > > for Vec < T > {
558- fn visit_with < V : TypeVisitor < ' tcx > > ( & self , visitor : & mut V ) -> ControlFlow < V :: BreakTy > {
557+ impl < I : Interner , T : ir :: TypeVisitable < I > > ir:: TypeVisitable < I > for Vec < T > {
558+ fn visit_with < V : ir :: TypeVisitor < I > > ( & self , visitor : & mut V ) -> ControlFlow < V :: BreakTy > {
559559 self . iter ( ) . try_for_each ( |t| t. visit_with ( visitor) )
560560 }
561561}
562562
563- impl < ' tcx , T : TypeVisitable < ' tcx > > ir:: TypeVisitable < TyCtxt < ' tcx > > for & [ T ] {
564- fn visit_with < V : TypeVisitor < ' tcx > > ( & self , visitor : & mut V ) -> ControlFlow < V :: BreakTy > {
563+ impl < I : Interner , T : ir :: TypeVisitable < I > > ir:: TypeVisitable < I > for & [ T ] {
564+ fn visit_with < V : ir :: TypeVisitor < I > > ( & self , visitor : & mut V ) -> ControlFlow < V :: BreakTy > {
565565 self . iter ( ) . try_for_each ( |t| t. visit_with ( visitor) )
566566 }
567567}
568568
569- impl < ' tcx , T : TypeFoldable < ' tcx > > ir:: TypeFoldable < TyCtxt < ' tcx > > for Box < [ T ] > {
570- fn try_fold_with < F : FallibleTypeFolder < ' tcx > > ( self , folder : & mut F ) -> Result < Self , F :: Error > {
569+ impl < I : Interner , T : ir :: TypeFoldable < I > > ir:: TypeFoldable < I > for Box < [ T ] > {
570+ fn try_fold_with < F : ir :: FallibleTypeFolder < I > > ( self , folder : & mut F ) -> Result < Self , F :: Error > {
571571 self . try_map_id ( |t| t. try_fold_with ( folder) )
572572 }
573573}
574574
575- impl < ' tcx , T : TypeVisitable < ' tcx > > ir:: TypeVisitable < TyCtxt < ' tcx > > for Box < [ T ] > {
576- fn visit_with < V : TypeVisitor < ' tcx > > ( & self , visitor : & mut V ) -> ControlFlow < V :: BreakTy > {
575+ impl < I : Interner , T : ir :: TypeVisitable < I > > ir:: TypeVisitable < I > for Box < [ T ] > {
576+ fn visit_with < V : ir :: TypeVisitor < I > > ( & self , visitor : & mut V ) -> ControlFlow < V :: BreakTy > {
577577 self . iter ( ) . try_for_each ( |t| t. visit_with ( visitor) )
578578 }
579579}
@@ -790,14 +790,14 @@ impl<'tcx> ir::TypeFoldable<TyCtxt<'tcx>> for &'tcx ty::List<ty::Predicate<'tcx>
790790 }
791791}
792792
793- impl < ' tcx , T : TypeFoldable < ' tcx > , I : Idx > ir:: TypeFoldable < TyCtxt < ' tcx > > for IndexVec < I , T > {
794- fn try_fold_with < F : FallibleTypeFolder < ' tcx > > ( self , folder : & mut F ) -> Result < Self , F :: Error > {
793+ impl < I : Interner , T : ir :: TypeFoldable < I > , Ix : Idx > ir:: TypeFoldable < I > for IndexVec < Ix , T > {
794+ fn try_fold_with < F : ir :: FallibleTypeFolder < I > > ( self , folder : & mut F ) -> Result < Self , F :: Error > {
795795 self . try_map_id ( |x| x. try_fold_with ( folder) )
796796 }
797797}
798798
799- impl < ' tcx , T : TypeVisitable < ' tcx > , I : Idx > ir:: TypeVisitable < TyCtxt < ' tcx > > for IndexVec < I , T > {
800- fn visit_with < V : TypeVisitor < ' tcx > > ( & self , visitor : & mut V ) -> ControlFlow < V :: BreakTy > {
799+ impl < I : Interner , T : ir :: TypeVisitable < I > , Ix : Idx > ir:: TypeVisitable < I > for IndexVec < Ix , T > {
800+ fn visit_with < V : ir :: TypeVisitor < I > > ( & self , visitor : & mut V ) -> ControlFlow < V :: BreakTy > {
801801 self . iter ( ) . try_for_each ( |t| t. visit_with ( visitor) )
802802 }
803803}
0 commit comments