error[E0525]: expected a closure that implements the `async Fn` trait, but this closure only implements `async FnMut` --> $DIR/wrong-fn-kind.rs:9:20 | LL | needs_async_fn(async || { | -------------- -^^^^^^^ | | | | _____|______________this closure implements `async FnMut`, not `async Fn` | | | | | required by a bound introduced by this call LL | | LL | | x += 1; | | - closure is `async FnMut` because it mutates the variable `x` here LL | | }); | |_____- the requirement to implement `async Fn` derives from here | note: required by a bound in `needs_async_fn` --> $DIR/wrong-fn-kind.rs:6:31 | LL | fn needs_async_fn(_: impl async Fn()) {} | ^^^^^^^^^^ required by this bound in `needs_async_fn` error[E0525]: expected a closure that implements the `async Fn` trait, but this closure only implements `async FnOnce` --> $DIR/wrong-fn-kind.rs:15:20 | LL | needs_async_fn(move || async move { | -------------- -^^^^^^ | | | | _____|______________this closure implements `async FnOnce`, not `async Fn` | | | | | required by a bound introduced by this call LL | | LL | | println!("{x}"); | | - closure is `async FnOnce` because it moves the variable `x` out of its environment LL | | }); | |_____- the requirement to implement `async Fn` derives from here | note: required by a bound in `needs_async_fn` --> $DIR/wrong-fn-kind.rs:6:31 | LL | fn needs_async_fn(_: impl async Fn()) {} | ^^^^^^^^^^ required by this bound in `needs_async_fn` error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0525`.