Setting the thread's stack size

The RUST_MIN_STACK environment variable can override the default stack size of 2 MB for created threads, but not for the main thread. You can also set the thread's stack size in code by using a thread::Builder, like this:

let child = thread::Builder::new().stack_size(32 * 1024 * 1024).spawn(move || { 
   // code to be executed in thread 
}).unwrap(); 

Here, the child thread gets 32 MB of stack space.