Skip to content

task 'rustc' has overflowed its stack when compiling cyclic structs and enums #13632

Closed
@ryantm

Description

@ryantm

This code produces a stack overflow in rustc when compiled:

pub struct A {
    b: Option<B>
}

pub struct B {
    a: Option<A>
}

pub enum C {
    D(B)
}

fn main () {}

Output:

$ rustc main.rs 
task 'rustc' has overflowed its stack
Illegal instruction (core dumped)

My environment:

$ rustc -v
rustc 0.11-pre-nightly (d35804e 2014-04-18 00:01:22 -0700)
host: x86_64-unknown-linux-gnu
$ uname -a
Linux hostname 3.14.1-1-ARCH #1 SMP PREEMPT Mon Apr 14 20:40:47 CEST 2014 x86_64 GNU/Linux

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