Skip to content

rustc stack overflow when compiling rmk-types with Rust 1.92.0 #691

@decaday

Description

@decaday

After updating my stable toolchain to rustc 1.92.0 (ded5c06cf 2025-12-08) yesterday, I found that I could no longer compile any examples:

thread 'rustc' (6732) has overflowed its stack
error: could not compile `rmk-types` (lib)

The compilation only succeeds if I set the stack size to approximately 64MB via an environment variable: (pwsh)

$env:RUST_MIN_STACK = "67108864"
cargo build

or (bash):

export RUST_MIN_STACK=67108864
cargo build

I attempted to create a minimal reproduction and traced the issue to this specific location:

#[derive(postcard::experimental::max_size::MaxSize)]
pub enum KeyCode {
/// Reserved, no-key.
No = 0x0000,

The issue disappears if I either remove #[derive(postcard::experimental::max_size::MaxSize)] or reduce the overall size of the enum.

I suspect that Rust 1.92.0 might have introduced changes to macro expansion or other internals, as the compiler's default stack size remains unchanged:

https://github.com/rust-lang/rust/blob/123588a5bf9250f214e1931a761f814660e69620/compiler/rustc_interface/src/util.rs#L105

Could we perhaps file an issue with postcard or wait for the macro to stabilize, and maybe notify users that they might need to set RUST_MIN_STACK during compilation?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions