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
Compiling this code on stable/beta/nightly (playground):
structX<'x>{x:&'x str,}traitB{fnnew(x:X) -> Self;}structS<'x>{x:X<'x>,}impl<'x>BforS<'x>{fnnew(x:X) -> S<'x>{S{ x }}}
correctly results in an error, but part of the diagnostic is less than helpful:
= note: expected `X<'_>`
found `X<'_>`
click for full error text
error[E0495]: cannot infer an appropriate lifetime for lifetime parameter `'x` due to conflicting requirements
--> src/lib.rs:15:9
|
15 | S { x }
| ^
|
note: first, the lifetime cannot outlive the anonymous lifetime #1 defined on the method body at 14:5...
--> src/lib.rs:14:5
|
14 | fn new(x: X) -> S<'x> {
| ^^^^^^^^^^^^^^^^^^^^^
note: ...so that the expression is assignable
--> src/lib.rs:15:13
|
15 | S { x }
| ^
= note: expected `X<'_>`
found `X<'_>`
note: but, the lifetime must be valid for the lifetime `'x` as defined on the impl at 13:6...
--> src/lib.rs:13:6
|
13 | impl<'x> B for S<'x> {
| ^^
note: ...so that the expression is assignable
--> src/lib.rs:15:9
|
15 | S { x }
| ^^^^^^^
= note: expected `S<'x>`
found `S<'_>`
It seems like either this note should have some detail indicating what the difference between the expected and found conditions is, or it should be left out entirely, because currently it's not providing any information at all.
Compiling this code on stable/beta/nightly (playground):
correctly results in an error, but part of the diagnostic is less than helpful:
click for full error text
It seems like either this
note
should have some detail indicating what the difference between the expected and found conditions is, or it should be left out entirely, because currently it's not providing any information at all.Reported on URLO here.
(Sorry if this is a duplicate, I don't know how to search effectively for previous reports of the same thing.)
The text was updated successfully, but these errors were encountered: