Skip to content

Commit

Permalink
add test for rust-lang#96084
Browse files Browse the repository at this point in the history
  • Loading branch information
b-naber committed Jun 29, 2023
1 parent 2bc0875 commit ac015de
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions tests/ui/async-await/issue-96084.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
// run-pass
// edition:2018

use std::mem;

async fn foo() {
let x = [0u8; 100];
async {}.await;
println!("{}", x.len());
}

async fn a() {
let fut = foo();
let fut = fut;
fut.await;
}

async fn b() {
let fut = foo();
println!("{}", mem::size_of_val(&fut));
let fut = fut;
fut.await;
}

fn main() {
assert_eq!(mem::size_of_val(&foo()), 102);

// 1 + sizeof(foo)
assert_eq!(mem::size_of_val(&a()), 103);

// 1 + (sizeof(foo) * 2)
assert_eq!(mem::size_of_val(&b()), 103);
}

0 comments on commit ac015de

Please sign in to comment.