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

thread 'main' has overflowed its stack when using a wrapper with derive #2299

Closed
Skeletonxf opened this issue Oct 16, 2022 · 2 comments
Closed

Comments

@Skeletonxf
Copy link

Minimum working example here: https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=b05606f4e212d06a700f8ff38fa26d12

I seem to be getting a runtime thread 'main' has overflowed its stack error when trying to delegate to a wrapper type for deserialisation. Seems possibly related to a prior issue with a similar thing happening at compile time: rust-lang/rust#55779 but that is marked as completed.

@dtolnay
Copy link
Member

dtolnay commented Oct 16, 2022

I think this is behaving correctly. You've written a Deserialize impl for Foo that requires deserializing Wrapper, and a Deserialize impl for Wrapper that involves deserializing Foo.

@dtolnay dtolnay closed this as completed Oct 16, 2022
@Skeletonxf
Copy link
Author

Skeletonxf commented Oct 16, 2022

Thanks I see now. Is there any way to use a new type and #[derive(Deserialize)] like this without creating a recursive issue?

Looks like matching the fields is the only way? https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=0469c6d0c12bc185e653cab309936791

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants