Does Rust support dynamic stack allocation?

69 points calebkiage

In C++, it's possible to create an array on the stack with a dynamic size. For example:

void array_on_stack(size_t size) {
  int buffer[size];
  // use buffer for some work
}

However, in Rust, the array type requires a compile time constant as the size. Is there a way to allocate on the stack or must all dynamic allocations happen on the heap?