@@ -87,38 +87,28 @@ pub trait TypeVisitor<I: Interner>: Sized {
8787 #[ cfg( not( feature = "nightly" ) ) ]
8888 type BreakTy ;
8989
90- fn visit_binder < T : TypeVisitable < I > > ( & mut self , t : & I :: Binder < T > ) -> ControlFlow < Self :: BreakTy >
91- where
92- I :: Binder < T > : TypeSuperVisitable < I > ,
93- {
90+ fn visit_binder < T : TypeVisitable < I > > (
91+ & mut self ,
92+ t : & I :: Binder < T > ,
93+ ) -> ControlFlow < Self :: BreakTy > {
9494 t. super_visit_with ( self )
9595 }
9696
97- fn visit_ty ( & mut self , t : I :: Ty ) -> ControlFlow < Self :: BreakTy >
98- where
99- I :: Ty : TypeSuperVisitable < I > ,
100- {
97+ fn visit_ty ( & mut self , t : I :: Ty ) -> ControlFlow < Self :: BreakTy > {
10198 t. super_visit_with ( self )
10299 }
103100
104101 // The default region visitor is a no-op because `Region` is non-recursive
105- // and has no `super_visit_with` method to call. That also explains the
106- // lack of `I::Region: TypeSuperVisitable<I>` bound.
102+ // and has no `super_visit_with` method to call.
107103 fn visit_region ( & mut self , _r : I :: Region ) -> ControlFlow < Self :: BreakTy > {
108104 ControlFlow :: Continue ( ( ) )
109105 }
110106
111- fn visit_const ( & mut self , c : I :: Const ) -> ControlFlow < Self :: BreakTy >
112- where
113- I :: Const : TypeSuperVisitable < I > ,
114- {
107+ fn visit_const ( & mut self , c : I :: Const ) -> ControlFlow < Self :: BreakTy > {
115108 c. super_visit_with ( self )
116109 }
117110
118- fn visit_predicate ( & mut self , p : I :: Predicate ) -> ControlFlow < Self :: BreakTy >
119- where
120- I :: Predicate : TypeSuperVisitable < I > ,
121- {
111+ fn visit_predicate ( & mut self , p : I :: Predicate ) -> ControlFlow < Self :: BreakTy > {
122112 p. super_visit_with ( self )
123113 }
124114}
@@ -327,13 +317,7 @@ pub trait TypeVisitableExt<I: Interner>: TypeVisitable<I> {
327317 }
328318}
329319
330- impl < I : Interner , T : TypeVisitable < I > > TypeVisitableExt < I > for T
331- where
332- I :: Ty : Flags ,
333- I :: Region : Flags ,
334- I :: Const : Flags ,
335- I :: Predicate : Flags ,
336- {
320+ impl < I : Interner , T : TypeVisitable < I > > TypeVisitableExt < I > for T {
337321 fn has_type_flags ( & self , flags : TypeFlags ) -> bool {
338322 let res =
339323 self . visit_with ( & mut HasTypeFlagsVisitor { flags } ) == ControlFlow :: Break ( FoundFlags ) ;
@@ -381,19 +365,13 @@ impl std::fmt::Debug for HasTypeFlagsVisitor {
381365// are present, regardless of whether those bound variables are used. This
382366// is important for anonymization of binders in `TyCtxt::erase_regions`. We
383367// specifically detect this case in `visit_binder`.
384- impl < I : Interner > TypeVisitor < I > for HasTypeFlagsVisitor
385- where
386- I :: Ty : Flags ,
387- I :: Region : Flags ,
388- I :: Const : Flags ,
389- I :: Predicate : Flags ,
390- {
368+ impl < I : Interner > TypeVisitor < I > for HasTypeFlagsVisitor {
391369 type BreakTy = FoundFlags ;
392370
393- fn visit_binder < T : TypeVisitable < I > > ( & mut self , t : & I :: Binder < T > ) -> ControlFlow < Self :: BreakTy >
394- where
395- I :: Binder < T > : TypeSuperVisitable < I > ,
396- {
371+ fn visit_binder < T : TypeVisitable < I > > (
372+ & mut self ,
373+ t : & I :: Binder < T > ,
374+ ) -> ControlFlow < Self :: BreakTy > {
397375 // If we're looking for the HAS_BINDER_VARS flag, check if the
398376 // binder has vars. This won't be present in the binder's bound
399377 // value, so we need to check here too.
@@ -480,19 +458,13 @@ struct HasEscapingVarsVisitor {
480458 outer_index : ty:: DebruijnIndex ,
481459}
482460
483- impl < I : Interner > TypeVisitor < I > for HasEscapingVarsVisitor
484- where
485- I :: Ty : Flags ,
486- I :: Region : Flags ,
487- I :: Const : Flags ,
488- I :: Predicate : Flags ,
489- {
461+ impl < I : Interner > TypeVisitor < I > for HasEscapingVarsVisitor {
490462 type BreakTy = FoundEscapingVars ;
491463
492- fn visit_binder < T : TypeVisitable < I > > ( & mut self , t : & I :: Binder < T > ) -> ControlFlow < Self :: BreakTy >
493- where
494- I :: Binder < T > : TypeSuperVisitable < I > ,
495- {
464+ fn visit_binder < T : TypeVisitable < I > > (
465+ & mut self ,
466+ t : & I :: Binder < T > ,
467+ ) -> ControlFlow < Self :: BreakTy > {
496468 self . outer_index . shift_in ( 1 ) ;
497469 let result = t. super_visit_with ( self ) ;
498470 self . outer_index . shift_out ( 1 ) ;
@@ -550,30 +522,18 @@ where
550522
551523struct HasErrorVisitor ;
552524
553- impl < I : Interner > TypeVisitor < I > for HasErrorVisitor
554- where
555- I :: Ty : Flags ,
556- I :: Region : Flags ,
557- I :: Const : Flags ,
558- I :: Predicate : Flags ,
559- {
525+ impl < I : Interner > TypeVisitor < I > for HasErrorVisitor {
560526 type BreakTy = I :: ErrorGuaranteed ;
561527
562- fn visit_ty ( & mut self , t : <I as Interner >:: Ty ) -> ControlFlow < Self :: BreakTy >
563- where
564- <I as Interner >:: Ty : TypeSuperVisitable < I > ,
565- {
528+ fn visit_ty ( & mut self , t : <I as Interner >:: Ty ) -> ControlFlow < Self :: BreakTy > {
566529 if let ty:: Error ( guar) = t. kind ( ) {
567530 ControlFlow :: Break ( guar)
568531 } else {
569532 t. super_visit_with ( self )
570533 }
571534 }
572535
573- fn visit_const ( & mut self , c : <I as Interner >:: Const ) -> ControlFlow < Self :: BreakTy >
574- where
575- <I as Interner >:: Const : TypeSuperVisitable < I > ,
576- {
536+ fn visit_const ( & mut self , c : <I as Interner >:: Const ) -> ControlFlow < Self :: BreakTy > {
577537 if let ty:: ConstKind :: Error ( guar) = c. kind ( ) {
578538 ControlFlow :: Break ( guar)
579539 } else {
0 commit comments