Skip to content

Commit

Permalink
test .await while holding variables of different sizes
Browse files Browse the repository at this point in the history
  • Loading branch information
alsuren committed Aug 4, 2019
1 parent a17951c commit 0a1bdd4
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/test/ui/async-await/async-fn-size-moved-locals.rs
Expand Up @@ -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()));
}

0 comments on commit 0a1bdd4

Please sign in to comment.