duesee / imap-codec

Rock-solid and complete codec for IMAP
Apache License 2.0
35 stars 13 forks source link

tests: Don't arbitrarily generate too deeply nested threads #452

Closed duesee closed 4 months ago

duesee commented 4 months ago

Our Arbitrary implementations for recursive types are... meh... Thread derives Arbitrary, makes everything slower, and needs to be bounded (as SearchKey). This is all a pain point currently.

jakoschiko commented 4 months ago

See https://github.com/rust-fuzz/arbitrary/issues/78

duesee commented 4 months ago

I cheated and build the tree in reverse now (taking a few shortcuts) -- see #454. It seems to generate good enough test data. This unblocks fuzzing for now.

duesee commented 4 months ago

Idea: Can we use some async machinery to desugar recursive functions into state machines to "automatically" transform them into stack-based iterative functions? Having kind of a hard time doing this by hand ...

Notes:

jakoschiko commented 4 months ago

Idea: Can we use some async machinery to desugar recursive functions into state machines to "automatically" transform them into stack-based iterative functions?

I think this is sometimes called trampoline. It's worth a try, but the biggest problem is probably the borrow checker.