]> git.lizzy.rs Git - rust.git/blob - src/test/ui/suggestions/async-fn-ctor-passed-as-arg-where-it-should-have-been-called.stderr
Auto merge of #87641 - HackAttack:expand-unknown-option-message, r=wesleywiser
[rust.git] / src / test / ui / suggestions / async-fn-ctor-passed-as-arg-where-it-should-have-been-called.stderr
1 error[E0277]: `fn() -> impl Future {foo}` is not a future
2   --> $DIR/async-fn-ctor-passed-as-arg-where-it-should-have-been-called.rs:10:9
3    |
4 LL | async fn foo() {}
5    |          --- consider calling this function
6 LL | 
7 LL | fn bar(f: impl Future<Output=()>) {}
8    |                ----------------- required by this bound in `bar`
9 ...
10 LL |     bar(foo);
11    |         ^^^ `fn() -> impl Future {foo}` is not a future
12    |
13    = help: the trait `Future` is not implemented for `fn() -> impl Future {foo}`
14 help: use parentheses to call the function
15    |
16 LL |     bar(foo());
17    |            ^^
18
19 error[E0277]: `[closure@$DIR/async-fn-ctor-passed-as-arg-where-it-should-have-been-called.rs:11:25: 11:36]` is not a future
20   --> $DIR/async-fn-ctor-passed-as-arg-where-it-should-have-been-called.rs:12:9
21    |
22 LL | fn bar(f: impl Future<Output=()>) {}
23    |                ----------------- required by this bound in `bar`
24 ...
25 LL |     let async_closure = async || ();
26    |                         -------- consider calling this closure
27 LL |     bar(async_closure);
28    |         ^^^^^^^^^^^^^ `[closure@$DIR/async-fn-ctor-passed-as-arg-where-it-should-have-been-called.rs:11:25: 11:36]` is not a future
29    |
30    = help: the trait `Future` is not implemented for `[closure@$DIR/async-fn-ctor-passed-as-arg-where-it-should-have-been-called.rs:11:25: 11:36]`
31 help: use parentheses to call the closure
32    |
33 LL |     bar(async_closure());
34    |                      ^^
35
36 error: aborting due to 2 previous errors
37
38 For more information about this error, try `rustc --explain E0277`.