Skip to content

Instantly share code, notes, and snippets.

@keigoi
Created October 26, 2012 17:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save keigoi/3960129 to your computer and use it in GitHub Desktop.
Save keigoi/3960129 to your computer and use it in GitHub Desktop.
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
Copy link
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