-
Notifications
You must be signed in to change notification settings - Fork 13.7k
Closed
Labels
A-type-systemArea: Type systemArea: Type systemE-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.Call for participation: An issue has been fixed and does not reproduce, but no test has been added.
Description
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
trait A<T> {}
trait DoesAforB<T> {}
// no way to express
// struct B<T> where B<T>: A<B<T>>;
struct B<T: DoesAforB<B<T>>>;
fn main() {}
Output
rec.rs:8:23: 8:27 error: illegal recursive type; insert an enum or struct in the cycle, if this is desired
rec.rs:8 struct B<T: DoesAforB<B<T>>>;
^~~~
rustc version
rustc 0.13.0-nightly (336349c93 2014-11-17 20:37:19 +0000)
Metadata
Metadata
Assignees
Labels
A-type-systemArea: Type systemArea: Type systemE-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.Call for participation: An issue has been fixed and does not reproduce, but no test has been added.