-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
"error: illegal recursive type" #19601
Comments
Even if we decide to not allow recursion, this is NOT recursion, it's referring to the same |
The use case I had in mind for this would be having |
This is more-or-less a dup of an existing issue I can't find right now. It's an artifact of how we translate bounds, which winds up forcing a DAG structure. It's in the process of being changed. |
The following version of the code example in the OP works now: trait A<T> {
fn foo(&self) -> T;
}
struct B<T> where B<T>: A<B<T>> { t: T } |
@anishathalye the reduced test case produces the following error message on stable:
If we change the test case so ping @nikomatsakis |
Marking as E-neestest to permit closing this. |
Also going to unassign @nikomatsakis since I don't think they need to do actively do anything on this issue. |
Fixes rust-lang#11740. Fixes rust-lang#19601. Fixes rust-lang#22603 Fixes rust-lang#22789. Fixes rust-lang#26614. r? @Mark-Simulacrum.
Add tests for various issues Fixes rust-lang#11740. Fixes rust-lang#19601. Fixes rust-lang#22603 Fixes rust-lang#22789. Fixes rust-lang#26614. r? @Mark-Simulacrum.
Add tests for various issues Fixes rust-lang#11740. Fixes rust-lang#19601. Fixes rust-lang#22603 Fixes rust-lang#22789. Fixes rust-lang#26614. r? @Mark-Simulacrum.
Is the restriction on recursive types really necessary?
It makes sense with structs, because recursive structs would mean infinite-sized structs. But with types, it seems unnecessary. After a brief discussion on the Rust IRC, someone told me that this is probably a bug.
Reduced Test Case
Output
rustc version
rustc 0.13.0-nightly (336349c93 2014-11-17 20:37:19 +0000)
The text was updated successfully, but these errors were encountered: