@@ -869,11 +869,9 @@ impl<'ast, 'ra, 'tcx> Visitor<'ast> for LateResolutionVisitor<'_, 'ast, 'ra, 'tc
869
869
self . with_generic_param_rib (
870
870
& [ ] ,
871
871
RibKind :: Normal ,
872
- LifetimeRibKind :: Generics {
873
- binder : ty. id ,
874
- kind : LifetimeBinderKind :: PolyTrait ,
875
- span,
876
- } ,
872
+ ty. id ,
873
+ LifetimeBinderKind :: PolyTrait ,
874
+ span,
877
875
|this| this. visit_path ( path) ,
878
876
) ;
879
877
} else {
@@ -907,11 +905,9 @@ impl<'ast, 'ra, 'tcx> Visitor<'ast> for LateResolutionVisitor<'_, 'ast, 'ra, 'tc
907
905
self . with_generic_param_rib (
908
906
& bare_fn. generic_params ,
909
907
RibKind :: Normal ,
910
- LifetimeRibKind :: Generics {
911
- binder : ty. id ,
912
- kind : LifetimeBinderKind :: BareFnType ,
913
- span,
914
- } ,
908
+ ty. id ,
909
+ LifetimeBinderKind :: BareFnType ,
910
+ span,
915
911
|this| {
916
912
this. visit_generic_params ( & bare_fn. generic_params , false ) ;
917
913
this. with_lifetime_rib (
@@ -942,11 +938,9 @@ impl<'ast, 'ra, 'tcx> Visitor<'ast> for LateResolutionVisitor<'_, 'ast, 'ra, 'tc
942
938
self . with_generic_param_rib (
943
939
& unsafe_binder. generic_params ,
944
940
RibKind :: Normal ,
945
- LifetimeRibKind :: Generics {
946
- binder : ty. id ,
947
- kind : LifetimeBinderKind :: BareFnType ,
948
- span,
949
- } ,
941
+ ty. id ,
942
+ LifetimeBinderKind :: BareFnType ,
943
+ span,
950
944
|this| {
951
945
this. visit_generic_params ( & unsafe_binder. generic_params , false ) ;
952
946
this. with_lifetime_rib (
@@ -995,11 +989,9 @@ impl<'ast, 'ra, 'tcx> Visitor<'ast> for LateResolutionVisitor<'_, 'ast, 'ra, 'tc
995
989
self . with_generic_param_rib (
996
990
& tref. bound_generic_params ,
997
991
RibKind :: Normal ,
998
- LifetimeRibKind :: Generics {
999
- binder : tref. trait_ref . ref_id ,
1000
- kind : LifetimeBinderKind :: PolyTrait ,
1001
- span,
1002
- } ,
992
+ tref. trait_ref . ref_id ,
993
+ LifetimeBinderKind :: PolyTrait ,
994
+ span,
1003
995
|this| {
1004
996
this. visit_generic_params ( & tref. bound_generic_params , false ) ;
1005
997
this. smart_resolve_path (
@@ -1020,23 +1012,19 @@ impl<'ast, 'ra, 'tcx> Visitor<'ast> for LateResolutionVisitor<'_, 'ast, 'ra, 'tc
1020
1012
self . with_generic_param_rib (
1021
1013
& generics. params ,
1022
1014
RibKind :: Item ( HasGenericParams :: Yes ( generics. span ) , def_kind) ,
1023
- LifetimeRibKind :: Generics {
1024
- binder : foreign_item. id ,
1025
- kind : LifetimeBinderKind :: Item ,
1026
- span : generics. span ,
1027
- } ,
1015
+ foreign_item. id ,
1016
+ LifetimeBinderKind :: Item ,
1017
+ generics. span ,
1028
1018
|this| visit:: walk_item ( this, foreign_item) ,
1029
1019
) ;
1030
1020
}
1031
1021
ForeignItemKind :: Fn ( box Fn { ref generics, .. } ) => {
1032
1022
self . with_generic_param_rib (
1033
1023
& generics. params ,
1034
1024
RibKind :: Item ( HasGenericParams :: Yes ( generics. span ) , def_kind) ,
1035
- LifetimeRibKind :: Generics {
1036
- binder : foreign_item. id ,
1037
- kind : LifetimeBinderKind :: Function ,
1038
- span : generics. span ,
1039
- } ,
1025
+ foreign_item. id ,
1026
+ LifetimeBinderKind :: Function ,
1027
+ generics. span ,
1040
1028
|this| visit:: walk_item ( this, foreign_item) ,
1041
1029
) ;
1042
1030
}
@@ -1374,11 +1362,9 @@ impl<'ast, 'ra, 'tcx> Visitor<'ast> for LateResolutionVisitor<'_, 'ast, 'ra, 'tc
1374
1362
this. with_generic_param_rib (
1375
1363
bound_generic_params,
1376
1364
RibKind :: Normal ,
1377
- LifetimeRibKind :: Generics {
1378
- binder : bounded_ty. id ,
1379
- kind : LifetimeBinderKind :: WhereBound ,
1380
- span,
1381
- } ,
1365
+ bounded_ty. id ,
1366
+ LifetimeBinderKind :: WhereBound ,
1367
+ span,
1382
1368
|this| {
1383
1369
this. visit_generic_params ( bound_generic_params, false ) ;
1384
1370
this. visit_ty ( bounded_ty) ;
@@ -2555,11 +2541,9 @@ impl<'a, 'ast, 'ra, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> {
2555
2541
this. with_generic_param_rib (
2556
2542
& generics. params ,
2557
2543
RibKind :: Item ( HasGenericParams :: Yes ( generics. span ) , kind) ,
2558
- LifetimeRibKind :: Generics {
2559
- binder : item. id ,
2560
- kind : LifetimeBinderKind :: Item ,
2561
- span : generics. span ,
2562
- } ,
2544
+ item. id ,
2545
+ LifetimeBinderKind :: Item ,
2546
+ generics. span ,
2563
2547
|this| {
2564
2548
let item_def_id = this. r . local_def_id ( item. id ) . to_def_id ( ) ;
2565
2549
this. with_self_rib (
@@ -2632,11 +2616,9 @@ impl<'a, 'ast, 'ra, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> {
2632
2616
self . with_generic_param_rib (
2633
2617
& generics. params ,
2634
2618
RibKind :: Item ( HasGenericParams :: Yes ( generics. span ) , def_kind) ,
2635
- LifetimeRibKind :: Generics {
2636
- binder : item. id ,
2637
- kind : LifetimeBinderKind :: Item ,
2638
- span : generics. span ,
2639
- } ,
2619
+ item. id ,
2620
+ LifetimeBinderKind :: Item ,
2621
+ generics. span ,
2640
2622
|this| visit:: walk_item ( this, item) ,
2641
2623
) ;
2642
2624
}
@@ -2645,11 +2627,9 @@ impl<'a, 'ast, 'ra, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> {
2645
2627
self . with_generic_param_rib (
2646
2628
& generics. params ,
2647
2629
RibKind :: Item ( HasGenericParams :: Yes ( generics. span ) , def_kind) ,
2648
- LifetimeRibKind :: Generics {
2649
- binder : item. id ,
2650
- kind : LifetimeBinderKind :: Function ,
2651
- span : generics. span ,
2652
- } ,
2630
+ item. id ,
2631
+ LifetimeBinderKind :: Function ,
2632
+ generics. span ,
2653
2633
|this| visit:: walk_item ( this, item) ,
2654
2634
) ;
2655
2635
self . resolve_define_opaques ( define_opaque) ;
@@ -2685,11 +2665,9 @@ impl<'a, 'ast, 'ra, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> {
2685
2665
self . with_generic_param_rib (
2686
2666
& generics. params ,
2687
2667
RibKind :: Item ( HasGenericParams :: Yes ( generics. span ) , def_kind) ,
2688
- LifetimeRibKind :: Generics {
2689
- binder : item. id ,
2690
- kind : LifetimeBinderKind :: Item ,
2691
- span : generics. span ,
2692
- } ,
2668
+ item. id ,
2669
+ LifetimeBinderKind :: Item ,
2670
+ generics. span ,
2693
2671
|this| {
2694
2672
let local_def_id = this. r . local_def_id ( item. id ) . to_def_id ( ) ;
2695
2673
this. with_self_rib ( Res :: SelfTyParam { trait_ : local_def_id } , |this| {
@@ -2706,11 +2684,9 @@ impl<'a, 'ast, 'ra, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> {
2706
2684
self . with_generic_param_rib (
2707
2685
& generics. params ,
2708
2686
RibKind :: Item ( HasGenericParams :: Yes ( generics. span ) , def_kind) ,
2709
- LifetimeRibKind :: Generics {
2710
- binder : item. id ,
2711
- kind : LifetimeBinderKind :: Item ,
2712
- span : generics. span ,
2713
- } ,
2687
+ item. id ,
2688
+ LifetimeBinderKind :: Item ,
2689
+ generics. span ,
2714
2690
|this| {
2715
2691
let local_def_id = this. r . local_def_id ( item. id ) . to_def_id ( ) ;
2716
2692
this. with_self_rib ( Res :: SelfTyParam { trait_ : local_def_id } , |this| {
@@ -2776,11 +2752,9 @@ impl<'a, 'ast, 'ra, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> {
2776
2752
} ,
2777
2753
def_kind,
2778
2754
) ,
2779
- LifetimeRibKind :: Generics {
2780
- binder : item. id ,
2781
- kind : LifetimeBinderKind :: ConstItem ,
2782
- span : generics. span ,
2783
- } ,
2755
+ item. id ,
2756
+ LifetimeBinderKind :: ConstItem ,
2757
+ generics. span ,
2784
2758
|this| {
2785
2759
this. visit_generics ( generics) ;
2786
2760
@@ -2825,11 +2799,9 @@ impl<'a, 'ast, 'ra, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> {
2825
2799
self . with_generic_param_rib (
2826
2800
& [ ] ,
2827
2801
RibKind :: Item ( HasGenericParams :: Yes ( span) , def_kind) ,
2828
- LifetimeRibKind :: Generics {
2829
- binder : item. id ,
2830
- kind : LifetimeBinderKind :: Function ,
2831
- span,
2832
- } ,
2802
+ item. id ,
2803
+ LifetimeBinderKind :: Function ,
2804
+ span,
2833
2805
|this| this. resolve_delegation ( delegation) ,
2834
2806
) ;
2835
2807
}
@@ -2846,17 +2818,16 @@ impl<'a, 'ast, 'ra, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> {
2846
2818
& ' c mut self ,
2847
2819
params : & ' c [ GenericParam ] ,
2848
2820
kind : RibKind < ' ra > ,
2849
- lifetime_kind : LifetimeRibKind ,
2821
+ binder : NodeId ,
2822
+ generics_kind : LifetimeBinderKind ,
2823
+ generics_span : Span ,
2850
2824
f : F ,
2851
2825
) where
2852
2826
F : FnOnce ( & mut Self ) ,
2853
2827
{
2854
2828
debug ! ( "with_generic_param_rib" ) ;
2855
- let LifetimeRibKind :: Generics { binder, span : generics_span, kind : generics_kind, .. } =
2856
- lifetime_kind
2857
- else {
2858
- panic ! ( )
2859
- } ;
2829
+ let lifetime_kind =
2830
+ LifetimeRibKind :: Generics { binder, span : generics_span, kind : generics_kind } ;
2860
2831
2861
2832
let mut function_type_rib = Rib :: new ( kind) ;
2862
2833
let mut function_value_rib = Rib :: new ( kind) ;
@@ -3086,7 +3057,9 @@ impl<'a, 'ast, 'ra, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> {
3086
3057
this. with_generic_param_rib (
3087
3058
& generics. params ,
3088
3059
RibKind :: AssocItem ,
3089
- LifetimeRibKind :: Generics { binder : item. id , span : generics. span , kind } ,
3060
+ item. id ,
3061
+ kind,
3062
+ generics. span ,
3090
3063
|this| visit:: walk_assoc_item ( this, item, AssocCtxt :: Trait ) ,
3091
3064
) ;
3092
3065
} ;
@@ -3104,11 +3077,9 @@ impl<'a, 'ast, 'ra, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> {
3104
3077
self . with_generic_param_rib (
3105
3078
& generics. params ,
3106
3079
RibKind :: AssocItem ,
3107
- LifetimeRibKind :: Generics {
3108
- binder : item. id ,
3109
- span : generics. span ,
3110
- kind : LifetimeBinderKind :: ConstItem ,
3111
- } ,
3080
+ item. id ,
3081
+ LifetimeBinderKind :: ConstItem ,
3082
+ generics. span ,
3112
3083
|this| {
3113
3084
this. with_lifetime_rib (
3114
3085
LifetimeRibKind :: StaticIfNoLifetimeInScope {
@@ -3145,11 +3116,9 @@ impl<'a, 'ast, 'ra, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> {
3145
3116
self . with_generic_param_rib (
3146
3117
& [ ] ,
3147
3118
RibKind :: AssocItem ,
3148
- LifetimeRibKind :: Generics {
3149
- binder : item. id ,
3150
- kind : LifetimeBinderKind :: Function ,
3151
- span : delegation. path . segments . last ( ) . unwrap ( ) . ident . span ,
3152
- } ,
3119
+ item. id ,
3120
+ LifetimeBinderKind :: Function ,
3121
+ delegation. path . segments . last ( ) . unwrap ( ) . ident . span ,
3153
3122
|this| this. resolve_delegation ( delegation) ,
3154
3123
) ;
3155
3124
}
@@ -3227,11 +3196,9 @@ impl<'a, 'ast, 'ra, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> {
3227
3196
self . with_generic_param_rib (
3228
3197
& generics. params ,
3229
3198
RibKind :: Item ( HasGenericParams :: Yes ( generics. span ) , self . r . local_def_kind ( item_id) ) ,
3230
- LifetimeRibKind :: Generics {
3231
- span : generics. span ,
3232
- binder : item_id,
3233
- kind : LifetimeBinderKind :: ImplBlock ,
3234
- } ,
3199
+ item_id,
3200
+ LifetimeBinderKind :: ImplBlock ,
3201
+ generics. span ,
3235
3202
|this| {
3236
3203
// Dummy self type for better errors if `Self` is used in the trait path.
3237
3204
this. with_self_rib ( Res :: SelfTyParam { trait_ : LOCAL_CRATE . as_def_id ( ) } , |this| {
@@ -3316,15 +3283,14 @@ impl<'a, 'ast, 'ra, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> {
3316
3283
self . with_generic_param_rib (
3317
3284
& generics. params ,
3318
3285
RibKind :: AssocItem ,
3319
- LifetimeRibKind :: Generics {
3320
- binder : item. id ,
3321
- span : generics. span ,
3322
- kind : LifetimeBinderKind :: ConstItem ,
3323
- } ,
3286
+ item. id ,
3287
+ LifetimeBinderKind :: ConstItem ,
3288
+ generics. span ,
3324
3289
|this| {
3325
3290
this. with_lifetime_rib (
3326
- // Until these are a hard error, we need to create them within the correct binder,
3327
- // Otherwise the lifetimes of this assoc const think they are lifetimes of the trait.
3291
+ // Until these are a hard error, we need to create them within the
3292
+ // correct binder, Otherwise the lifetimes of this assoc const think
3293
+ // they are lifetimes of the trait.
3328
3294
LifetimeRibKind :: AnonymousCreateParameter {
3329
3295
binder : item. id ,
3330
3296
report_in_path : true ,
@@ -3373,11 +3339,9 @@ impl<'a, 'ast, 'ra, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> {
3373
3339
self . with_generic_param_rib (
3374
3340
& generics. params ,
3375
3341
RibKind :: AssocItem ,
3376
- LifetimeRibKind :: Generics {
3377
- binder : item. id ,
3378
- span : generics. span ,
3379
- kind : LifetimeBinderKind :: Function ,
3380
- } ,
3342
+ item. id ,
3343
+ LifetimeBinderKind :: Function ,
3344
+ generics. span ,
3381
3345
|this| {
3382
3346
// If this is a trait impl, ensure the method
3383
3347
// exists in trait
@@ -3404,11 +3368,9 @@ impl<'a, 'ast, 'ra, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> {
3404
3368
self . with_generic_param_rib (
3405
3369
& generics. params ,
3406
3370
RibKind :: AssocItem ,
3407
- LifetimeRibKind :: Generics {
3408
- binder : item. id ,
3409
- span : generics. span ,
3410
- kind : LifetimeBinderKind :: Item ,
3411
- } ,
3371
+ item. id ,
3372
+ LifetimeBinderKind :: Item ,
3373
+ generics. span ,
3412
3374
|this| {
3413
3375
this. with_lifetime_rib ( LifetimeRibKind :: AnonymousReportError , |this| {
3414
3376
// If this is a trait impl, ensure the type
@@ -3434,11 +3396,9 @@ impl<'a, 'ast, 'ra, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> {
3434
3396
self . with_generic_param_rib (
3435
3397
& [ ] ,
3436
3398
RibKind :: AssocItem ,
3437
- LifetimeRibKind :: Generics {
3438
- binder : item. id ,
3439
- kind : LifetimeBinderKind :: Function ,
3440
- span : delegation. path . segments . last ( ) . unwrap ( ) . ident . span ,
3441
- } ,
3399
+ item. id ,
3400
+ LifetimeBinderKind :: Function ,
3401
+ delegation. path . segments . last ( ) . unwrap ( ) . ident . span ,
3442
3402
|this| {
3443
3403
this. check_trait_item (
3444
3404
item. id ,
@@ -4951,11 +4911,9 @@ impl<'a, 'ast, 'ra, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> {
4951
4911
self . with_generic_param_rib (
4952
4912
generic_params,
4953
4913
RibKind :: Normal ,
4954
- LifetimeRibKind :: Generics {
4955
- binder : expr. id ,
4956
- kind : LifetimeBinderKind :: Closure ,
4957
- span,
4958
- } ,
4914
+ expr. id ,
4915
+ LifetimeBinderKind :: Closure ,
4916
+ span,
4959
4917
|this| visit:: walk_expr ( this, expr) ,
4960
4918
) ;
4961
4919
}
0 commit comments