Skip to content

Instantly share code, notes, and snippets.

@keigoi keigoi/tailcall.rs
Created Oct 26, 2012

Embed
What would you like to do?
Rust tail call test
// use tail-call only, but stack overflow occur
fn recur(i : int) {
if i!=0 {
recur(i-1);
}
}
fn main() {
recur(1000000);
}
// Result ----
// rust: task 7f99a2d00220 ran out of stack
// rust: domain main @0x7f99a3800010 root task failed
@keigoi

This comment has been minimized.

Copy link
Owner Author

keigoi commented Oct 26, 2012

rust -O tailcall.rs will do TCO!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.