2019-08-24 16:45:03 -05:00
error[E0277]: the trait bound `fn() -> impl std::future::Future {foo}: std::future::Future` is not satisfied
2019-11-08 20:04:05 -06:00
--> $DIR/async-fn-ctor-passed-as-arg-where-it-should-have-been-called.rs:10:9
2019-08-24 16:45:03 -05:00
|
2019-11-08 20:04:05 -06:00
LL | async fn foo() {}
| --- consider calling this function
LL |
2019-08-24 16:45:03 -05:00
LL | fn bar(f: impl Future<Output=()>) {}
2019-09-04 12:17:59 -05:00
| --- ----------------- required by this bound in `bar`
2019-08-24 16:45:03 -05:00
...
LL | bar(foo);
2020-03-11 22:38:21 -05:00
| ^^^ the trait `std::future::Future` is not implemented for `fn() -> impl std::future::Future {foo}`
|
help: use parentheses to call the function
|
LL | bar(foo());
| ^^
2019-08-24 16:45:03 -05:00
2019-11-08 20:04:05 -06:00
error[E0277]: the trait bound `[closure@$DIR/async-fn-ctor-passed-as-arg-where-it-should-have-been-called.rs:11:25: 11:36]: std::future::Future` is not satisfied
--> $DIR/async-fn-ctor-passed-as-arg-where-it-should-have-been-called.rs:12:9
|
LL | fn bar(f: impl Future<Output=()>) {}
| --- ----------------- required by this bound in `bar`
...
LL | let async_closure = async || ();
| -------- consider calling this closure
LL | bar(async_closure);
2020-03-11 22:38:21 -05:00
| ^^^^^^^^^^^^^ the trait `std::future::Future` is not implemented for `[closure@$DIR/async-fn-ctor-passed-as-arg-where-it-should-have-been-called.rs:11:25: 11:36]`
|
help: use parentheses to call the closure
|
LL | bar(async_closure());
| ^^
2019-11-08 20:04:05 -06:00
error: aborting due to 2 previous errors
2019-08-24 16:45:03 -05:00
For more information about this error, try `rustc --explain E0277`.