-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Circular trait bounds causes stack overflow in rustc #12644
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Comments
Definitely a bug. Causes an infinte loop while trying to create the vtables it seems, the loop I got was
Looking at the |
Upon further inspection (including reading the gdb backtrace properly), it isn't actually an infinite loop, instead is just a very, very long one. since it breaks out of that loop eventually and then overflows. |
Aha! There are other generic implementations of As for why the loop happens... I don't know. |
Related to #12511 |
This is enough to cause the stack overflow, if it helps any: trait Foo : Bar<Self> { }
trait Bar<T: Foo> { } |
Triage: @doy's sample still overflows on
|
Just to add another case, using associated types doesn't work either: trait One { type Foo: Two; }
trait Two { type Foo: One; } also overflows. |
On rustc 1.0.0-dev (593db00 2015-03-25) (built 2015-03-25),
does not overflow.
and the original code does not compile. |
@steveklabnik this should have been closed by #23013. Would you do the honours? |
Steal! |
overflow.rs
:compiling:
The text was updated successfully, but these errors were encountered: