@@ -9,8 +9,8 @@ use rustc_hir::intravisit::{
99use rustc_hir:: FnRetTy :: Return ;
1010use rustc_hir:: {
1111 BareFnTy , BodyId , FnDecl , GenericArg , GenericBound , GenericParam , GenericParamKind , Generics , Impl , ImplItem ,
12- ImplItemKind , Item , ItemKind , LangItem , Lifetime , LifetimeName , ParamName , PolyTraitRef , PredicateOrigin ,
13- TraitBoundModifier , TraitFn , TraitItem , TraitItemKind , Ty , TyKind , WherePredicate ,
12+ ImplItemKind , Item , ItemKind , LangItem , Lifetime , LifetimeName , LifetimeParamKind , ParamName , PolyTraitRef ,
13+ PredicateOrigin , TraitBoundModifier , TraitFn , TraitItem , TraitItemKind , Ty , TyKind , WherePredicate ,
1414} ;
1515use rustc_lint:: { LateContext , LateLintPass } ;
1616use rustc_middle:: hir:: nested_filter as middle_nested_filter;
@@ -338,7 +338,10 @@ fn could_use_elision<'tcx>(
338338fn allowed_lts_from ( named_generics : & [ GenericParam < ' _ > ] ) -> FxHashSet < RefLt > {
339339 let mut allowed_lts = FxHashSet :: default ( ) ;
340340 for par in named_generics. iter ( ) {
341- if let GenericParamKind :: Lifetime { .. } = par. kind {
341+ if let GenericParamKind :: Lifetime {
342+ kind : LifetimeParamKind :: Explicit ,
343+ } = par. kind
344+ {
342345 allowed_lts. insert ( RefLt :: Named ( par. name . ident ( ) . name ) ) ;
343346 }
344347 }
@@ -379,6 +382,7 @@ impl<'a, 'tcx> RefVisitor<'a, 'tcx> {
379382 self . lts . push ( RefLt :: Static ) ;
380383 } else if let LifetimeName :: Param ( _, ParamName :: Fresh ) = lt. name {
381384 // Fresh lifetimes generated should be ignored.
385+ self . lts . push ( RefLt :: Unnamed ) ;
382386 } else if lt. is_elided ( ) {
383387 self . lts . push ( RefLt :: Unnamed ) ;
384388 } else {
0 commit comments