Skip to content
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

internal compiler error with self-referential struct definition #4218

Closed
ttaubert opened this issue Dec 18, 2012 · 4 comments
Closed

internal compiler error with self-referential struct definition #4218

ttaubert opened this issue Dec 18, 2012 · 4 comments
Labels
A-type-system Area: Type system I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
Milestone

Comments

@ttaubert
Copy link
Contributor

Trying to implement a tree-like structure:

extern mod core(vers = "0.5");

priv struct Node<K, V> {
  left: core::Option<Node<K, V>>
}

I hit the following compiler error:

rust: task 7f3b6c105dd0 ran out of stack
/usr/local/bin/../lib/librustrt.so(_ZN9rust_task13begin_failureEPKcS1_m+0x4b)[0x7f3b73b0e45b]
/usr/local/bin/../lib/librustrt.so(_ZN9rust_task9new_stackEm+0x158)[0x7f3b73b0e928]
/usr/local/bin/../lib/librustrt.so(+0x30229)[0x7f3b73b22229]
/usr/local/bin/../lib/librustrt.so(upcall_new_stack+0x280)[0x7f3b73b12040]
/usr/local/bin/../lib/librustc-c84825241471686d-0.5.so(+0x767fa2)[0x7f3b742bbfa2]
/usr/local/bin/../lib/librustc-c84825241471686d-0.5.so(+0x2f2c59)[0x7f3b73e46c59]
/usr/local/bin/../lib/librustc-c84825241471686d-0.5.so(_ZN6middle2ty14__extensions__10meth_3526010iter_bytes15_abfbbb3dea17df3_05E+0xc3f)[0x7f3b73e1bc3f]
/usr/local/bin/../lib/librustc-c84825241471686d-0.5.so(_ZN6middle2ty14__extensions__10meth_3525510iter_bytes15_abfbbb3dea17df3_05E+0x85)[0x7f3b73e1adb5]
/usr/local/bin/../lib/librustc-c84825241471686d-0.5.so(+0x2d6ebf)[0x7f3b73e2aebf]
/usr/local/bin/../lib/librustc-c84825241471686d-0.5.so(+0x2d62ef)[0x7f3b73e2a2ef]
/usr/local/bin/../lib/librustc-c84825241471686d-0.5.so(_ZN6middle2ty9mk_struct16_beb59be6919256b3_05E+0x11e)[0x7f3b73e311de]
/usr/local/bin/../lib/librustc-c84825241471686d-0.5.so(_ZN6middle2ty19fold_regions_and_ty17_4c9b12843e648dc73_05E+0x93a)[0x7f3b73e33dfa]
/usr/local/bin/../lib/librustc-c84825241471686d-0.5.so(+0x2e1f54)[0x7f3b73e35f54]
/usr/local/bin/../lib/librustc-c84825241471686d-0.5.so(+0x111321)[0x7f3b73c65321]
/usr/local/bin/../lib/librustc-c84825241471686d-0.5.so(+0x2e03ea)[0x7f3b73e343ea]
/usr/local/bin/../lib/librustc-c84825241471686d-0.5.so(_ZN6middle2ty19fold_regions_and_ty17_4c9b12843e648dc73_05E+0x26a)[0x7f3b73e3372a]
/usr/local/bin/../lib/librustc-c84825241471686d-0.5.so(+0x2e1f54)[0x7f3b73e35f54]
/usr/local/bin/../lib/librustc-c84825241471686d-0.5.so(_ZN6middle2ty5subst16_b2fc4a1db6bca5d3_05E+0x2fb)[0x7f3b73d0772b]
/usr/local/bin/../lib/librustc-c84825241471686d-0.5.so(_ZN6middle2ty17lookup_field_type17_f6b5a6d1e0e9fa5f3_05E+0x1bb)[0x7f3b73d6472b]
@ttaubert
Copy link
Contributor Author

Seems to be caused by recursive type_size() calls.

@ttaubert
Copy link
Contributor Author

I just realized that what I'm doing is quite dumb because a struct on the stack clearly can't contain itself and needs a pointer here. We should have an error message saying that.

@catamorphism
Copy link
Contributor

I was sure there was already another issue open about this, but I couldn't find one. Hmmm.

@graydon
Copy link
Contributor

graydon commented Feb 4, 2013

The most extensive discussion on this is in issue #4363 so closing this variant, it's a duplicate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-type-system Area: Type system I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
Projects
None yet
Development

No branches or pull requests

3 participants