@@ -2042,33 +2042,37 @@ impl<'a: 'ast, 'b, 'ast, 'tcx> LateResolutionVisitor<'a, 'b, 'ast, 'tcx> {
20422042
20432043 match candidate {
20442044 LifetimeElisionCandidate :: Missing ( missing) => {
2045- // FIXME: ICEs otherwise
2046- if missing. kind != MissingLifetimeKind :: Ampersand {
2047- match res {
2048- LifetimeRes :: Static => {
2045+ debug_assert_eq ! ( id, missing. id) ;
2046+ match res {
2047+ LifetimeRes :: Static => {
2048+ // FIXME: ICEs otherwise
2049+ if missing. kind != MissingLifetimeKind :: Ampersand {
20492050 self . r . lint_buffer . buffer_lint (
20502051 lint:: builtin:: ELIDED_NAMED_LIFETIMES ,
20512052 missing. id ,
20522053 missing. span ,
20532054 BuiltinLintDiag :: ElidedIsStatic { elided : missing. span } ,
20542055 ) ;
20552056 }
2056- LifetimeRes :: Param { param, binder : _ } => {
2057- self . r . lint_buffer . buffer_lint (
2058- lint:: builtin:: ELIDED_NAMED_LIFETIMES ,
2059- missing. id ,
2060- missing. span ,
2061- BuiltinLintDiag :: ElidedIsParam {
2062- elided : missing. span ,
2063- param : self . r . tcx ( ) . source_span ( param) ,
2064- } ,
2065- ) ;
2066- }
2067- LifetimeRes :: Fresh { .. }
2068- | LifetimeRes :: Infer
2069- | LifetimeRes :: Error
2070- | LifetimeRes :: ElidedAnchor { .. } => { }
20712057 }
2058+ LifetimeRes :: Param { param, binder } => {
2059+ self . r . lint_buffer . buffer_lint (
2060+ lint:: builtin:: ELIDED_NAMED_LIFETIMES ,
2061+ // HACK: we can't use `missing.id` instead of `binder` here,
2062+ // because for `missing.kind == Ampersand` it is a "fake" node that gets overlooked and its lints do not end up emitted.
2063+ // Alternatively, it might be possible to convert `param` to `NodeId` and use that instead.
2064+ binder,
2065+ missing. span ,
2066+ BuiltinLintDiag :: ElidedIsParam {
2067+ elided : missing. span ,
2068+ param : self . r . tcx ( ) . source_span ( param) ,
2069+ } ,
2070+ ) ;
2071+ }
2072+ LifetimeRes :: Fresh { .. }
2073+ | LifetimeRes :: Infer
2074+ | LifetimeRes :: Error
2075+ | LifetimeRes :: ElidedAnchor { .. } => { }
20722076 }
20732077 }
20742078 LifetimeElisionCandidate :: Ignore | LifetimeElisionCandidate :: Named => { }
0 commit comments