fork/rust

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

borsAuto merge of #69854 - pietroalbini:stable-next, r=Centrilb8cedc00407

1.42.0
1.3 KiB36 linesraw
1error: future cannot be sent between threads safely
2  --> $DIR/issue-64130-4-async-move.rs:15:17
3   |
4LL |   pub fn foo() -> impl Future + Send {
5   |                   ^^^^^^^^^^^^^^^^^^ future returned by `foo` is not `Send`
6...
7LL | /     async move {
8LL | |         match client.status() {
9LL | |             200 => {
10LL | |                 let _x = get().await;
11...  |
12LL | |         }
13LL | |     }
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)`
17note: future is not `Send` as this value is used across an await
18  --> $DIR/issue-64130-4-async-move.rs:21:26
19   |
20LL |         match client.status() {
21   |               ------ has type `&Client`
22LL |             200 => {
23LL |                 let _x = get().await;
24   |                          ^^^^^^^^^^^ await occurs here, with `client` maybe used later
25...
26LL |     }
27   |     - `client` is later dropped here
28help: consider moving this into a `let` binding to create a shorter lived borrow
29  --> $DIR/issue-64130-4-async-move.rs:19:15
30   |
31LL |         match client.status() {
32   |               ^^^^^^^^^^^^^^^
33   = note: the return type of a function must have a statically known size
34
35error: aborting due to previous error
36