fork/rust

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

borsAuto merge of #69444 - pietroalbini:stable-next-final-v2-new, r=pietroalbinif3e1a954d2e

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