Skip to content

Compiling a match on [T, ..N] uses O(N) stack space in rustc, leading to stack overflow #17877

Closed
@chris-morgan

Description

@chris-morgan

Minimal test case:

fn main() {
    match [0u8, ..1024] {
        _ => (),
    }
}

If 1024 doesn’t do it for you, try bumping it upwards. 10000 ought to do it. Just don’t try numbers like a million or you’ll be waiting a while before it crashes. And if you have anything like systemd-coredump start automatically, it’ll be busy for a while as well… I guess there are a few areas where [T, ..N] is not handled well for large N.

(Additional keywords: sized array.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions