]> git.lizzy.rs Git - rust.git/blob - src/test/ui/impl-trait/recursive-impl-trait-type-through-non-recursive.rs
Be more careful about unresolved exprs in suggestion
[rust.git] / src / test / ui / impl-trait / recursive-impl-trait-type-through-non-recursive.rs
1 // Test that impl trait does not allow creating recursive types that are
2 // otherwise forbidden. Even when there's an opaque type in another crate
3 // hiding this.
4
5 fn id<T>(t: T) -> impl Sized { t }
6
7 fn recursive_id() -> impl Sized { //~ ERROR cannot resolve opaque type
8     id(recursive_id2())
9 }
10
11 fn recursive_id2() -> impl Sized { //~ ERROR cannot resolve opaque type
12     id(recursive_id())
13 }
14
15 fn wrap<T>(t: T) -> impl Sized { (t,) }
16
17 fn recursive_wrap() -> impl Sized { //~ ERROR cannot resolve opaque type
18     wrap(recursive_wrap2())
19 }
20
21 fn recursive_wrap2() -> impl Sized { //~ ERROR cannot resolve opaque type
22     wrap(recursive_wrap())
23 }
24
25 fn main() {}