fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #72883 - Mark-Simulacrum:stable-next, r=Mark-Simulacrum49cae55760d

1.44.0
1.5 KiB36 linesraw
1error[E0277]: the trait bound `fn() -> impl std::future::Future {foo}: std::future::Future` is not satisfied
2  --> $DIR/async-fn-ctor-passed-as-arg-where-it-should-have-been-called.rs:10:9
3   |
4LL | async fn foo() {}
5   |          --- consider calling this function
6LL | 
7LL | fn bar(f: impl Future<Output=()>) {}
8   |                ----------------- required by this bound in `bar`
9...
10LL |     bar(foo);
11   |         ^^^ the trait `std::future::Future` is not implemented for `fn() -> impl std::future::Future {foo}`
12   |
13help: use parentheses to call the function
14   |
15LL |     bar(foo());
16   |            ^^
17
18error[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
19  --> $DIR/async-fn-ctor-passed-as-arg-where-it-should-have-been-called.rs:12:9
20   |
21LL | fn bar(f: impl Future<Output=()>) {}
22   |                ----------------- required by this bound in `bar`
23...
24LL |     let async_closure = async || ();
25   |                         -------- consider calling this closure
26LL |     bar(async_closure);
27   |         ^^^^^^^^^^^^^ 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]`
28   |
29help: use parentheses to call the closure
30   |
31LL |     bar(async_closure());
32   |                      ^^
33
34error: aborting due to 2 previous errors
35
36For more information about this error, try `rustc --explain E0277`.