@@ -16,7 +16,7 @@ use rustc_errors::ErrorGuaranteed;
16
16
use rustc_hir:: def:: { DefKind , Res } ;
17
17
use rustc_hir:: intravisit:: { self , InferKind , Visitor , VisitorExt } ;
18
18
use rustc_hir:: {
19
- self as hir, AmbigArg , GenericArg , GenericParam , GenericParamKind , HirId , LifetimeName , Node ,
19
+ self as hir, AmbigArg , GenericArg , GenericParam , GenericParamKind , HirId , LifetimeKind , Node ,
20
20
} ;
21
21
use rustc_macros:: extension;
22
22
use rustc_middle:: hir:: nested_filter;
@@ -646,14 +646,14 @@ impl<'a, 'tcx> Visitor<'tcx> for BoundVarContext<'a, 'tcx> {
646
646
arg : & ' tcx hir:: PreciseCapturingArg < ' tcx > ,
647
647
) -> Self :: Result {
648
648
match * arg {
649
- hir:: PreciseCapturingArg :: Lifetime ( lt) => match lt. res {
650
- LifetimeName :: Param ( def_id) => {
649
+ hir:: PreciseCapturingArg :: Lifetime ( lt) => match lt. kind {
650
+ LifetimeKind :: Param ( def_id) => {
651
651
self . resolve_lifetime_ref ( def_id, lt) ;
652
652
}
653
- LifetimeName :: Error => { }
654
- LifetimeName :: ImplicitObjectLifetimeDefault
655
- | LifetimeName :: Infer
656
- | LifetimeName :: Static => {
653
+ LifetimeKind :: Error => { }
654
+ LifetimeKind :: ImplicitObjectLifetimeDefault
655
+ | LifetimeKind :: Infer
656
+ | LifetimeKind :: Static => {
657
657
self . tcx . dcx ( ) . emit_err ( errors:: BadPreciseCapture {
658
658
span : lt. ident . span ,
659
659
kind : "lifetime" ,
@@ -774,26 +774,26 @@ impl<'a, 'tcx> Visitor<'tcx> for BoundVarContext<'a, 'tcx> {
774
774
) ;
775
775
}
776
776
} ) ;
777
- match lifetime. res {
778
- LifetimeName :: ImplicitObjectLifetimeDefault => {
777
+ match lifetime. kind {
778
+ LifetimeKind :: ImplicitObjectLifetimeDefault => {
779
779
// If the user does not write *anything*, we
780
780
// use the object lifetime defaulting
781
781
// rules. So e.g., `Box<dyn Debug>` becomes
782
782
// `Box<dyn Debug + 'static>`.
783
783
self . resolve_object_lifetime_default ( & * lifetime)
784
784
}
785
- LifetimeName :: Infer => {
785
+ LifetimeKind :: Infer => {
786
786
// If the user writes `'_`, we use the *ordinary* elision
787
787
// rules. So the `'_` in e.g., `Box<dyn Debug + '_>` will be
788
788
// resolved the same as the `'_` in `&'_ Foo`.
789
789
//
790
790
// cc #48468
791
791
}
792
- LifetimeName :: Param ( ..) | LifetimeName :: Static => {
792
+ LifetimeKind :: Param ( ..) | LifetimeKind :: Static => {
793
793
// If the user wrote an explicit name, use that.
794
794
self . visit_lifetime ( & * lifetime) ;
795
795
}
796
- LifetimeName :: Error => { }
796
+ LifetimeKind :: Error => { }
797
797
}
798
798
}
799
799
hir:: TyKind :: Ref ( lifetime_ref, ref mt) => {
@@ -873,17 +873,17 @@ impl<'a, 'tcx> Visitor<'tcx> for BoundVarContext<'a, 'tcx> {
873
873
874
874
#[ instrument( level = "debug" , skip( self ) ) ]
875
875
fn visit_lifetime ( & mut self , lifetime_ref : & ' tcx hir:: Lifetime ) {
876
- match lifetime_ref. res {
877
- hir:: LifetimeName :: Static => {
876
+ match lifetime_ref. kind {
877
+ hir:: LifetimeKind :: Static => {
878
878
self . insert_lifetime ( lifetime_ref, ResolvedArg :: StaticLifetime )
879
879
}
880
- hir:: LifetimeName :: Param ( param_def_id) => {
880
+ hir:: LifetimeKind :: Param ( param_def_id) => {
881
881
self . resolve_lifetime_ref ( param_def_id, lifetime_ref)
882
882
}
883
883
// If we've already reported an error, just ignore `lifetime_ref`.
884
- hir:: LifetimeName :: Error => { }
884
+ hir:: LifetimeKind :: Error => { }
885
885
// Those will be resolved by typechecking.
886
- hir:: LifetimeName :: ImplicitObjectLifetimeDefault | hir:: LifetimeName :: Infer => { }
886
+ hir:: LifetimeKind :: ImplicitObjectLifetimeDefault | hir:: LifetimeKind :: Infer => { }
887
887
}
888
888
}
889
889
@@ -1063,15 +1063,15 @@ fn object_lifetime_default(tcx: TyCtxt<'_>, param_def_id: LocalDefId) -> ObjectL
1063
1063
1064
1064
for bound in bound. bounds {
1065
1065
if let hir:: GenericBound :: Outlives ( lifetime) = bound {
1066
- set. insert ( lifetime. res ) ;
1066
+ set. insert ( lifetime. kind ) ;
1067
1067
}
1068
1068
}
1069
1069
}
1070
1070
1071
1071
match set {
1072
1072
Set1 :: Empty => ObjectLifetimeDefault :: Empty ,
1073
- Set1 :: One ( hir:: LifetimeName :: Static ) => ObjectLifetimeDefault :: Static ,
1074
- Set1 :: One ( hir:: LifetimeName :: Param ( param_def_id) ) => {
1073
+ Set1 :: One ( hir:: LifetimeKind :: Static ) => ObjectLifetimeDefault :: Static ,
1074
+ Set1 :: One ( hir:: LifetimeKind :: Param ( param_def_id) ) => {
1075
1075
ObjectLifetimeDefault :: Param ( param_def_id. to_def_id ( ) )
1076
1076
}
1077
1077
_ => ObjectLifetimeDefault :: Ambiguous ,
@@ -1241,7 +1241,7 @@ impl<'a, 'tcx> BoundVarContext<'a, 'tcx> {
1241
1241
// Fresh lifetimes in APIT used to be allowed in async fns and forbidden in
1242
1242
// regular fns.
1243
1243
if let Some ( hir:: PredicateOrigin :: ImplTrait ) = where_bound_origin
1244
- && let hir:: LifetimeName :: Param ( param_id) = lifetime_ref. res
1244
+ && let hir:: LifetimeKind :: Param ( param_id) = lifetime_ref. kind
1245
1245
&& let Some ( generics) =
1246
1246
self . tcx . hir_get_generics ( self . tcx . local_parent ( param_id) )
1247
1247
&& let Some ( param) = generics. params . iter ( ) . find ( |p| p. def_id == param_id)
@@ -2440,7 +2440,7 @@ fn is_late_bound_map(
2440
2440
}
2441
2441
2442
2442
fn visit_lifetime ( & mut self , lifetime_ref : & ' v hir:: Lifetime ) {
2443
- if let hir:: LifetimeName :: Param ( def_id) = lifetime_ref. res {
2443
+ if let hir:: LifetimeKind :: Param ( def_id) = lifetime_ref. kind {
2444
2444
self . regions . insert ( def_id) ;
2445
2445
}
2446
2446
}
@@ -2453,7 +2453,7 @@ fn is_late_bound_map(
2453
2453
2454
2454
impl < ' tcx > Visitor < ' tcx > for AllCollector {
2455
2455
fn visit_lifetime ( & mut self , lifetime_ref : & ' tcx hir:: Lifetime ) {
2456
- if let hir:: LifetimeName :: Param ( def_id) = lifetime_ref. res {
2456
+ if let hir:: LifetimeKind :: Param ( def_id) = lifetime_ref. kind {
2457
2457
self . regions . insert ( def_id) ;
2458
2458
}
2459
2459
}
0 commit comments