-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Stack overflow when impl'ing on recursive types #15188
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
After some experimentation I have determined that the cause of the recursion is that the exact type of So now I am unsure if this is an actual bug. |
I would classify a stack overflow as a bug in rustc. If it’s not legal, it should complain with an appropriate error, not with stack overflow. |
Triage: there have been a lot of changes to Rust since this sample code was made. @apoelstra , have you seen this error lately? |
No, I have not encountered this bug since I filed it. |
Okay, I'm going to give it a close, then. Anyone else coming along later, if you see this, please let me know and I'll re-open. |
not sure about that: https://play.rust-lang.org/?gist=d202841280e5d7a9e28f&version=nightly On nightly/beta it appears to time out, on stable it's still a stack overflow. |
(I just ported it to stable Rust) |
This now provides a proper, if very long, error message:
|
Use debug impl in rendering const eval result fix rust-lang#15188
See https://gist.github.com/apoelstra/0c5e05a2d57a91be3c0b
Here I have a structure like
and am trying to implement a deserialization trait on it. When I try to call
deserialize
on aVec<u8>
to produce aList<u8>
say, rustc overflows, presumably chasing<T>
through an infinite chain ofOption<Box<List<T>>>
s somehow.Note that if the
data
field and parameter<T>
are removed, there is no stack overflow.The text was updated successfully, but these errors were encountered: