@@ -9,8 +9,8 @@ use rustc_hir::intravisit::{
9
9
use rustc_hir:: FnRetTy :: Return ;
10
10
use rustc_hir:: {
11
11
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 ,
14
14
} ;
15
15
use rustc_lint:: { LateContext , LateLintPass } ;
16
16
use rustc_middle:: hir:: nested_filter as middle_nested_filter;
@@ -338,7 +338,10 @@ fn could_use_elision<'tcx>(
338
338
fn allowed_lts_from ( named_generics : & [ GenericParam < ' _ > ] ) -> FxHashSet < RefLt > {
339
339
let mut allowed_lts = FxHashSet :: default ( ) ;
340
340
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
+ {
342
345
allowed_lts. insert ( RefLt :: Named ( par. name . ident ( ) . name ) ) ;
343
346
}
344
347
}
@@ -379,6 +382,7 @@ impl<'a, 'tcx> RefVisitor<'a, 'tcx> {
379
382
self . lts . push ( RefLt :: Static ) ;
380
383
} else if let LifetimeName :: Param ( _, ParamName :: Fresh ) = lt. name {
381
384
// Fresh lifetimes generated should be ignored.
385
+ self . lts . push ( RefLt :: Unnamed ) ;
382
386
} else if lt. is_elided ( ) {
383
387
self . lts . push ( RefLt :: Unnamed ) ;
384
388
} else {
0 commit comments