]> git.lizzy.rs Git - rust.git/blob - src/test/ui/async-await/issue-64130-4-async-move.stderr
Rollup merge of #71627 - ldm0:autoderefarg, r=Dylan-DPC
[rust.git] / src / test / ui / async-await / issue-64130-4-async-move.stderr
1 error: future cannot be sent between threads safely
2   --> $DIR/issue-64130-4-async-move.rs:15:17
3    |
4 LL |   pub fn foo() -> impl Future + Send {
5    |                   ^^^^^^^^^^^^^^^^^^ future created by async block is not `Send`
6 ...
7 LL | /     async move {
8 LL | |         match client.status() {
9 LL | |             200 => {
10 LL | |                 let _x = get().await;
11 ...  |
12 LL | |         }
13 LL | |     }
14    | |_____- this returned value is of type `impl std::future::Future`
15    |
16    = help: the trait `std::marker::Sync` is not implemented for `(dyn std::any::Any + std::marker::Send + 'static)`
17 note: future is not `Send` as this value is used across an await
18   --> $DIR/issue-64130-4-async-move.rs:21:26
19    |
20 LL |         match client.status() {
21    |               ------ has type `&Client` which is not `Send`
22 LL |             200 => {
23 LL |                 let _x = get().await;
24    |                          ^^^^^^^^^^^ await occurs here, with `client` maybe used later
25 ...
26 LL |     }
27    |     - `client` is later dropped here
28 help: consider moving this into a `let` binding to create a shorter lived borrow
29   --> $DIR/issue-64130-4-async-move.rs:19:15
30    |
31 LL |         match client.status() {
32    |               ^^^^^^^^^^^^^^^
33    = note: the return type of a function must have a statically known size
34
35 error: aborting due to previous error
36