@@ -9,7 +9,6 @@ use crate::ty::print::{with_no_trimmed_paths, FmtPrinter, Printer};
99use crate :: ty:: visit:: { TypeSuperVisitable , TypeVisitable , TypeVisitor } ;
1010use crate :: ty:: { self , InferConst , Lift , Term , TermKind , Ty , TyCtxt } ;
1111use rustc_data_structures:: functor:: IdFunctor ;
12- use rustc_hir as hir;
1312use rustc_hir:: def:: Namespace ;
1413use rustc_index:: vec:: { Idx , IndexVec } ;
1514
@@ -241,6 +240,16 @@ TrivialTypeTraversalAndLiftImpls! {
241240 Field ,
242241 interpret:: Scalar ,
243242 rustc_target:: abi:: Size ,
243+ ty:: DelaySpanBugEmitted ,
244+ rustc_type_ir:: DebruijnIndex ,
245+ ty:: BoundVar ,
246+ ty:: Placeholder <ty:: BoundVar >,
247+ }
248+
249+ TrivialTypeTraversalAndLiftImpls ! {
250+ for <' tcx> {
251+ ty:: ValTree <' tcx>,
252+ }
244253}
245254
246255///////////////////////////////////////////////////////////////////////////
@@ -613,68 +622,6 @@ impl<'tcx> TypeVisitable<'tcx> for &'tcx ty::List<ProjectionKind> {
613622 }
614623}
615624
616- impl < ' tcx > TypeFoldable < ' tcx > for ty:: instance:: Instance < ' tcx > {
617- fn try_fold_with < F : FallibleTypeFolder < ' tcx > > ( self , folder : & mut F ) -> Result < Self , F :: Error > {
618- use crate :: ty:: InstanceDef :: * ;
619- Ok ( Self {
620- substs : self . substs . try_fold_with ( folder) ?,
621- def : match self . def {
622- Item ( def) => Item ( def. try_fold_with ( folder) ?) ,
623- VTableShim ( did) => VTableShim ( did. try_fold_with ( folder) ?) ,
624- ReifyShim ( did) => ReifyShim ( did. try_fold_with ( folder) ?) ,
625- Intrinsic ( did) => Intrinsic ( did. try_fold_with ( folder) ?) ,
626- FnPtrShim ( did, ty) => {
627- FnPtrShim ( did. try_fold_with ( folder) ?, ty. try_fold_with ( folder) ?)
628- }
629- Virtual ( did, i) => Virtual ( did. try_fold_with ( folder) ?, i) ,
630- ClosureOnceShim { call_once, track_caller } => {
631- ClosureOnceShim { call_once : call_once. try_fold_with ( folder) ?, track_caller }
632- }
633- DropGlue ( did, ty) => {
634- DropGlue ( did. try_fold_with ( folder) ?, ty. try_fold_with ( folder) ?)
635- }
636- CloneShim ( did, ty) => {
637- CloneShim ( did. try_fold_with ( folder) ?, ty. try_fold_with ( folder) ?)
638- }
639- } ,
640- } )
641- }
642- }
643-
644- impl < ' tcx > TypeVisitable < ' tcx > for ty:: instance:: Instance < ' tcx > {
645- fn visit_with < V : TypeVisitor < ' tcx > > ( & self , visitor : & mut V ) -> ControlFlow < V :: BreakTy > {
646- use crate :: ty:: InstanceDef :: * ;
647- self . substs . visit_with ( visitor) ?;
648- match self . def {
649- Item ( def) => def. visit_with ( visitor) ,
650- VTableShim ( did) | ReifyShim ( did) | Intrinsic ( did) | Virtual ( did, _) => {
651- did. visit_with ( visitor)
652- }
653- FnPtrShim ( did, ty) | CloneShim ( did, ty) => {
654- did. visit_with ( visitor) ?;
655- ty. visit_with ( visitor)
656- }
657- DropGlue ( did, ty) => {
658- did. visit_with ( visitor) ?;
659- ty. visit_with ( visitor)
660- }
661- ClosureOnceShim { call_once, track_caller : _ } => call_once. visit_with ( visitor) ,
662- }
663- }
664- }
665-
666- impl < ' tcx > TypeFoldable < ' tcx > for interpret:: GlobalId < ' tcx > {
667- fn try_fold_with < F : FallibleTypeFolder < ' tcx > > ( self , folder : & mut F ) -> Result < Self , F :: Error > {
668- Ok ( Self { instance : self . instance . try_fold_with ( folder) ?, promoted : self . promoted } )
669- }
670- }
671-
672- impl < ' tcx > TypeVisitable < ' tcx > for interpret:: GlobalId < ' tcx > {
673- fn visit_with < V : TypeVisitor < ' tcx > > ( & self , visitor : & mut V ) -> ControlFlow < V :: BreakTy > {
674- self . instance . visit_with ( visitor)
675- }
676- }
677-
678625impl < ' tcx > TypeFoldable < ' tcx > for Ty < ' tcx > {
679626 fn try_fold_with < F : FallibleTypeFolder < ' tcx > > ( self , folder : & mut F ) -> Result < Self , F :: Error > {
680627 folder. try_fold_ty ( self )
@@ -902,34 +849,6 @@ impl<'tcx> TypeSuperVisitable<'tcx> for ty::Const<'tcx> {
902849 }
903850}
904851
905- impl < ' tcx > TypeFoldable < ' tcx > for ty:: ConstKind < ' tcx > {
906- fn try_fold_with < F : FallibleTypeFolder < ' tcx > > ( self , folder : & mut F ) -> Result < Self , F :: Error > {
907- Ok ( match self {
908- ty:: ConstKind :: Infer ( ic) => ty:: ConstKind :: Infer ( ic. try_fold_with ( folder) ?) ,
909- ty:: ConstKind :: Param ( p) => ty:: ConstKind :: Param ( p. try_fold_with ( folder) ?) ,
910- ty:: ConstKind :: Unevaluated ( uv) => ty:: ConstKind :: Unevaluated ( uv. try_fold_with ( folder) ?) ,
911- ty:: ConstKind :: Value ( _)
912- | ty:: ConstKind :: Bound ( ..)
913- | ty:: ConstKind :: Placeholder ( ..)
914- | ty:: ConstKind :: Error ( _) => self ,
915- } )
916- }
917- }
918-
919- impl < ' tcx > TypeVisitable < ' tcx > for ty:: ConstKind < ' tcx > {
920- fn visit_with < V : TypeVisitor < ' tcx > > ( & self , visitor : & mut V ) -> ControlFlow < V :: BreakTy > {
921- match * self {
922- ty:: ConstKind :: Infer ( ic) => ic. visit_with ( visitor) ,
923- ty:: ConstKind :: Param ( p) => p. visit_with ( visitor) ,
924- ty:: ConstKind :: Unevaluated ( uv) => uv. visit_with ( visitor) ,
925- ty:: ConstKind :: Value ( _)
926- | ty:: ConstKind :: Bound ( ..)
927- | ty:: ConstKind :: Placeholder ( _)
928- | ty:: ConstKind :: Error ( _) => ControlFlow :: CONTINUE ,
929- }
930- }
931- }
932-
933852impl < ' tcx > TypeFoldable < ' tcx > for InferConst < ' tcx > {
934853 fn try_fold_with < F : FallibleTypeFolder < ' tcx > > ( self , _folder : & mut F ) -> Result < Self , F :: Error > {
935854 Ok ( self )
@@ -984,15 +903,3 @@ impl<'tcx> TypeVisitable<'tcx> for ty::Unevaluated<'tcx, ()> {
984903 self . expand ( ) . visit_with ( visitor)
985904 }
986905}
987-
988- impl < ' tcx > TypeFoldable < ' tcx > for hir:: Constness {
989- fn try_fold_with < F : FallibleTypeFolder < ' tcx > > ( self , _: & mut F ) -> Result < Self , F :: Error > {
990- Ok ( self )
991- }
992- }
993-
994- impl < ' tcx > TypeVisitable < ' tcx > for hir:: Constness {
995- fn visit_with < V : TypeVisitor < ' tcx > > ( & self , _: & mut V ) -> ControlFlow < V :: BreakTy > {
996- ControlFlow :: CONTINUE
997- }
998- }
0 commit comments