Skip to content(if available)orjump to list(if available)

StackSafe: Taming Recursion in Rust Without Stack Overflow

hotpotat

> You must carefully not leaving any recursive functions not annotated with #[recursive]

Isn’t the same true of forgetting #[stacksafe]?

This reminds me of certain Haskell patterns where you selectively make some operations strict instead of lazy for similar reasons. I’m glad this library exists, but I’m sad the Rust compiler itself doesn’t have better support for recursion.

lionkor

Why would I use a bandaid fix like this that has horrible memory usage, when there are crates[1] that allow tail call recursion?

[1] https://docs.rs/tailcall/latest/tailcall/

ameliaquining

This works on functions that can't be tail-recursive, like depth-first search.