]> git.lizzy.rs Git - rust.git/blob - src/test/ui/async-await/move-part-await-return-rest-struct.rs
Rollup merge of #63261 - RalfJung:rand, r=nikomatsakis
[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 #![feature(async_await)]
6
7 struct Small {
8     x: Vec<usize>,
9     y: Vec<usize>,
10 }
11
12 // You are allowed to move out part of a struct to an async fn, you still
13 // have access to remaining parts after awaiting
14 async fn move_part_await_return_rest_struct() -> Vec<usize> {
15     let s = Small { x: vec![31], y: vec![19, 1441] };
16     needs_vec(s.x).await;
17     s.y
18 }
19
20 async fn needs_vec(_vec: Vec<usize>) {}