-
Notifications
You must be signed in to change notification settings - Fork 13.3k
can the ?
operator use into
rather than from
?
#38751
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
Comments
Nominating for discussion. I feel like this might cause inference failures. |
Conclusion from @rust-lang/lang meeting: we should try it and see! |
This issue should probably get an update with the current state. IIRC, there were some ugly inference issues when we last tried this, but I'm unable to find the discussion that tried. |
[WIP] Use `Into::into` in operator `?` #38751 proposes using `into` for `?`, and while commenters suggested problems with inference, I couldn't find any evidence where this was actually attempted -- so here we go!
I tried this in #60796, and indeed type inference was a problem. Maybe the compiler can learn some tricks to make that work better, but for now this change doesn't seem feasible. |
The need for
What the trait is trying to express is simple - any
But, there's no straightforward way to fix this since there is no way to express the "reverse bound"
Link to project: Tree-Buf |
FWIW, you can put |
There is also a hard-coded limit in the trait system. If you have to solve a goal like Edit: Here, So I could see that changing I'm inclined to close this issue, myself. |
I am also inclined to close this -- it seems clear that we cannot change this now anyway. |
@nikomatsakis would proper chalk integration for the trait solver be able to relax this limitation? (Could the relaxation be targeted exclusively to It would be nice if we could "fix" |
Since implementing
From
implies an implementation forInto
, but not vice versa, this seems like it should admit strictly more programs. Not entirely convinced this would be backwards compatible though.The text was updated successfully, but these errors were encountered: