mirror of
https://github.com/rust-lang/rust.git
synced 2025-04-28 11:07:42 +00:00
18 lines
851 B
Plaintext
18 lines
851 B
Plaintext
![]() |
error[E0525]: expected a closure that implements the `AsyncFn` trait, but this closure only implements `AsyncFnOnce`
|
||
|
--> $DIR/kind-due-to-rpit.rs:7:20
|
||
|
|
|
||
|
LL | fn repro(foo: impl Into<bool>) -> impl AsyncFn() {
|
||
|
| -------------- the requirement to implement `AsyncFn` derives from here
|
||
|
LL | let inner_fn = async move || {
|
||
|
| ^^^^^^^^^^^^^ this closure implements `AsyncFnOnce`, not `AsyncFn`
|
||
|
LL |
|
||
|
LL | let _ = foo.into();
|
||
|
| --- closure is `AsyncFnOnce` because it moves the variable `foo` out of its environment
|
||
|
LL | };
|
||
|
LL | inner_fn
|
||
|
| -------- return type was inferred to be `{async closure@$DIR/kind-due-to-rpit.rs:7:20: 7:33}` here
|
||
|
|
||
|
error: aborting due to 1 previous error
|
||
|
|
||
|
For more information about this error, try `rustc --explain E0525`.
|