@@ -16,7 +16,7 @@ use rustc_errors::ErrorGuaranteed;
1616use rustc_hir:: def:: { DefKind , Res } ;
1717use rustc_hir:: intravisit:: { self , InferKind , Visitor , VisitorExt } ;
1818use rustc_hir:: {
19- self as hir, AmbigArg , GenericArg , GenericParam , GenericParamKind , HirId , LifetimeName , Node ,
19+ self as hir, AmbigArg , GenericArg , GenericParam , GenericParamKind , HirId , LifetimeKind , Node ,
2020} ;
2121use rustc_macros:: extension;
2222use rustc_middle:: hir:: nested_filter;
@@ -646,14 +646,14 @@ impl<'a, 'tcx> Visitor<'tcx> for BoundVarContext<'a, 'tcx> {
646646 arg : & ' tcx hir:: PreciseCapturingArg < ' tcx > ,
647647 ) -> Self :: Result {
648648 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) => {
651651 self . resolve_lifetime_ref ( def_id, lt) ;
652652 }
653- LifetimeName :: Error => { }
654- LifetimeName :: ImplicitObjectLifetimeDefault
655- | LifetimeName :: Infer
656- | LifetimeName :: Static => {
653+ LifetimeKind :: Error => { }
654+ LifetimeKind :: ImplicitObjectLifetimeDefault
655+ | LifetimeKind :: Infer
656+ | LifetimeKind :: Static => {
657657 self . tcx . dcx ( ) . emit_err ( errors:: BadPreciseCapture {
658658 span : lt. ident . span ,
659659 kind : "lifetime" ,
@@ -774,26 +774,26 @@ impl<'a, 'tcx> Visitor<'tcx> for BoundVarContext<'a, 'tcx> {
774774 ) ;
775775 }
776776 } ) ;
777- match lifetime. res {
778- LifetimeName :: ImplicitObjectLifetimeDefault => {
777+ match lifetime. kind {
778+ LifetimeKind :: ImplicitObjectLifetimeDefault => {
779779 // If the user does not write *anything*, we
780780 // use the object lifetime defaulting
781781 // rules. So e.g., `Box<dyn Debug>` becomes
782782 // `Box<dyn Debug + 'static>`.
783783 self . resolve_object_lifetime_default ( & * lifetime)
784784 }
785- LifetimeName :: Infer => {
785+ LifetimeKind :: Infer => {
786786 // If the user writes `'_`, we use the *ordinary* elision
787787 // rules. So the `'_` in e.g., `Box<dyn Debug + '_>` will be
788788 // resolved the same as the `'_` in `&'_ Foo`.
789789 //
790790 // cc #48468
791791 }
792- LifetimeName :: Param ( ..) | LifetimeName :: Static => {
792+ LifetimeKind :: Param ( ..) | LifetimeKind :: Static => {
793793 // If the user wrote an explicit name, use that.
794794 self . visit_lifetime ( & * lifetime) ;
795795 }
796- LifetimeName :: Error => { }
796+ LifetimeKind :: Error => { }
797797 }
798798 }
799799 hir:: TyKind :: Ref ( lifetime_ref, ref mt) => {
@@ -873,17 +873,17 @@ impl<'a, 'tcx> Visitor<'tcx> for BoundVarContext<'a, 'tcx> {
873873
874874 #[ instrument( level = "debug" , skip( self ) ) ]
875875 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 => {
878878 self . insert_lifetime ( lifetime_ref, ResolvedArg :: StaticLifetime )
879879 }
880- hir:: LifetimeName :: Param ( param_def_id) => {
880+ hir:: LifetimeKind :: Param ( param_def_id) => {
881881 self . resolve_lifetime_ref ( param_def_id, lifetime_ref)
882882 }
883883 // If we've already reported an error, just ignore `lifetime_ref`.
884- hir:: LifetimeName :: Error => { }
884+ hir:: LifetimeKind :: Error => { }
885885 // Those will be resolved by typechecking.
886- hir:: LifetimeName :: ImplicitObjectLifetimeDefault | hir:: LifetimeName :: Infer => { }
886+ hir:: LifetimeKind :: ImplicitObjectLifetimeDefault | hir:: LifetimeKind :: Infer => { }
887887 }
888888 }
889889
@@ -1063,15 +1063,15 @@ fn object_lifetime_default(tcx: TyCtxt<'_>, param_def_id: LocalDefId) -> ObjectL
10631063
10641064 for bound in bound. bounds {
10651065 if let hir:: GenericBound :: Outlives ( lifetime) = bound {
1066- set. insert ( lifetime. res ) ;
1066+ set. insert ( lifetime. kind ) ;
10671067 }
10681068 }
10691069 }
10701070
10711071 match set {
10721072 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) ) => {
10751075 ObjectLifetimeDefault :: Param ( param_def_id. to_def_id ( ) )
10761076 }
10771077 _ => ObjectLifetimeDefault :: Ambiguous ,
@@ -1241,7 +1241,7 @@ impl<'a, 'tcx> BoundVarContext<'a, 'tcx> {
12411241 // Fresh lifetimes in APIT used to be allowed in async fns and forbidden in
12421242 // regular fns.
12431243 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
12451245 && let Some ( generics) =
12461246 self . tcx . hir_get_generics ( self . tcx . local_parent ( param_id) )
12471247 && let Some ( param) = generics. params . iter ( ) . find ( |p| p. def_id == param_id)
@@ -2440,7 +2440,7 @@ fn is_late_bound_map(
24402440 }
24412441
24422442 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 {
24442444 self . regions . insert ( def_id) ;
24452445 }
24462446 }
@@ -2453,7 +2453,7 @@ fn is_late_bound_map(
24532453
24542454 impl < ' tcx > Visitor < ' tcx > for AllCollector {
24552455 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 {
24572457 self . regions . insert ( def_id) ;
24582458 }
24592459 }
0 commit comments