1 // Test that impl trait does not allow creating recursive types that are
2 // otherwise forbidden.
4 #![feature(futures_api, generators)]
6 fn option(i: i32) -> impl Sized { //~ ERROR
10 Some((option(i - 1), i))
14 fn tuple() -> impl Sized { //~ ERROR
18 fn array() -> impl Sized { //~ ERROR
22 fn ptr() -> impl Sized { //~ ERROR
26 fn fn_ptr() -> impl Sized { //~ ERROR
30 fn closure_capture() -> impl Sized { //~ ERROR
31 let x = closure_capture();
35 fn closure_ref_capture() -> impl Sized { //~ ERROR
36 let x = closure_ref_capture();
40 fn closure_sig() -> impl Sized { //~ ERROR
44 fn generator_sig() -> impl Sized { //~ ERROR
48 fn generator_capture() -> impl Sized { //~ ERROR
49 let x = generator_capture();
53 fn substs_change<T>() -> impl Sized { //~ ERROR
54 (substs_change::<&T>(),)
57 fn generator_hold() -> impl Sized { //~ ERROR
59 let x = generator_hold();
65 fn use_fn_ptr() -> impl Sized { // OK, error already reported
69 fn mutual_recursion() -> impl Sync { //~ ERROR
73 fn mutual_recursion_b() -> impl Sized { //~ ERROR