File tree 2 files changed +43
-0
lines changed
2 files changed +43
-0
lines changed Original file line number Diff line number Diff line change
1
+ fn bar ( ) -> impl Fn ( ) {
2
+ wrap ( wrap ( wrap ( wrap ( foo ( ) ) ) ) )
3
+ }
4
+
5
+ fn foo ( ) -> impl Fn ( ) {
6
+ //~^ WARNING 5:1: 5:22: function cannot return without recursing [unconditional_recursion]
7
+ //~| ERROR 5:13: 5:22: cannot resolve opaque type [E0720]
8
+ wrap ( wrap ( wrap ( wrap ( wrap ( wrap ( wrap ( foo ( ) ) ) ) ) ) ) )
9
+ }
10
+
11
+ fn wrap ( f : impl Fn ( ) ) -> impl Fn ( ) {
12
+ move || f ( )
13
+ }
14
+
15
+ fn main ( ) {
16
+ }
Original file line number Diff line number Diff line change
1
+ warning: function cannot return without recursing
2
+ --> $DIR/issue-87450.rs:5:1
3
+ |
4
+ LL | fn foo() -> impl Fn() {
5
+ | ^^^^^^^^^^^^^^^^^^^^^ cannot return without recursing
6
+ ...
7
+ LL | wrap(wrap(wrap(wrap(wrap(wrap(wrap(foo())))))))
8
+ | ----- recursive call site
9
+ |
10
+ = note: `#[warn(unconditional_recursion)]` on by default
11
+ = help: a `loop` may express intention better if this is on purpose
12
+
13
+ error[E0720]: cannot resolve opaque type
14
+ --> $DIR/issue-87450.rs:5:13
15
+ |
16
+ LL | fn foo() -> impl Fn() {
17
+ | ^^^^^^^^^ recursive opaque type
18
+ ...
19
+ LL | wrap(wrap(wrap(wrap(wrap(wrap(wrap(foo())))))))
20
+ | ----------------------------------------------- returning here with type `impl Fn<()>`
21
+ ...
22
+ LL | fn wrap(f: impl Fn()) -> impl Fn() {
23
+ | --------- returning this opaque type `impl Fn<()>`
24
+
25
+ error: aborting due to previous error; 1 warning emitted
26
+
27
+ For more information about this error, try `rustc --explain E0720`.
You can’t perform that action at this time.
0 commit comments