@@ -2042,33 +2042,37 @@ impl<'a: 'ast, 'b, 'ast, 'tcx> LateResolutionVisitor<'a, 'b, 'ast, 'tcx> {
2042
2042
2043
2043
match candidate {
2044
2044
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 {
2049
2050
self . r . lint_buffer . buffer_lint (
2050
2051
lint:: builtin:: ELIDED_NAMED_LIFETIMES ,
2051
2052
missing. id ,
2052
2053
missing. span ,
2053
2054
BuiltinLintDiag :: ElidedIsStatic { elided : missing. span } ,
2054
2055
) ;
2055
2056
}
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 { .. } => { }
2071
2057
}
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 { .. } => { }
2072
2076
}
2073
2077
}
2074
2078
LifetimeElisionCandidate :: Ignore | LifetimeElisionCandidate :: Named => { }
0 commit comments