]> git.lizzy.rs Git - rust.git/commitdiff
test .await while holding variables of different sizes
authorDavid Laban <alsuren@gmail.com>
Sun, 4 Aug 2019 15:08:31 +0000 (16:08 +0100)
committerDavid Laban <alsuren@gmail.com>
Sun, 4 Aug 2019 15:10:07 +0000 (16:10 +0100)
src/test/ui/async-await/async-fn-size-moved-locals.rs

index d0d4eb032fcb1e0a1fc8f2e843a439b30c803565..30b59d037d51239ff0fc56b28751a4e141a25734 100644 (file)
@@ -93,9 +93,27 @@ async fn joined_with_noop() {
     joiner.await
 }
 
+async fn mixed_sizes() {
+    let a = BigFut::new();
+    let b = BigFut::new();
+    let c = BigFut::new();
+    let d = BigFut::new();
+    let e = BigFut::new();
+    let joiner = Joiner {
+        a: Some(a),
+        b: Some(b),
+        c: Some(c),
+    };
+
+    d.await;
+    e.await;
+    joiner.await;
+}
+
 fn main() {
     assert_eq!(1028, std::mem::size_of_val(&single()));
     assert_eq!(1032, std::mem::size_of_val(&single_with_noop()));
     assert_eq!(3084, std::mem::size_of_val(&joined()));
     assert_eq!(3084, std::mem::size_of_val(&joined_with_noop()));
+    assert_eq!(7188, std::mem::size_of_val(&mixed_sizes()));
 }