Skip to content
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

Fixed LateInit recipe stack overflow #212

Merged
merged 2 commits into from Dec 24, 2022
Merged

Fixed LateInit recipe stack overflow #212

merged 2 commits into from Dec 24, 2022

Conversation

jack-cooper
Copy link
Contributor

The given LateInit recipe works up until the print statement, which causes a stack overflow as the derived Debug implementation tries to write out:

LateInit { cell: OnceCell(A { b: LateInit { cell: OnceCell(B { a: LateInit // repeats endlessly from here

To fix this, I've added in a rudimentary Debug impl.

@matklad
Copy link
Owner

matklad commented Dec 24, 2022

🤔 yeah, ideally even silly examples would do something reasonable. I'd like to aviod adding custom code for debug here -- destracts from the thrust of the example. Can we rework this somehow to keep it simple? maybee use something like let _a = a.b.a.b.a instead of print?

@jack-cooper
Copy link
Contributor Author

Sounds sensible to me! Most recent commit removes the Debug impls.

@matklad
Copy link
Owner

matklad commented Dec 24, 2022

Nice, thanks!

bors r+

@bors
Copy link
Contributor

bors bot commented Dec 24, 2022

Build succeeded:

@bors bors bot merged commit 0d0dae1 into matklad:master Dec 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants