]> git.lizzy.rs Git - rust.git/blob - src/test/ui/async-await/move-part-await-return-rest-struct.rs
Rollup merge of #102215 - alexcrichton:wasm-link-whole-archive, r=estebank
[rust.git] / src / test / ui / async-await / move-part-await-return-rest-struct.rs
1 // build-pass
2 // edition:2018
3 // compile-flags: --crate-type lib
4
5 struct Small {
6     x: Vec<usize>,
7     y: Vec<usize>,
8 }
9
10 // You are allowed to move out part of a struct to an async fn, you still
11 // have access to remaining parts after awaiting
12 async fn move_part_await_return_rest_struct() -> Vec<usize> {
13     let s = Small { x: vec![31], y: vec![19, 1441] };
14     needs_vec(s.x).await;
15     s.y
16 }
17
18 async fn needs_vec(_vec: Vec<usize>) {}