1
Fork 0

Fix incorrect lifetime suggestion

This commit is contained in:
Esteban Küber 2023-11-15 04:07:19 +00:00
parent d30252e359
commit dec7f00e15
2 changed files with 4 additions and 21 deletions

View file

@ -2853,8 +2853,8 @@ impl<'a: 'ast, 'ast, 'tcx> LateResolutionVisitor<'a, '_, 'ast, 'tcx> {
"this function's return type contains a borrowed value, but there is no value \
for it to be borrowed from",
);
maybe_static = true;
if in_scope_lifetimes.is_empty() {
maybe_static = true;
in_scope_lifetimes = vec![(
Ident::with_dummy_span(kw::StaticLifetime),
(DUMMY_NODE_ID, LifetimeRes::Static),
@ -2865,8 +2865,8 @@ impl<'a: 'ast, 'ast, 'tcx> LateResolutionVisitor<'a, '_, 'ast, 'tcx> {
"this function's return type contains a borrowed value with an elided \
lifetime, but the lifetime cannot be derived from the arguments",
);
maybe_static = true;
if in_scope_lifetimes.is_empty() {
maybe_static = true;
in_scope_lifetimes = vec![(
Ident::with_dummy_span(kw::StaticLifetime),
(DUMMY_NODE_ID, LifetimeRes::Static),