1 // revisions: no_drop_tracking drop_tracking drop_tracking_mir
2 // [drop_tracking] compile-flags: -Zdrop-tracking
3 // [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
5 // Test that impl trait does not allow creating recursive types that are
6 // otherwise forbidden.
8 #![feature(generators)]
9 #![allow(unconditional_recursion)]
11 fn option(i: i32) -> impl Sized {
12 //~^ ERROR cannot resolve opaque type
13 if i < 0 { None } else { Some((option(i - 1), i)) }
16 fn tuple() -> impl Sized {
21 fn array() -> impl Sized {
26 fn ptr() -> impl Sized {
31 fn fn_ptr() -> impl Sized {
36 fn closure_capture() -> impl Sized {
38 let x = closure_capture();
44 fn closure_ref_capture() -> impl Sized {
46 let x = closure_ref_capture();
52 fn closure_sig() -> impl Sized {
57 fn generator_sig() -> impl Sized {
62 fn generator_capture() -> impl Sized {
64 let x = generator_capture();
71 fn substs_change<T: 'static>() -> impl Sized {
73 (substs_change::<&T>(),)
76 fn generator_hold() -> impl Sized {
79 let x = generator_hold();
85 fn use_fn_ptr() -> impl Sized {
86 // OK, error already reported
90 fn mutual_recursion() -> impl Sync {
95 fn mutual_recursion_b() -> impl Sized {