@@ -11,15 +11,15 @@ use rustc_hir::def::Namespace;
11
11
use rustc_span:: source_map:: Spanned ;
12
12
use rustc_target:: abi:: TyAndLayout ;
13
13
use rustc_type_ir:: ConstKind ;
14
- use rustc_type_ir:: traverse:: TypeTraversable ;
14
+ use rustc_type_ir:: traverse:: { ImportantTypeTraversal , TypeTraversable } ;
15
15
16
16
use super :: print:: PrettyPrinter ;
17
17
use super :: { GenericArg , GenericArgKind , Pattern , Region } ;
18
18
use crate :: mir:: interpret;
19
19
use crate :: ty:: fold:: { FallibleTypeFolder , TypeFoldable , TypeSuperFoldable } ;
20
20
use crate :: ty:: print:: { FmtPrinter , Printer , with_no_trimmed_paths} ;
21
21
use crate :: ty:: visit:: { TypeSuperVisitable , TypeVisitable , TypeVisitor } ;
22
- use crate :: ty:: { self , InferConst , Lift , Term , TermKind , Ty , TyCtxt } ;
22
+ use crate :: ty:: { self , Lift , Term , TermKind , Ty , TyCtxt } ;
23
23
24
24
impl fmt:: Debug for ty:: TraitDef {
25
25
fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
@@ -258,7 +258,6 @@ TrivialTypeTraversalImpls! {
258
258
:: rustc_span:: Span ,
259
259
:: rustc_span:: symbol:: Ident ,
260
260
ty:: BoundVar ,
261
- ty:: ValTree <' tcx>,
262
261
}
263
262
// For some things about which the type library does not know, or does not
264
263
// provide any traversal implementations, we need to provide a traversal
@@ -304,12 +303,6 @@ impl<'a, 'tcx> Lift<TyCtxt<'tcx>> for Term<'a> {
304
303
///////////////////////////////////////////////////////////////////////////
305
304
// Traversal implementations.
306
305
307
- impl < ' tcx > TypeVisitable < TyCtxt < ' tcx > > for ty:: AdtDef < ' tcx > {
308
- fn visit_with < V : TypeVisitor < TyCtxt < ' tcx > > > ( & self , _visitor : & mut V ) -> V :: Result {
309
- V :: Result :: output ( )
310
- }
311
- }
312
-
313
306
impl < ' tcx > TypeFoldable < TyCtxt < ' tcx > > for & ' tcx ty:: List < ty:: PolyExistentialPredicate < ' tcx > > {
314
307
fn try_fold_with < F : FallibleTypeFolder < TyCtxt < ' tcx > > > (
315
308
self ,
@@ -338,6 +331,9 @@ impl<'tcx> TypeFoldable<TyCtxt<'tcx>> for Pattern<'tcx> {
338
331
}
339
332
}
340
333
334
+ impl < ' tcx > TypeTraversable < TyCtxt < ' tcx > > for Pattern < ' tcx > {
335
+ type Kind = ImportantTypeTraversal ;
336
+ }
341
337
impl < ' tcx > TypeVisitable < TyCtxt < ' tcx > > for Pattern < ' tcx > {
342
338
fn visit_with < V : TypeVisitor < TyCtxt < ' tcx > > > ( & self , visitor : & mut V ) -> V :: Result {
343
339
( * * self ) . visit_with ( visitor)
@@ -353,6 +349,9 @@ impl<'tcx> TypeFoldable<TyCtxt<'tcx>> for Ty<'tcx> {
353
349
}
354
350
}
355
351
352
+ impl < ' tcx > TypeTraversable < TyCtxt < ' tcx > > for Ty < ' tcx > {
353
+ type Kind = ImportantTypeTraversal ;
354
+ }
356
355
impl < ' tcx > TypeVisitable < TyCtxt < ' tcx > > for Ty < ' tcx > {
357
356
fn visit_with < V : TypeVisitor < TyCtxt < ' tcx > > > ( & self , visitor : & mut V ) -> V :: Result {
358
357
visitor. visit_ty ( * self )
@@ -469,6 +468,9 @@ impl<'tcx> TypeFoldable<TyCtxt<'tcx>> for ty::Region<'tcx> {
469
468
}
470
469
}
471
470
471
+ impl < ' tcx > TypeTraversable < TyCtxt < ' tcx > > for ty:: Region < ' tcx > {
472
+ type Kind = ImportantTypeTraversal ;
473
+ }
472
474
impl < ' tcx > TypeVisitable < TyCtxt < ' tcx > > for ty:: Region < ' tcx > {
473
475
fn visit_with < V : TypeVisitor < TyCtxt < ' tcx > > > ( & self , visitor : & mut V ) -> V :: Result {
474
476
visitor. visit_region ( * self )
@@ -494,12 +496,18 @@ impl<'tcx> TypeFoldable<TyCtxt<'tcx>> for ty::Clause<'tcx> {
494
496
}
495
497
}
496
498
499
+ impl < ' tcx > TypeTraversable < TyCtxt < ' tcx > > for ty:: Predicate < ' tcx > {
500
+ type Kind = ImportantTypeTraversal ;
501
+ }
497
502
impl < ' tcx > TypeVisitable < TyCtxt < ' tcx > > for ty:: Predicate < ' tcx > {
498
503
fn visit_with < V : TypeVisitor < TyCtxt < ' tcx > > > ( & self , visitor : & mut V ) -> V :: Result {
499
504
visitor. visit_predicate ( * self )
500
505
}
501
506
}
502
507
508
+ impl < ' tcx > TypeTraversable < TyCtxt < ' tcx > > for ty:: Clause < ' tcx > {
509
+ type Kind = ImportantTypeTraversal ;
510
+ }
503
511
impl < ' tcx > TypeVisitable < TyCtxt < ' tcx > > for ty:: Clause < ' tcx > {
504
512
fn visit_with < V : TypeVisitor < TyCtxt < ' tcx > > > ( & self , visitor : & mut V ) -> V :: Result {
505
513
visitor. visit_predicate ( self . as_predicate ( ) )
@@ -522,6 +530,9 @@ impl<'tcx> TypeSuperVisitable<TyCtxt<'tcx>> for ty::Predicate<'tcx> {
522
530
}
523
531
}
524
532
533
+ impl < ' tcx > TypeTraversable < TyCtxt < ' tcx > > for ty:: Clauses < ' tcx > {
534
+ type Kind = ImportantTypeTraversal ;
535
+ }
525
536
impl < ' tcx > TypeVisitable < TyCtxt < ' tcx > > for ty:: Clauses < ' tcx > {
526
537
fn visit_with < V : TypeVisitor < TyCtxt < ' tcx > > > ( & self , visitor : & mut V ) -> V :: Result {
527
538
visitor. visit_clauses ( self )
@@ -552,6 +563,9 @@ impl<'tcx> TypeFoldable<TyCtxt<'tcx>> for ty::Const<'tcx> {
552
563
}
553
564
}
554
565
566
+ impl < ' tcx > TypeTraversable < TyCtxt < ' tcx > > for ty:: Const < ' tcx > {
567
+ type Kind = ImportantTypeTraversal ;
568
+ }
555
569
impl < ' tcx > TypeVisitable < TyCtxt < ' tcx > > for ty:: Const < ' tcx > {
556
570
fn visit_with < V : TypeVisitor < TyCtxt < ' tcx > > > ( & self , visitor : & mut V ) -> V :: Result {
557
571
visitor. visit_const ( * self )
@@ -602,6 +616,9 @@ impl<'tcx> TypeSuperVisitable<TyCtxt<'tcx>> for ty::Const<'tcx> {
602
616
}
603
617
}
604
618
619
+ impl < ' tcx > TypeTraversable < TyCtxt < ' tcx > > for rustc_span:: ErrorGuaranteed {
620
+ type Kind = ImportantTypeTraversal ;
621
+ }
605
622
impl < ' tcx > TypeVisitable < TyCtxt < ' tcx > > for rustc_span:: ErrorGuaranteed {
606
623
fn visit_with < V : TypeVisitor < TyCtxt < ' tcx > > > ( & self , visitor : & mut V ) -> V :: Result {
607
624
visitor. visit_error ( * self )
@@ -617,27 +634,20 @@ impl<'tcx> TypeFoldable<TyCtxt<'tcx>> for rustc_span::ErrorGuaranteed {
617
634
}
618
635
}
619
636
620
- impl < ' tcx > TypeFoldable < TyCtxt < ' tcx > > for InferConst {
621
- fn try_fold_with < F : FallibleTypeFolder < TyCtxt < ' tcx > > > (
622
- self ,
623
- _folder : & mut F ,
624
- ) -> Result < Self , F :: Error > {
625
- Ok ( self )
626
- }
627
- }
628
-
629
- impl < ' tcx > TypeVisitable < TyCtxt < ' tcx > > for InferConst {
630
- fn visit_with < V : TypeVisitor < TyCtxt < ' tcx > > > ( & self , _visitor : & mut V ) -> V :: Result {
631
- V :: Result :: output ( )
632
- }
637
+ impl < ' tcx > TypeTraversable < TyCtxt < ' tcx > > for TyAndLayout < ' tcx , Ty < ' tcx > > {
638
+ type Kind = ImportantTypeTraversal ;
633
639
}
634
-
635
640
impl < ' tcx > TypeVisitable < TyCtxt < ' tcx > > for TyAndLayout < ' tcx , Ty < ' tcx > > {
636
641
fn visit_with < V : TypeVisitor < TyCtxt < ' tcx > > > ( & self , visitor : & mut V ) -> V :: Result {
637
642
visitor. visit_ty ( self . ty )
638
643
}
639
644
}
640
645
646
+ impl < ' tcx , T : TypeVisitable < TyCtxt < ' tcx > > + Debug + Clone > TypeTraversable < TyCtxt < ' tcx > >
647
+ for Spanned < T >
648
+ {
649
+ type Kind = ImportantTypeTraversal ;
650
+ }
641
651
impl < ' tcx , T : TypeVisitable < TyCtxt < ' tcx > > + Debug + Clone > TypeVisitable < TyCtxt < ' tcx > >
642
652
for Spanned < T >
643
653
{
0 commit comments