Skip to content

Out of stack error with struct containing an Option of itself #5866

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
dotdash opened this issue Apr 13, 2013 · 1 comment
Closed

Out of stack error with struct containing an Option of itself #5866

dotdash opened this issue Apr 13, 2013 · 1 comment

Comments

@dotdash
Copy link
Contributor

dotdash commented Apr 13, 2013

This code

struct Foo { v: Option<Foo> }

fn main() {
  Foo { v: None };
}

causes the compiler to run out of stack.

rust: task 14114e0 ran out of stack
/home/doener/src/rust-submit/x86_64-unknown-linux-gnu/stage0/bin/../lib/librustrt.so(_ZN9rust_task13begin_failureEPKcS1_m+0x4f)[0x7fde632ba52f]
/home/doener/src/rust-submit/x86_64-unknown-linux-gnu/stage0/bin/../lib/librustrt.so(_ZN9rust_task9new_stackEm+0x158)[0x7fde632ba778]
/home/doener/src/rust-submit/x86_64-unknown-linux-gnu/stage0/bin/../lib/librustrt.so(+0x299f1)[0x7fde632ca9f1]
/home/doener/src/rust-submit/x86_64-unknown-linux-gnu/stage0/bin/../lib/librustrt.so(upcall_new_stack+0x28c)[0x7fde632bd34c]
/home/doener/src/rust-submit/x86_64-unknown-linux-gnu/stage0/bin/../lib/librustc-c84825241471686d-0.6.so(+0x8b9e1a)[0x7fde65499e1a]
/home/doener/src/rust-submit/x86_64-unknown-linux-gnu/stage0/bin/../lib/librustc-c84825241471686d-0.6.so(+0x38ae1b)[0x7fde64f6ae1b]
/home/doener/src/rust-submit/x86_64-unknown-linux-gnu/stage0/bin/../lib/librustc-c84825241471686d-0.6.so(_ZN6middle2ty14__extensions__10meth_4004910iter_bytes17_6d4d402c59155c393_06E+0x169)[0x7fde64f69a69]
/home/doener/src/rust-submit/x86_64-unknown-linux-gnu/stage0/bin/../lib/librustc-c84825241471686d-0.6.so(+0x38adaa)[0x7fde64f6adaa]
/home/doener/src/rust-submit/x86_64-unknown-linux-gnu/stage0/bin/../lib/librustc-c84825241471686d-0.6.so(_ZN6middle2ty14__extensions__10meth_3814010iter_bytes17_6d4d402c59155c393_06E+0x9ee)[0x7fde64f3265e]
/home/doener/src/rust-submit/x86_64-unknown-linux-gnu/stage0/bin/../lib/librustc-c84825241471686d-0.6.so(_ZN6middle2ty14__extensions__10meth_3813510iter_bytes17_6d4d402c59155c393_06E+0x88)[0x7fde64f31bc8]
/home/doener/src/rust-submit/x86_64-unknown-linux-gnu/stage0/bin/../lib/librustc-c84825241471686d-0.6.so(+0x370b4a)[0x7fde64f50b4a]
/home/doener/src/rust-submit/x86_64-unknown-linux-gnu/stage0/bin/../lib/librustc-c84825241471686d-0.6.so(+0x36fd74)[0x7fde64f4fd74]
/home/doener/src/rust-submit/x86_64-unknown-linux-gnu/stage0/bin/../lib/librustc-c84825241471686d-0.6.so(+0x36fc39)[0x7fde64f4fc39]
/home/doener/src/rust-submit/x86_64-unknown-linux-gnu/stage0/bin/../lib/librustc-c84825241471686d-0.6.so(_ZN6middle2ty7mk_enum16_b7fa25d463c35113_06E+0x1f0)[0x7fde64f546c0]
/home/doener/src/rust-submit/x86_64-unknown-linux-gnu/stage0/bin/../lib/librustc-c84825241471686d-0.6.so(_ZN6middle2ty19fold_regions_and_ty17_5df880af9eb9e9a43_06E+0x16e)[0x7fde64f581fe]
/home/doener/src/rust-submit/x86_64-unknown-linux-gnu/stage0/bin/../lib/librustc-c84825241471686d-0.6.so(+0x37ae66)[0x7fde64f5ae66]
/home/doener/src/rust-submit/x86_64-unknown-linux-gnu/stage0/bin/../lib/librustc-c84825241471686d-0.6.so(_ZN6middle2ty8fold_sig17_2ff1c49afce455833_06E+0x197)[0x7fde64f579c7]
/home/doener/src/rust-submit/x86_64-unknown-linux-gnu/stage0/bin/../lib/librustc-c84825241471686d-0.6.so(_ZN6middle2ty19fold_regions_and_ty17_5df880af9eb9e9a43_06E+0x32b)[0x7fde64f583bb]
/home/doener/src/rust-submit/x86_64-unknown-linux-gnu/stage0/bin/../lib/librustc-c84825241471686d-0.6.so(+0x37ae66)[0x7fde64f5ae66]
/home/doener/src/rust-submit/x86_64-unknown-linux-gnu/stage0/bin/../lib/librustc-c84825241471686d-0.6.so(_ZN6middle2ty5subst16_7b72eb1b651f4b73_06E+0x381)[0x7fde64db5471]
/home/doener/src/rust-submit/x86_64-unknown-linux-gnu/stage0/bin/../lib/librustc-c84825241471686d-0.6.so(+0x39fd15)[0x7fde64f7fd15]
/home/doener/src/rust-submit/x86_64-unknown-linux-gnu/stage0/bin/../lib/librustc-c84825241471686d-0.6.so(+0x2b8c21)[0x7fde64e98c21]
/home/doener/src/rust-submit/x86_64-unknown-linux-gnu/stage0/bin/../lib/librustc-c84825241471686d-0.6.so(_ZN6middle2ty20substd_enum_variants17_47b8d6e5411762f93_06E+0xa6)[0x7fde64ee52c6]
/home/doener/src/rust-submit/x86_64-unknown-linux-gnu/stage0/bin/../lib/librustc-c84825241471686d-0.6.so(+0x384b54)[0x7fde64f64b54]
/home/doener/src/rust-submit/x86_64-unknown-linux-gnu/stage0/bin/../lib/librustc-c84825241471686d-0.6.so(+0x384d72)[0x7fde64f64d72]
/home/doener/src/rust-submit/x86_64-unknown-linux-gnu/stage0/bin/../lib/librustc-c84825241471686d-0.6.so(+0x384bf2)[0x7fde64f64bf2]
/home/doener/src/rust-submit/x86_64-unknown-linux-gnu/stage0/bin/../lib/librustc-c84825241471686d-0.6.so(+0x384d72)[0x7fde64f64d72]
[... lots of those two omitted ...]
/home/doener/src/rust-submit/x86_64-unknown-linux-gnu/stage0/bin/../lib/librustc-c84825241471686d-0.6.so(+0x384bf2)[0x7fde64f64bf2]
/home/doener/src/rust-submit/x86_64-unknown-linux-gnu/stage0/bin/../lib/librustc-c84825241471686d-0.6.so(+0x384d72)[0x7fde64f64d72]
/home/doener/src/rust-submit/x86_64-unknown-linux-gnu/stage0/bin/../lib/librustc-c84825241471686d-0.6.so(+0x384bf2)[0x7fde64f64bf2]
/home/doener/src/rust-submit/x86_64-unknown-linux-gnu/stage0/bin/../lib/librustc-c84825241471686d-0.6.so(+0x384d72)[0x7fde64f64d72]
error: internal compiler error: unexpected failure
note: the compiler hit an unexpected failure path. this is a bug
note: try running with RUST_LOG=rustc=1,::rt::backtrace to get further details and report the results to github.com/mozilla/rust/issues
rust: task failed at 'explicit failure', /home/rustbuild/src/rust-buildbot/slave/snap3-linux/build/src/librustc/rustc.rc:357
/home/doener/src/rust-submit/x86_64-unknown-linux-gnu/stage0/bin/../lib/librustrt.so(_ZN9rust_task13begin_failureEPKcS1_m+0x4f)[0x7fde632ba52f]
/home/doener/src/rust-submit/x86_64-unknown-linux-gnu/stage0/bin/../lib/librustrt.so(+0x299f1)[0x7fde632ca9f1]
/home/doener/src/rust-submit/x86_64-unknown-linux-gnu/stage0/bin/../lib/librustrt.so(upcall_fail+0x1c6)[0x7fde632bccb6]
/home/doener/src/rust-submit/x86_64-unknown-linux-gnu/stage0/bin/../lib/libcore-c3ca5d77d81b46c1-0.6.so(+0x1059ab)[0x7fde664e39ab]
/home/doener/src/rust-submit/x86_64-unknown-linux-gnu/stage0/bin/../lib/libcore-c3ca5d77d81b46c1-0.6.so(+0x105952)[0x7fde664e3952]
/home/doener/src/rust-submit/x86_64-unknown-linux-gnu/stage0/bin/../lib/libcore-c3ca5d77d81b46c1-0.6.so(_ZN3sys12begin_unwind16_701b8ec61f97ead3_06E+0x71)[0x7fde6642b441]
/home/doener/src/rust-submit/x86_64-unknown-linux-gnu/stage0/bin/../lib/libcore-c3ca5d77d81b46c1-0.6.so(+0x14e214)[0x7fde6652c214]
/home/doener/src/rust-submit/x86_64-unknown-linux-gnu/stage0/bin/../lib/librustc-c84825241471686d-0.6.so(_ZN7monitor17_ab3b5d4d4b9efdb63_06E+0x1577)[0x7fde6548d947]
/home/doener/src/rust-submit/x86_64-unknown-linux-gnu/stage0/bin/../lib/librustc-c84825241471686d-0.6.so(+0x8b9e84)[0x7fde65499e84]
/home/doener/src/rust-submit/x86_64-unknown-linux-gnu/stage0/bin/../lib/librustc-c84825241471686d-0.6.so(_ZN4main16_706f4ee7413ae583_06E+0x7e)[0x7fde65499a9e]
/home/doener/src/rust-submit/x86_64-unknown-linux-gnu/stage0/bin/../lib/librustrt.so(_Z18task_start_wrapperP10spawn_args+0x24)[0x7fde632bb534]
rust: domain main @0x14073c0 root task failed

@thestinger
Copy link
Contributor

This happens because the type would be an infinite size, and the compiler is really bad at identifying those cases so it ends up doing infinite recursion.

Closing in favour of the existing #4363.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants