-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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 hangs when compiling mutually-defined enums #55625
Comments
Back in rustc 1.20.0, we would explicitly end the compilation with an overflow error, as illustrated in the details block below.
|
(Also, this might be an instance of a polymorphic recursion (#4287) in the types? Not 100% sure, I'd have to review the structure more carefully. I mention that mostly because we have historically had a less than stellar record in handling polymorphic recursion in an elegant manner...) Update June 2019: it is polymorphic recursion |
If you make minor adjustments to the definitions (e.g. removing a variant), you get the overflow error. It seems to be very volatile. |
Inlining the definition of enum B<T> {
B1(T),
B2(Box<B<B<T>>>),
B3(Box<B<Option<B<T>>>>),
} Note also that to see the hang without using fn main() {
let b1: Option<B<&'static str>>;
} That seems to be enough to cause the drop-check rules analysis to fire (and then get into trouble). |
(something a tiny bit worrisome: for some reason, the hang that I see with a fn boo(b: Option<B<&'static str>>) {
// let b1 = b; // uncommenting this brings the hang back.
} |
I'm going to close in favor of #4287 which is the same bug (hang on dropck) |
The following fails to halt or emit any warnings or errors.
The text was updated successfully, but these errors were encountered: