@@ -2039,25 +2039,38 @@ impl<'a: 'ast, 'b, 'ast, 'tcx> LateResolutionVisitor<'a, 'b, 'ast, 'tcx> {
2039
2039
if let Some ( prev_res) = self . r . lifetimes_res_map . insert ( id, res) {
2040
2040
panic ! ( "lifetime {id:?} resolved multiple times ({prev_res:?} before, {res:?} now)" )
2041
2041
}
2042
+
2042
2043
match candidate {
2043
- LifetimeElisionCandidate :: Missing ( missing) => match res {
2044
- LifetimeRes :: Static => {
2045
- self . r . lint_buffer . buffer_lint (
2046
- lint:: builtin:: ELIDED_NAMED_LIFETIMES ,
2047
- missing. id ,
2048
- missing. span ,
2049
- BuiltinLintDiag :: ElidedIsStatic { } ,
2050
- ) ;
2051
- tracing:: warn!( ?missing, "static" )
2052
- }
2053
- LifetimeRes :: Param { param, binder } => {
2054
- tracing:: warn!( ?missing, ?param, ?binder, "named" )
2044
+ LifetimeElisionCandidate :: Missing ( missing) => {
2045
+ // FIXME: ICEs otherwise
2046
+ if missing. kind != MissingLifetimeKind :: Ampersand {
2047
+ match res {
2048
+ LifetimeRes :: Static => {
2049
+ self . r . lint_buffer . buffer_lint (
2050
+ lint:: builtin:: ELIDED_NAMED_LIFETIMES ,
2051
+ missing. id ,
2052
+ missing. span ,
2053
+ BuiltinLintDiag :: ElidedIsStatic { elided : missing. span } ,
2054
+ ) ;
2055
+ }
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
+ }
2055
2072
}
2056
- LifetimeRes :: Fresh { .. }
2057
- | LifetimeRes :: Infer
2058
- | LifetimeRes :: Error
2059
- | LifetimeRes :: ElidedAnchor { .. } => { }
2060
- } ,
2073
+ }
2061
2074
LifetimeElisionCandidate :: Ignore | LifetimeElisionCandidate :: Named => { }
2062
2075
}
2063
2076
0 commit comments