@@ -55,7 +55,7 @@ use rustc_hir::definitions::PerParentDisambiguatorState;
5555use rustc_hir:: lints:: DelayedLint ;
5656use rustc_hir:: {
5757 self as hir, AngleBrackets , ConstArg , GenericArg , HirId , ItemLocalMap , LifetimeSource ,
58- LifetimeSyntax , ParamName , Target , TraitCandidate , find_attr,
58+ LifetimeSyntax , MissingLifetimeKind , ParamName , Target , TraitCandidate , find_attr,
5959} ;
6060use rustc_index:: { Idx , IndexSlice , IndexVec } ;
6161use rustc_macros:: extension;
@@ -310,7 +310,7 @@ impl<'tcx> ResolverAstLowering<'tcx> {
310310 ///
311311 /// The extra lifetimes that appear from the parenthesized `Fn`-trait desugaring
312312 /// should appear at the enclosing `PolyTraitRef`.
313- fn extra_lifetime_params ( & self , id : NodeId ) -> & [ ( Ident , NodeId , LifetimeRes ) ] {
313+ fn extra_lifetime_params ( & self , id : NodeId ) -> & [ ( Ident , NodeId , MissingLifetimeKind ) ] {
314314 self . extra_lifetime_params_map . get ( & id) . map_or ( & [ ] , |v| & v[ ..] )
315315 }
316316
@@ -542,7 +542,7 @@ pub fn lower_to_hir(tcx: TyCtxt<'_>, (): ()) -> mid_hir::Crate<'_> {
542542 let ast_index = index_crate ( & resolver, & krate) ;
543543 let mut owners = IndexVec :: from_fn_n (
544544 |_| hir:: MaybeOwner :: Phantom ,
545- tcx. definitions_untracked ( ) . def_index_count ( ) ,
545+ tcx. definitions_untracked ( ) . num_definitions ( ) ,
546546 ) ;
547547
548548 let mut lowerer = item:: ItemLowerer {
@@ -948,43 +948,30 @@ impl<'hir> LoweringContext<'_, 'hir> {
948948 & mut self ,
949949 ident : Ident ,
950950 node_id : NodeId ,
951- res : LifetimeRes ,
951+ kind : MissingLifetimeKind ,
952952 source : hir:: GenericParamSource ,
953- ) -> Option < hir:: GenericParam < ' hir > > {
954- let ( name, kind) = match res {
955- LifetimeRes :: Param { .. } => {
956- ( hir:: ParamName :: Plain ( ident) , hir:: LifetimeParamKind :: Explicit )
957- }
958- LifetimeRes :: Fresh { param, kind, .. } => {
959- // Late resolution delegates to us the creation of the `LocalDefId`.
960- let _def_id = self . create_def (
961- param,
962- Some ( kw:: UnderscoreLifetime ) ,
963- DefKind :: LifetimeParam ,
964- ident. span ,
965- ) ;
966- debug ! ( ?_def_id) ;
953+ ) -> hir:: GenericParam < ' hir > {
954+ // Late resolution delegates to us the creation of the `LocalDefId`.
955+ let _def_id = self . create_def (
956+ node_id,
957+ Some ( kw:: UnderscoreLifetime ) ,
958+ DefKind :: LifetimeParam ,
959+ ident. span ,
960+ ) ;
961+ debug ! ( ?_def_id) ;
967962
968- ( hir:: ParamName :: Fresh , hir:: LifetimeParamKind :: Elided ( kind) )
969- }
970- LifetimeRes :: Static { .. } | LifetimeRes :: Error ( ..) => return None ,
971- res => panic ! (
972- "Unexpected lifetime resolution {:?} for {:?} at {:?}" ,
973- res, ident, ident. span
974- ) ,
975- } ;
976963 let hir_id = self . lower_node_id ( node_id) ;
977964 let def_id = self . local_def_id ( node_id) ;
978- Some ( hir:: GenericParam {
965+ hir:: GenericParam {
979966 hir_id,
980967 def_id,
981- name,
968+ name : hir :: ParamName :: Fresh ,
982969 span : self . lower_span ( ident. span ) ,
983970 pure_wrt_drop : false ,
984- kind : hir:: GenericParamKind :: Lifetime { kind } ,
971+ kind : hir:: GenericParamKind :: Lifetime { kind : hir :: LifetimeParamKind :: Elided ( kind ) } ,
985972 colon_span : None ,
986973 source,
987- } )
974+ }
988975 }
989976
990977 /// Lowers a lifetime binder that defines `generic_params`, returning the corresponding HIR
@@ -1005,7 +992,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
1005992 debug ! ( ?extra_lifetimes) ;
1006993 let extra_lifetimes: Vec < _ > = extra_lifetimes
1007994 . iter ( )
1008- . filter_map ( |& ( ident, node_id, res) | {
995+ . map ( |& ( ident, node_id, res) | {
1009996 self . lifetime_res_to_generic_param (
1010997 ident,
1011998 node_id,
0 commit comments