]>
Commit | Line | Data |
---|---|---|
3c0e092e | 1 | error[E0277]: `fn() -> impl Future<Output = ()> {foo}` is not a future |
60c5eb7d | 2 | --> $DIR/async-fn-ctor-passed-as-arg-where-it-should-have-been-called.rs:10:9 |
e1599b0c | 3 | | |
60c5eb7d XL |
4 | LL | async fn foo() {} |
5 | | --- consider calling this function | |
e1599b0c XL |
6 | ... |
7 | LL | bar(foo); | |
3c0e092e | 8 | | --- ^^^ `fn() -> impl Future<Output = ()> {foo}` is not a future |
c295e0f8 XL |
9 | | | |
10 | | required by a bound introduced by this call | |
ba9703b0 | 11 | | |
f2b60f7d | 12 | = help: the trait `Future` is not implemented for fn item `fn() -> impl Future<Output = ()> {foo}` |
a2a8927a | 13 | = note: fn() -> impl Future<Output = ()> {foo} must be a future or must implement `IntoFuture` to be awaited |
94222f64 XL |
14 | note: required by a bound in `bar` |
15 | --> $DIR/async-fn-ctor-passed-as-arg-where-it-should-have-been-called.rs:7:16 | |
16 | | | |
17 | LL | fn bar(f: impl Future<Output=()>) {} | |
18 | | ^^^^^^^^^^^^^^^^^ required by this bound in `bar` | |
ba9703b0 XL |
19 | help: use parentheses to call the function |
20 | | | |
21 | LL | bar(foo()); | |
94222f64 | 22 | | ++ |
e1599b0c | 23 | |
064997fb | 24 | error[E0277]: `[closure@$DIR/async-fn-ctor-passed-as-arg-where-it-should-have-been-called.rs:11:25: 11:33]` is not a future |
60c5eb7d XL |
25 | --> $DIR/async-fn-ctor-passed-as-arg-where-it-should-have-been-called.rs:12:9 |
26 | | | |
60c5eb7d XL |
27 | LL | let async_closure = async || (); |
28 | | -------- consider calling this closure | |
29 | LL | bar(async_closure); | |
064997fb | 30 | | --- ^^^^^^^^^^^^^ `[closure@$DIR/async-fn-ctor-passed-as-arg-where-it-should-have-been-called.rs:11:25: 11:33]` is not a future |
c295e0f8 XL |
31 | | | |
32 | | required by a bound introduced by this call | |
ba9703b0 | 33 | | |
f2b60f7d | 34 | = help: the trait `Future` is not implemented for closure `[closure@$DIR/async-fn-ctor-passed-as-arg-where-it-should-have-been-called.rs:11:25: 11:33]` |
064997fb | 35 | = note: [closure@$DIR/async-fn-ctor-passed-as-arg-where-it-should-have-been-called.rs:11:25: 11:33] must be a future or must implement `IntoFuture` to be awaited |
94222f64 XL |
36 | note: required by a bound in `bar` |
37 | --> $DIR/async-fn-ctor-passed-as-arg-where-it-should-have-been-called.rs:7:16 | |
38 | | | |
39 | LL | fn bar(f: impl Future<Output=()>) {} | |
40 | | ^^^^^^^^^^^^^^^^^ required by this bound in `bar` | |
ba9703b0 XL |
41 | help: use parentheses to call the closure |
42 | | | |
43 | LL | bar(async_closure()); | |
94222f64 | 44 | | ++ |
60c5eb7d XL |
45 | |
46 | error: aborting due to 2 previous errors | |
e1599b0c XL |
47 | |
48 | For more information about this error, try `rustc --explain E0277`. |