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

Compiler does not stop #8593

Closed
kakkun61 opened this issue Aug 18, 2013 · 2 comments
Closed

Compiler does not stop #8593

kakkun61 opened this issue Aug 18, 2013 · 2 comments
Labels
A-type-system Area: Type system I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@kakkun61
Copy link

The compiler does not stop compiling this code.

enum A {
    A(B)
}

enum B {
    B1, B2(B)
}

fn main() {
}

I expected following compilation error.

error: illegal recursive enum type; wrap the inner value in a box to make it representable
enum B {
    B1, B2(B)
}

commits which I confirm with: 758c5e8 & a2db7c1

@bblum
Copy link
Contributor

bblum commented Aug 21, 2013

This is related to but not the same as #2063. The problem here is that while B is an illegal type, that check is not run until after A is checked.

The compiler should instead maintain a cache of "types which have been occurs-checked", and for forward-references like this, additionally check the nested type if it doesn't appear in the cache yet.

@alexcrichton
Copy link
Member

Closing as a dupe of #2063. There's a whole array of issues with recursive unbounded-sized types, but I don't think it helps much to keep separate issues open for all of them when they're likely all related. This will be linked in #2063 though, and I will comment that this should be taken care of as well.

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