Checking the size of recursive types in Rust

Check size of constructors.


enum List {
    Cons(i32, List),

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.