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

infinite size recursive struct using a fixed-size array ICEs instead of an error #5146

Closed
thestinger opened this issue Feb 27, 2013 · 5 comments
Labels
A-codegen Area: Code generation A-type-system Area: Type system I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@thestinger
Copy link
Contributor

struct Foo {
    bar: [Option<Foo> * 2]
}
@jdm
Copy link
Contributor

jdm commented Feb 27, 2013

Probably related to #3778.

@graydon
Copy link
Contributor

graydon commented May 2, 2013

accepted for production ready

@bblum
Copy link
Contributor

bblum commented Jul 13, 2013

Modernized:

use std::sys;
struct Foo {
        bar: [Option<Foo>, ..2]
}
fn main() {
    error!("%?", sys::size_of::<Foo>());
}

I had to use the type Foo instead of just defining it, but it does indeed stack overflow the compiler.

@bblum
Copy link
Contributor

bblum commented Jul 13, 2013

The recursion is between middle::trans::type_of::sizing_type_of and middle::trans::adt::represent_type and middle::trans::adt::mk_struct.

I thought this was going to be the same bug as #7587, but it is not, since that one is in type_contents and this one is in trans.

@bblum
Copy link
Contributor

bblum commented Jul 13, 2013

Fixed-size array not necessary, actually. Dup of #3779.

@bblum bblum closed this as completed Jul 13, 2013
bors added a commit to rust-lang-ci/rust that referenced this issue May 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-codegen Area: Code generation 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

4 participants