-
Notifications
You must be signed in to change notification settings - Fork 12.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"cannot infer an appropriate lifetime for automatic coercion" in struct initializer #13405
Comments
Struct literal fields don't seem to do any coercion (we should at least consider reborrows). |
It seems to me that it doesn't compile correctly: the return value contains a reference of unnamed lifetime (parameter This compiles for me:
as does this:
Am i missing something? What would you expect to happen here? Or is this issue about unclear error message? |
@dmski function returns nothing. |
Ah, sorry, should've read more carefully, disregard me. |
@nikomatsakis something I've figured since: if typeck sees a |
On Tue, Apr 15, 2014 at 04:40:27AM -0700, Eduard Burtescu wrote:
Yes, this is the subtyping rules. The reborrowing coercion usually |
The reborrowing coercion can't do anything for |
@eddyb yes, I was referring to a coercion on the other field. of course fixing variance might help too. that turns out to be a bit trickier than I initially thought. |
This is working now but needs a test case. |
Code:
and error is:
The text was updated successfully, but these errors were encountered: