Rust compiler version <= 1.74.0 reserves 4096 + 16 = 4112 bytes of stack (yes, with optimization level 3, opt-level=3), check this out https://godbolt.org/z/PsjETWceq. If I switch to Rust 1.75.0, it gets fixed, https://godbolt.org/z/63EE6j3h3, it reserves 32 bytes
https://internals.rust-lang.org/t/why-rust-compiler-1-77-0-to-1-85-0-reserves-2x-extra-stack-for-large-enum/22775/2
Hi, John,
Here is the output https://internals.rust-lang.org/t/why-rust-compiler-1-77-0-to-1-85-0-reserves-2x-extra-stack-for-large-enum/22775/6