@@ -9,14 +9,11 @@ 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_index:: { Idx , IndexVec } ;
13
12
use rustc_target:: abi:: TyAndLayout ;
14
13
use rustc_type_ir:: { ConstKind , DebugWithInfcx , InferCtxtLike , OptWithInfcx } ;
15
14
16
15
use std:: fmt:: { self , Debug } ;
17
16
use std:: ops:: ControlFlow ;
18
- use std:: rc:: Rc ;
19
- use std:: sync:: Arc ;
20
17
21
18
use super :: print:: PrettyPrinter ;
22
19
use super :: { GenericArg , GenericArgKind , Region } ;
@@ -457,21 +454,15 @@ impl<'tcx, T: DebugWithInfcx<TyCtxt<'tcx>>> DebugWithInfcx<TyCtxt<'tcx>> for ty:
457
454
// For things for which the type library provides traversal implementations
458
455
// for all Interners, we only need to provide a Lift implementation:
459
456
TrivialLiftImpls ! {
460
- ( ) ,
461
- bool ,
462
- usize ,
463
- u16 ,
464
- u32 ,
465
- u64 ,
466
- String ,
467
- rustc_type_ir:: DebruijnIndex ,
468
- }
469
-
470
- // For things about which the type library does not know, or does not
471
- // provide any traversal implementations, we need to provide both a Lift
472
- // implementation and traversal implementations (the latter only for
473
- // TyCtxt<'_> interners).
474
- TrivialTypeTraversalAndLiftImpls ! {
457
+ ( ) ,
458
+ bool ,
459
+ usize ,
460
+ }
461
+
462
+ // For some things about which the type library does not know, or does not
463
+ // provide any traversal implementations, we need to provide a traversal
464
+ // implementation (only for TyCtxt<'_> interners).
465
+ TrivialTypeTraversalImpls ! {
475
466
:: rustc_target:: abi:: FieldIdx ,
476
467
:: rustc_target:: abi:: VariantIdx ,
477
468
crate :: middle:: region:: Scope ,
@@ -481,14 +472,10 @@ TrivialTypeTraversalAndLiftImpls! {
481
472
:: rustc_ast:: NodeId ,
482
473
:: rustc_span:: symbol:: Symbol ,
483
474
:: rustc_hir:: def:: Res ,
484
- :: rustc_hir:: def_id:: DefId ,
485
475
:: rustc_hir:: def_id:: LocalDefId ,
486
476
:: rustc_hir:: HirId ,
487
477
:: rustc_hir:: MatchSource ,
488
- :: rustc_hir:: Mutability ,
489
- :: rustc_hir:: Unsafety ,
490
478
:: rustc_target:: asm:: InlineAsmRegOrRegClass ,
491
- :: rustc_target:: spec:: abi:: Abi ,
492
479
crate :: mir:: coverage:: CounterId ,
493
480
crate :: mir:: coverage:: ExpressionId ,
494
481
crate :: mir:: coverage:: MappedExpressionIndex ,
@@ -506,50 +493,43 @@ TrivialTypeTraversalAndLiftImpls! {
506
493
crate :: ty:: AssocItem ,
507
494
crate :: ty:: AssocKind ,
508
495
crate :: ty:: AliasKind ,
509
- crate :: ty:: AliasRelationDirection ,
510
496
crate :: ty:: Placeholder <crate :: ty:: BoundRegion >,
511
497
crate :: ty:: Placeholder <crate :: ty:: BoundTy >,
512
498
crate :: ty:: Placeholder <ty:: BoundVar >,
513
- crate :: ty:: ClosureKind ,
514
499
crate :: ty:: FreeRegion ,
515
500
crate :: ty:: InferTy ,
516
501
crate :: ty:: IntVarValue ,
517
- crate :: ty:: ParamConst ,
518
- crate :: ty:: ParamTy ,
519
502
crate :: ty:: adjustment:: PointerCoercion ,
520
503
crate :: ty:: RegionVid ,
521
504
crate :: ty:: UniverseIndex ,
522
505
crate :: ty:: Variance ,
523
506
:: rustc_span:: Span ,
524
507
:: rustc_span:: symbol:: Ident ,
525
508
:: rustc_errors:: ErrorGuaranteed ,
526
- interpret:: Scalar ,
527
- interpret:: AllocId ,
528
- rustc_target:: abi:: Size ,
529
509
ty:: BoundVar ,
510
+ ty:: ValTree <' tcx>,
530
511
}
531
-
512
+ // For some things about which the type library does not know, or does not
513
+ // provide any traversal implementations, we need to provide a traversal
514
+ // implementation and a lift implementation (the former only for TyCtxt<'_>
515
+ // interners).
532
516
TrivialTypeTraversalAndLiftImpls ! {
533
- ty:: ValTree <' tcx>,
517
+ :: rustc_hir:: def_id:: DefId ,
518
+ :: rustc_hir:: Mutability ,
519
+ :: rustc_hir:: Unsafety ,
520
+ :: rustc_target:: spec:: abi:: Abi ,
521
+ crate :: ty:: AliasRelationDirection ,
522
+ crate :: ty:: ClosureKind ,
523
+ crate :: ty:: ParamConst ,
524
+ crate :: ty:: ParamTy ,
525
+ interpret:: Scalar ,
526
+ interpret:: AllocId ,
527
+ rustc_target:: abi:: Size ,
534
528
}
535
529
536
530
///////////////////////////////////////////////////////////////////////////
537
531
// Lift implementations
538
532
539
- impl < ' tcx , A : Lift < ' tcx > , B : Lift < ' tcx > > Lift < ' tcx > for ( A , B ) {
540
- type Lifted = ( A :: Lifted , B :: Lifted ) ;
541
- fn lift_to_tcx ( self , tcx : TyCtxt < ' tcx > ) -> Option < Self :: Lifted > {
542
- Some ( ( tcx. lift ( self . 0 ) ?, tcx. lift ( self . 1 ) ?) )
543
- }
544
- }
545
-
546
- impl < ' tcx , A : Lift < ' tcx > , B : Lift < ' tcx > , C : Lift < ' tcx > > Lift < ' tcx > for ( A , B , C ) {
547
- type Lifted = ( A :: Lifted , B :: Lifted , C :: Lifted ) ;
548
- fn lift_to_tcx ( self , tcx : TyCtxt < ' tcx > ) -> Option < Self :: Lifted > {
549
- Some ( ( tcx. lift ( self . 0 ) ?, tcx. lift ( self . 1 ) ?, tcx. lift ( self . 2 ) ?) )
550
- }
551
- }
552
-
553
533
impl < ' tcx , T : Lift < ' tcx > > Lift < ' tcx > for Option < T > {
554
534
type Lifted = Option < T :: Lifted > ;
555
535
fn lift_to_tcx ( self , tcx : TyCtxt < ' tcx > ) -> Option < Self :: Lifted > {
@@ -560,50 +540,6 @@ impl<'tcx, T: Lift<'tcx>> Lift<'tcx> for Option<T> {
560
540
}
561
541
}
562
542
563
- impl < ' tcx , T : Lift < ' tcx > , E : Lift < ' tcx > > Lift < ' tcx > for Result < T , E > {
564
- type Lifted = Result < T :: Lifted , E :: Lifted > ;
565
- fn lift_to_tcx ( self , tcx : TyCtxt < ' tcx > ) -> Option < Self :: Lifted > {
566
- match self {
567
- Ok ( x) => tcx. lift ( x) . map ( Ok ) ,
568
- Err ( e) => tcx. lift ( e) . map ( Err ) ,
569
- }
570
- }
571
- }
572
-
573
- impl < ' tcx , T : Lift < ' tcx > > Lift < ' tcx > for Box < T > {
574
- type Lifted = Box < T :: Lifted > ;
575
- fn lift_to_tcx ( self , tcx : TyCtxt < ' tcx > ) -> Option < Self :: Lifted > {
576
- Some ( Box :: new ( tcx. lift ( * self ) ?) )
577
- }
578
- }
579
-
580
- impl < ' tcx , T : Lift < ' tcx > + Clone > Lift < ' tcx > for Rc < T > {
581
- type Lifted = Rc < T :: Lifted > ;
582
- fn lift_to_tcx ( self , tcx : TyCtxt < ' tcx > ) -> Option < Self :: Lifted > {
583
- Some ( Rc :: new ( tcx. lift ( self . as_ref ( ) . clone ( ) ) ?) )
584
- }
585
- }
586
-
587
- impl < ' tcx , T : Lift < ' tcx > + Clone > Lift < ' tcx > for Arc < T > {
588
- type Lifted = Arc < T :: Lifted > ;
589
- fn lift_to_tcx ( self , tcx : TyCtxt < ' tcx > ) -> Option < Self :: Lifted > {
590
- Some ( Arc :: new ( tcx. lift ( self . as_ref ( ) . clone ( ) ) ?) )
591
- }
592
- }
593
- impl < ' tcx , T : Lift < ' tcx > > Lift < ' tcx > for Vec < T > {
594
- type Lifted = Vec < T :: Lifted > ;
595
- fn lift_to_tcx ( self , tcx : TyCtxt < ' tcx > ) -> Option < Self :: Lifted > {
596
- self . into_iter ( ) . map ( |v| tcx. lift ( v) ) . collect ( )
597
- }
598
- }
599
-
600
- impl < ' tcx , I : Idx , T : Lift < ' tcx > > Lift < ' tcx > for IndexVec < I , T > {
601
- type Lifted = IndexVec < I , T :: Lifted > ;
602
- fn lift_to_tcx ( self , tcx : TyCtxt < ' tcx > ) -> Option < Self :: Lifted > {
603
- self . into_iter ( ) . map ( |e| tcx. lift ( e) ) . collect ( )
604
- }
605
- }
606
-
607
543
impl < ' a , ' tcx > Lift < ' tcx > for Term < ' a > {
608
544
type Lifted = ty:: Term < ' tcx > ;
609
545
fn lift_to_tcx ( self , tcx : TyCtxt < ' tcx > ) -> Option < Self :: Lifted > {
@@ -616,13 +552,6 @@ impl<'a, 'tcx> Lift<'tcx> for Term<'a> {
616
552
)
617
553
}
618
554
}
619
- impl < ' a , ' tcx > Lift < ' tcx > for ty:: ParamEnv < ' a > {
620
- type Lifted = ty:: ParamEnv < ' tcx > ;
621
- fn lift_to_tcx ( self , tcx : TyCtxt < ' tcx > ) -> Option < Self :: Lifted > {
622
- tcx. lift ( self . caller_bounds ( ) )
623
- . map ( |caller_bounds| ty:: ParamEnv :: new ( caller_bounds, self . reveal ( ) ) )
624
- }
625
- }
626
555
627
556
///////////////////////////////////////////////////////////////////////////
628
557
// Traversal implementations.
0 commit comments