Skip to content

rustc has overflowed its stack #10400

Closed
Closed
@aeqwa

Description

@aeqwa

Guten Tag!
For my project i used the 0.8 version of rust.
After i started to work on a parser module for my project.
rustc crashed at compile time and i decided to go and use the git version now i get an error message.

task 'rustc' has overflowed its stack
[1]    2625 illegal hardware instruction (core dumped)  rustc main.rs

My project compiles without

pub mod parser;

in my main.rs perfectly.

But i don't get an error message, what says what goes wrong.
So I think thats an issue so thats reason you read that.

Thanks for every help on the irc and for my problem!

Sebastian Pielawa

Activity

ben0x539

ben0x539 commented on Nov 10, 2013

@ben0x539
Contributor

The problem appears to be the definition of Node in parser.rs:

pub struct Node {
    token: Token,
    left: Option<Node>,
    right: Option<Node>,
    index: uint
}

That makes for an infinite size struct because every Node contains another two Nodes inside the Option enums there. The standard solution is to use Option<~Node> or similar, so that the size of those fields is fixed by the pointer size rather than recursive. Of course, the issue here is that rustc doesn't catch that which frankly surprises me given that this is pretty much our go-to example for motivating ~ boxes now. ;)

(ps: sorry for the prematurely submitted comment, my fingers slipped)

aeqwa

aeqwa commented on Nov 10, 2013

@aeqwa
Author

Thank you ben0x539 it works!
But i think the compiler should give the user in that case an error message.

pnkfelix

pnkfelix commented on Nov 10, 2013

@pnkfelix
Member

@aeqwa Yes, it should be. But is not yet so.

closing as duplicate of #3779

added a commit that references this issue on Mar 10, 2023

Auto merge of rust-lang#10400 - calebcartwright:rustfmt-cleanup, r=Ja…

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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

        Participants

        @ben0x539@pnkfelix@aeqwa

        Issue actions

          rustc has overflowed its stack · Issue #10400 · rust-lang/rust