summaryrefslogtreecommitdiffstats
path: root/src/test/ui/async-await/move-part-await-return-rest-struct.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/ui/async-await/move-part-await-return-rest-struct.rs')
-rw-r--r--src/test/ui/async-await/move-part-await-return-rest-struct.rs18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/test/ui/async-await/move-part-await-return-rest-struct.rs b/src/test/ui/async-await/move-part-await-return-rest-struct.rs
new file mode 100644
index 000000000..39ea2aae5
--- /dev/null
+++ b/src/test/ui/async-await/move-part-await-return-rest-struct.rs
@@ -0,0 +1,18 @@
+// build-pass
+// edition:2018
+// compile-flags: --crate-type lib
+
+struct Small {
+ x: Vec<usize>,
+ y: Vec<usize>,
+}
+
+// You are allowed to move out part of a struct to an async fn, you still
+// have access to remaining parts after awaiting
+async fn move_part_await_return_rest_struct() -> Vec<usize> {
+ let s = Small { x: vec![31], y: vec![19, 1441] };
+ needs_vec(s.x).await;
+ s.y
+}
+
+async fn needs_vec(_vec: Vec<usize>) {}