Skip to content

Commit ac015de

Browse files
committed
add test for rust-lang#96084
1 parent 2bc0875 commit ac015de

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

tests/ui/async-await/issue-96084.rs

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
// run-pass
2+
// edition:2018
3+
4+
use std::mem;
5+
6+
async fn foo() {
7+
let x = [0u8; 100];
8+
async {}.await;
9+
println!("{}", x.len());
10+
}
11+
12+
async fn a() {
13+
let fut = foo();
14+
let fut = fut;
15+
fut.await;
16+
}
17+
18+
async fn b() {
19+
let fut = foo();
20+
println!("{}", mem::size_of_val(&fut));
21+
let fut = fut;
22+
fut.await;
23+
}
24+
25+
fn main() {
26+
assert_eq!(mem::size_of_val(&foo()), 102);
27+
28+
// 1 + sizeof(foo)
29+
assert_eq!(mem::size_of_val(&a()), 103);
30+
31+
// 1 + (sizeof(foo) * 2)
32+
assert_eq!(mem::size_of_val(&b()), 103);
33+
}

0 commit comments

Comments
 (0)