rust/tests/ui/async-await/async-closures/wrong-fn-kind.stderr

25 lines
942 B
Plaintext
Raw Normal View History

2024-02-14 17:52:57 -06:00
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
2024-01-25 11:43:35 -06:00
|
LL | needs_async_fn(async || {
2024-02-14 17:52:57 -06:00
| -------------- -^^^^^^^
| | |
| _____|______________this closure implements `async FnMut`, not `async Fn`
2024-01-25 11:43:35 -06:00
| | |
| | required by a bound introduced by this call
LL | |
LL | | x += 1;
2024-02-14 17:52:57 -06:00
| | - closure is `async FnMut` because it mutates the variable `x` here
2024-01-25 11:43:35 -06:00
LL | | });
2024-02-14 17:52:57 -06:00
| |_____- the requirement to implement `async Fn` derives from here
2024-01-25 11:43:35 -06:00
|
note: required by a bound in `needs_async_fn`
--> $DIR/wrong-fn-kind.rs:8:31
2024-01-25 11:43:35 -06:00
|
LL | fn needs_async_fn(_: impl async Fn()) {}
| ^^^^^^^^^^ required by this bound in `needs_async_fn`
2024-01-25 11:43:35 -06:00
error: aborting due to 1 previous error
2024-02-14 17:52:57 -06:00
For more information about this error, try `rustc --explain E0525`.