Rust version of recursion depth program