1 // Test that impl trait does not allow creating recursive types that are
2 // otherwise forbidden.
4 #![feature(generators)]
5 #![allow(unconditional_recursion)]
7 fn option(i: i32) -> impl Sized {
8 //~^ ERROR cannot resolve opaque type
9 if i < 0 { None } else { Some((option(i - 1), i)) }
12 fn tuple() -> impl Sized {
17 fn array() -> impl Sized {
22 fn ptr() -> impl Sized {
27 fn fn_ptr() -> impl Sized {
32 fn closure_capture() -> impl Sized {
34 let x = closure_capture();
40 fn closure_ref_capture() -> impl Sized {
42 let x = closure_ref_capture();
48 fn closure_sig() -> impl Sized {
53 fn generator_sig() -> impl Sized {
58 fn generator_capture() -> impl Sized {
60 let x = generator_capture();
67 fn substs_change<T: 'static>() -> impl Sized {
69 (substs_change::<&T>(),)
72 fn generator_hold() -> impl Sized {
75 let x = generator_hold();
81 fn use_fn_ptr() -> impl Sized {
82 // OK, error already reported
86 fn mutual_recursion() -> impl Sync {
91 fn mutual_recursion_b() -> impl Sized {