]> git.lizzy.rs Git - rust.git/blob - tests/ui/async-await/async-borrowck-escaping-block-error.stderr
Rollup merge of #107048 - DebugSteven:newer-x-check-cargo, r=albertlarsan68
[rust.git] / tests / ui / async-await / async-borrowck-escaping-block-error.stderr
1 error[E0373]: async block 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:14
3    |
4 LL |     Box::new(async { x } )
5    |              ^^^^^^^^-^^
6    |              |       |
7    |              |       `x` is borrowed here
8    |              may outlive borrowed value `x`
9    |
10 note: async block is returned here
11   --> $DIR/async-borrowck-escaping-block-error.rs:6:5
12    |
13 LL |     Box::new(async { x } )
14    |     ^^^^^^^^^^^^^^^^^^^^^^
15 help: to force the async block to take ownership of `x` (and any other referenced variables), use the `move` keyword
16    |
17 LL |     Box::new(async move { x } )
18    |                    ++++
19
20 error[E0373]: async block may outlive the current function, but it borrows `x`, which is owned by the current function
21   --> $DIR/async-borrowck-escaping-block-error.rs:11:5
22    |
23 LL |     async { *x }
24    |     ^^^^^^^^--^^
25    |     |       |
26    |     |       `x` is borrowed here
27    |     may outlive borrowed value `x`
28    |
29 note: async block is returned here
30   --> $DIR/async-borrowck-escaping-block-error.rs:11:5
31    |
32 LL |     async { *x }
33    |     ^^^^^^^^^^^^
34 help: to force the async block to take ownership of `x` (and any other referenced variables), use the `move` keyword
35    |
36 LL |     async move { *x }
37    |           ++++
38
39 error: aborting due to 2 previous errors
40
41 For more information about this error, try `rustc --explain E0373`.