@@ -9,6 +9,7 @@ use crate::ty::print::{with_no_trimmed_paths, FmtPrinter, Printer};
9
9
use crate :: ty:: visit:: { TypeSuperVisitable , TypeVisitable , TypeVisitor } ;
10
10
use crate :: ty:: { self , AliasTy , InferConst , Lift , Term , TermKind , Ty , TyCtxt } ;
11
11
use rustc_hir:: def:: Namespace ;
12
+ use rustc_span:: source_map:: Spanned ;
12
13
use rustc_target:: abi:: TyAndLayout ;
13
14
use rustc_type_ir:: { ConstKind , DebugWithInfcx , InferCtxtLike , OptWithInfcx } ;
14
15
@@ -897,3 +898,27 @@ impl<'tcx> TypeVisitable<TyCtxt<'tcx>> for TyAndLayout<'tcx, Ty<'tcx>> {
897
898
visitor. visit_ty ( self . ty )
898
899
}
899
900
}
901
+
902
+ impl < ' tcx , T : TypeVisitable < TyCtxt < ' tcx > > + Debug + Clone > TypeVisitable < TyCtxt < ' tcx > >
903
+ for Spanned < T >
904
+ {
905
+ fn visit_with < V : TypeVisitor < TyCtxt < ' tcx > > > ( & self , visitor : & mut V ) -> ControlFlow < V :: BreakTy > {
906
+ self . node . visit_with ( visitor) ?;
907
+ self . span . visit_with ( visitor) ?;
908
+ ControlFlow :: Continue ( ( ) )
909
+ }
910
+ }
911
+
912
+ impl < ' tcx , T : TypeFoldable < TyCtxt < ' tcx > > + Debug + Clone > TypeFoldable < TyCtxt < ' tcx > >
913
+ for Spanned < T >
914
+ {
915
+ fn try_fold_with < F : FallibleTypeFolder < TyCtxt < ' tcx > > > (
916
+ self ,
917
+ folder : & mut F ,
918
+ ) -> Result < Self , F :: Error > {
919
+ Ok ( Spanned {
920
+ node : self . node . try_fold_with ( folder) ?,
921
+ span : self . span . try_fold_with ( folder) ?,
922
+ } )
923
+ }
924
+ }
0 commit comments