fork/rust

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

borsAuto merge of #103046 - JanBeh:PR_clarify_cmp_terminology, r=workingjubilee3bcad65fbf6

master
1.8 KiB43 linesraw
1error[E0277]: `impl Future<Output = ()>` cannot be sent between threads safely
2  --> $DIR/send-on-async-fn-in-trait.rs:14:16
3   |
4LL |     needs_send(T::test());
5   |     ---------- ^^^^^^^^^ `impl Future<Output = ()>` cannot be sent between threads safely
6   |     |
7   |     required by a bound introduced by this call
8   |
9   = help: the trait `Send` is not implemented for `impl Future<Output = ()>`
10note: required by a bound in `needs_send`
11  --> $DIR/send-on-async-fn-in-trait.rs:13:27
12   |
13LL |     fn needs_send(_: impl Send) {}
14   |                           ^^^^ required by this bound in `needs_send`
15help: `Send` can be made part of the associated future's guarantees for all implementations of `Foo::test`
16   |
17LL -     async fn test() -> () {}
18LL +     fn test() -> impl std::future::Future<Output = ()> + Send { async {} }
19   |
20
21error[E0277]: `impl Future<Output = i32>` cannot be sent between threads safely
22  --> $DIR/send-on-async-fn-in-trait.rs:16:16
23   |
24LL |     needs_send(T::test2());
25   |     ---------- ^^^^^^^^^^ `impl Future<Output = i32>` cannot be sent between threads safely
26   |     |
27   |     required by a bound introduced by this call
28   |
29   = help: the trait `Send` is not implemented for `impl Future<Output = i32>`
30note: required by a bound in `needs_send`
31  --> $DIR/send-on-async-fn-in-trait.rs:13:27
32   |
33LL |     fn needs_send(_: impl Send) {}
34   |                           ^^^^ required by this bound in `needs_send`
35help: `Send` can be made part of the associated future's guarantees for all implementations of `Foo::test2`
36   |
37LL -     async fn test2() -> i32 { 1 + 2 }
38LL +     fn test2() -> impl std::future::Future<Output = i32> + Send {async { 1 + 2 } }
39   |
40
41error: aborting due to 2 previous errors
42
43For more information about this error, try `rustc --explain E0277`.