1 // rust-lang/rust#45696: This test checks the compiler won't infinite loop when
2 // you declare a variable of type `struct A(Box<A>, ...);` (which is impossible
3 // to construct but *is* possible to declare; see also issues #4287, #44933,
8 // This test has structs and functions that are by definition unusable
9 // all over the place, so just go ahead and allow dead_code
12 // direct regular recursion with indirect ownership via box
13 struct C { field: Box<C> }
15 // direct non-regular recursion with indirect ownership via box
16 struct D { field: Box<(D, D)> }
18 // indirect regular recursion with indirect ownership via box.
20 struct F { field: Box<E> }
22 // indirect non-regular recursion with indirect ownership via box.
23 struct G { field: (H, H) }
24 struct H { field: Box<G> }
26 // These enums are cases that are not currently hit by the
27 // `visit_terminator_drop` recursion down a type's structural
30 // But it seems prudent to include them in this test as variants on
31 // the above, in that they are similarly non-constructable data types
32 // with destructors that would diverge.
33 enum I { One(Box<I>) }
34 enum J { One(Box<J>), Two(Box<J>) }
36 fn impossible_to_call_c(_c: C) { }
37 fn impossible_to_call_d(_d: D) { }
38 fn impossible_to_call_e(_e: E) { }
39 fn impossible_to_call_f(_f: F) { }
40 fn impossible_to_call_g(_g: G) { }
41 fn impossible_to_call_h(_h: H) { }
42 fn impossible_to_call_i(_i: I) { }
43 fn impossible_to_call_j(_j: J) { }