25 lines
942 B
Plaintext
25 lines
942 B
Plaintext
error[E0525]: expected a closure that implements the `async Fn` trait, but this closure only implements `async FnMut`
|
|
--> $DIR/wrong-fn-kind.rs:11: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:8:31
|
|
|
|
|
LL | fn needs_async_fn(_: impl async Fn()) {}
|
|
| ^^^^^^^^^^ required by this bound in `needs_async_fn`
|
|
|
|
error: aborting due to 1 previous error
|
|
|
|
For more information about this error, try `rustc --explain E0525`.
|