@@ -87,38 +87,28 @@ pub trait TypeVisitor<I: Interner>: Sized {
87
87
#[ cfg( not( feature = "nightly" ) ) ]
88
88
type BreakTy ;
89
89
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 > {
94
94
t. super_visit_with ( self )
95
95
}
96
96
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 > {
101
98
t. super_visit_with ( self )
102
99
}
103
100
104
101
// 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.
107
103
fn visit_region ( & mut self , _r : I :: Region ) -> ControlFlow < Self :: BreakTy > {
108
104
ControlFlow :: Continue ( ( ) )
109
105
}
110
106
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 > {
115
108
c. super_visit_with ( self )
116
109
}
117
110
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 > {
122
112
p. super_visit_with ( self )
123
113
}
124
114
}
@@ -327,13 +317,7 @@ pub trait TypeVisitableExt<I: Interner>: TypeVisitable<I> {
327
317
}
328
318
}
329
319
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 {
337
321
fn has_type_flags ( & self , flags : TypeFlags ) -> bool {
338
322
let res =
339
323
self . visit_with ( & mut HasTypeFlagsVisitor { flags } ) == ControlFlow :: Break ( FoundFlags ) ;
@@ -381,19 +365,13 @@ impl std::fmt::Debug for HasTypeFlagsVisitor {
381
365
// are present, regardless of whether those bound variables are used. This
382
366
// is important for anonymization of binders in `TyCtxt::erase_regions`. We
383
367
// 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 {
391
369
type BreakTy = FoundFlags ;
392
370
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 > {
397
375
// If we're looking for the HAS_BINDER_VARS flag, check if the
398
376
// binder has vars. This won't be present in the binder's bound
399
377
// value, so we need to check here too.
@@ -480,19 +458,13 @@ struct HasEscapingVarsVisitor {
480
458
outer_index : ty:: DebruijnIndex ,
481
459
}
482
460
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 {
490
462
type BreakTy = FoundEscapingVars ;
491
463
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 > {
496
468
self . outer_index . shift_in ( 1 ) ;
497
469
let result = t. super_visit_with ( self ) ;
498
470
self . outer_index . shift_out ( 1 ) ;
@@ -550,30 +522,18 @@ where
550
522
551
523
struct HasErrorVisitor ;
552
524
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 {
560
526
type BreakTy = I :: ErrorGuaranteed ;
561
527
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 > {
566
529
if let ty:: Error ( guar) = t. kind ( ) {
567
530
ControlFlow :: Break ( guar)
568
531
} else {
569
532
t. super_visit_with ( self )
570
533
}
571
534
}
572
535
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 > {
577
537
if let ty:: ConstKind :: Error ( guar) = c. kind ( ) {
578
538
ControlFlow :: Break ( guar)
579
539
} else {
0 commit comments