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

Recursive structs cause a stack overflow #285

Open
cAttte opened this issue Oct 31, 2024 · 2 comments
Open

Recursive structs cause a stack overflow #285

cAttte opened this issue Oct 31, 2024 · 2 comments

Comments

@cAttte
Copy link
Contributor

cAttte commented Oct 31, 2024

hi! trying to generate bindings for a recursive struct with tauri_specta causes a stack overflow:

#[derive(serde::Serialize, specta::Type)]
struct B { a: Option<Box<A>> }

#[derive(serde::Serialize, specta::Type)]
struct A { b: B }
thread 'main' has overflowed its stack

here's an MRE. just run:

git clone https://github.com/cAttte/tauri-specta-overflow && cd tauri-specta-overflow && npm i && npm run tauri dev

given that recursive types are fine in TypeScript, this should be no problem. but even if this was unsupported behavior, tauri_specta should detect the recursion and fail intentionally!

@oscartbeaumont
Copy link
Member

Yeah stack overflows are not okay and this should be supported. Will give this a look when I have a moment.

@oscartbeaumont
Copy link
Member

Also gonna move this to to the Specta repo as it’s gonna be a problem with it.

@oscartbeaumont oscartbeaumont transferred this issue from specta-rs/tauri-specta Nov 1, 2024
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

No branches or pull requests

2 participants