]> git.lizzy.rs Git - rust.git/blob - src/test/ui/async-await/issues/issue-78938-async-block.stderr
Rollup merge of #103766 - lukas-code:error-in-core, r=Dylan-DPC
[rust.git] / src / test / ui / async-await / issues / issue-78938-async-block.stderr
1 error[E0373]: async block may outlive the current function, but it borrows `room_ref`, which is owned by the current function
2   --> $DIR/issue-78938-async-block.rs:8:39
3    |
4 LL |       let gameloop_handle = spawn(async {
5    |  _______________________________________^
6 LL | |         game_loop(Arc::clone(&room_ref))
7    | |                               -------- `room_ref` is borrowed here
8 LL | |     });
9    | |_____^ may outlive borrowed value `room_ref`
10    |
11    = note: async blocks are not executed immediately and must either take a reference or ownership of outside variables they use
12 help: to force the async block to take ownership of `room_ref` (and any other referenced variables), use the `move` keyword
13    |
14 LL |     let gameloop_handle = spawn(async move {
15    |                                       ++++
16
17 error: aborting due to previous error
18
19 For more information about this error, try `rustc --explain E0373`.