Checking the size of recursive types in Rust

Check size of constructors.

E.g.

enum List {
Cons(i32, List),
Nil,
}


The above will check if Nil or Cons(i32, List) takes up more space, allocate that amount. However, due to recursive call of Cons(i32, List), it is unable to come up with a known size, the structure can recurse indefinitely.