Skip to content

Instantly share code, notes, and snippets.

@jozefg
Created November 14, 2014 23:04
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 jozefg/846cc1b6555a32d1be7a to your computer and use it in GitHub Desktop.
Save jozefg/846cc1b6555a32d1be7a to your computer and use it in GitHub Desktop.
Trees gone wrong
enum Tree<A> {
Leaf(A),
Node(Box<Tree<(A, A)>>)
}
fn size<A>(t : &Tree<A>) -> int {
match t {
&Leaf(_) => 1,
&Node(box ref t) => size(t)
}
}
fn main () {}
// task 'rustc' has overflowed its stack
// Compilation illegal instruction (core dumped) at Fri Nov 14 18:04:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment