@@ -1482,7 +1482,7 @@ impl<'a: 'ast, 'b, 'ast, 'tcx> LateResolutionVisitor<'a, 'b, 'ast, 'tcx> {
14821482 if let Some ( & ( _, res) ) = rib. bindings . get ( & normalized_ident) {
14831483 self . record_lifetime_res ( lifetime. id , res, LifetimeElisionCandidate :: Named ) ;
14841484
1485- if let LifetimeRes :: Param { param, .. } = res {
1485+ if let LifetimeRes :: Param { param, binder } = res {
14861486 match self . lifetime_uses . entry ( param) {
14871487 Entry :: Vacant ( v) => {
14881488 debug ! ( "First use of {:?} at {:?}" , res, ident. span) ;
@@ -1496,10 +1496,16 @@ impl<'a: 'ast, 'b, 'ast, 'tcx> LateResolutionVisitor<'a, 'b, 'ast, 'tcx> {
14961496 LifetimeRibKind :: Item
14971497 | LifetimeRibKind :: AnonymousReportError
14981498 | LifetimeRibKind :: ElisionFailure => Some ( LifetimeUseSet :: Many ) ,
1499- // An anonymous lifetime is legal here, go ahead.
1500- LifetimeRibKind :: AnonymousCreateParameter { .. } => {
1501- Some ( LifetimeUseSet :: One { use_span : ident. span , use_ctxt } )
1502- }
1499+ // An anonymous lifetime is legal here, and bound to the right
1500+ // place, go ahead.
1501+ LifetimeRibKind :: AnonymousCreateParameter {
1502+ binder : anon_binder,
1503+ ..
1504+ } => Some ( if binder == anon_binder {
1505+ LifetimeUseSet :: One { use_span : ident. span , use_ctxt }
1506+ } else {
1507+ LifetimeUseSet :: Many
1508+ } ) ,
15031509 // Only report if eliding the lifetime would have the same
15041510 // semantics.
15051511 LifetimeRibKind :: Elided ( r) => Some ( if res == r {
0 commit comments