Skip to content

Taking many (500+) references to a value causes compiler stack overflow #40253

Closed
@tyler569

Description

@tyler569

Source

While I recognize this is not what one might call a typical use case, I feel that the compiler should do something more useful than crash in this circumstance.

rustup run stable rustc --version
rustc 1.15.1 (021bd294c 2017-02-08)

rustup run nightly rustc --version
rustc 1.17.0-nightly (b1e31766d 2017-03-03)
rustup run stable cargo build
   Compiling reference_so v0.1.0 (file:///home/tyler/reference_so)
error: Could not compile `reference_so`.

To learn more, run the command again with --verbose.
rustup run nightly cargo build
   Compiling reference_so v0.1.0 (file:///home/tyler/reference_so)

thread 'rustc' has overflowed its stack
fatal runtime error: stack overflow
error: Could not compile `reference_so`.

To learn more, run the command again with --verbose.

Both the number of references and the #![recursion_limit] are minimal for my system.

I believe this may be related to #40119

Metadata

Metadata

Assignees

No one assigned

    Labels

    P-mediumMedium priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions