rust/tests/ui/structs-enums/struct-rec/mutual-struct-recursion.rs

22 lines
300 B
Rust
Raw Normal View History

struct A<T> {
2022-08-15 14:11:11 -05:00
//~^ ERROR recursive types `A` and `B` have infinite size
x: T,
y: B<T>,
}
struct B<T> {
z: A<T>
}
struct C<T> {
2022-08-15 14:11:11 -05:00
//~^ ERROR recursive types `C` and `D` have infinite size
x: T,
y: Option<Option<D<T>>>,
}
struct D<T> {
z: Option<Option<C<T>>>,
}
fn main() {}