You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I expected to see an error message suggesting adding a named lifetime 'a to the returned type TwoLifetimes<'a, 'a>.
Instead, the suggested substitution is the malformed TwoLifetimes<'_<'a, 'a>, '_>.
error[E0106]: missing lifetime specifiers
--> src/main.rs:11:57
|
11 | fn two_lifetimes_needed(a: &(), b: &()) -> TwoLifetimes<'_, '_> {
| --- --- ^^ expected 2 lifetime parameters
|
= help: this function's return type contains a borrowed value, but the signature does not say whether it is borrowed from `a` or `b`
help: consider introducing a named lifetime parameter
|
11 | fn two_lifetimes_needed<'a>(a: &'a (), b: &'a ()) -> TwoLifetimes<'_<'a, 'a>, '_> {
| ^^^^ ^^^^^^ ^^^^^^ ^^^^^^^^^^
The linked playground shows that the output is correct when the return type lifetimes are elided (a bare TwoLifetimes), and also if only one placeholder lifetime is used (OneLifetime<'_>).
Meta
Reproduced on 1.53.0-nightly (2021-04-25 3709ae3), on 1.51.0 stable, and 1.47.0 stable.
The text was updated successfully, but these errors were encountered:
Playground.
I tried this code:
I expected to see an error message suggesting adding a named lifetime
'a
to the returned typeTwoLifetimes<'a, 'a>
.Instead, the suggested substitution is the malformed
TwoLifetimes<'_<'a, 'a>, '_>
.The linked playground shows that the output is correct when the return type lifetimes are elided (a bare
TwoLifetimes
), and also if only one placeholder lifetime is used (OneLifetime<'_>
).Meta
Reproduced on 1.53.0-nightly (2021-04-25 3709ae3), on 1.51.0 stable, and 1.47.0 stable.
The text was updated successfully, but these errors were encountered: