@@ -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 , WithInfcx } ;
14
15
@@ -819,3 +820,27 @@ impl<'tcx> TypeVisitable<TyCtxt<'tcx>> for TyAndLayout<'tcx, Ty<'tcx>> {
819
820
visitor. visit_ty ( self . ty )
820
821
}
821
822
}
823
+
824
+ impl < ' tcx , T : TypeVisitable < TyCtxt < ' tcx > > + Debug + Clone > TypeVisitable < TyCtxt < ' tcx > >
825
+ for Spanned < T >
826
+ {
827
+ fn visit_with < V : TypeVisitor < TyCtxt < ' tcx > > > ( & self , visitor : & mut V ) -> ControlFlow < V :: BreakTy > {
828
+ self . node . visit_with ( visitor) ?;
829
+ self . span . visit_with ( visitor) ?;
830
+ ControlFlow :: Continue ( ( ) )
831
+ }
832
+ }
833
+
834
+ impl < ' tcx , T : TypeFoldable < TyCtxt < ' tcx > > + Debug + Clone > TypeFoldable < TyCtxt < ' tcx > >
835
+ for Spanned < T >
836
+ {
837
+ fn try_fold_with < F : FallibleTypeFolder < TyCtxt < ' tcx > > > (
838
+ self ,
839
+ folder : & mut F ,
840
+ ) -> Result < Self , F :: Error > {
841
+ Ok ( Spanned {
842
+ node : self . node . try_fold_with ( folder) ?,
843
+ span : self . span . try_fold_with ( folder) ?,
844
+ } )
845
+ }
846
+ }
0 commit comments