fork/rust

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

borsAuto merge of #71868 - Mark-Simulacrum:stable-1.43.1, r=pietroalbini8d69840ab92

1.43.1
891 B22 linesraw
1error[E0373]: closure may outlive the current function, but it borrows `x`, which is owned by the current function
2  --> $DIR/async-borrowck-escaping-block-error.rs:6:20
3   |
4LL |     Box::new(async { x } )
5   |                    ^^-^^
6   |                    | |
7   |                    | `x` is borrowed here
8   |                    may outlive borrowed value `x`
9   |
10note: generator is returned here
11  --> $DIR/async-borrowck-escaping-block-error.rs:4:13
12   |
13LL | fn foo() -> Box<impl std::future::Future<Output = u32>> {
14   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
15help: to force the async block to take ownership of `x` (and any other referenced variables), use the `move` keyword
16   |
17LL |     Box::new(async move { x } )
18   |                    ^^^^^^^^^^
19
20error: aborting due to previous error
21
22For more information about this error, try `rustc --explain E0373`.