get rust default stack size at runtime
15:32 11 Apr 2026

How do I get the default rust stack size at runtime?

Looking at the rustc code, there exists a pub static STACK_SIZE. But how do I access this value from std or core? I know stack size varies by platform so I'd like to get the current platform's default at runtime.
Ideally, using a stable API interface, not an API call that requires compile-time branching based on the compile target.

I tried some paths but they didn't compile; std::thread::STACK_SIZE, std::thread::DEFAULT_STACK_SIZE, std::thread::stack_size(), std::thread::Builder::STACK_SIZE, etc.

rust stack-overflow