]> git.lizzy.rs Git - rust.git/blob - tests/ui/async-await/future-sizes/async-awaiting-fut.rs
Rollup merge of #107695 - Swatinem:futcallx3, r=compiler-errors
[rust.git] / tests / ui / async-await / future-sizes / async-awaiting-fut.rs
1 // compile-flags: -Z print-type-sizes --crate-type lib
2 // edition:2021
3 // build-pass
4 // ignore-pass
5
6 async fn wait() {}
7
8 async fn big_fut(arg: [u8; 1024]) {}
9
10 async fn calls_fut(fut: impl std::future::Future<Output = ()>) {
11     loop {
12         wait().await;
13         if true {
14             return fut.await;
15         } else {
16             wait().await;
17         }
18     }
19 }
20
21 pub async fn test() {
22     let fut = big_fut([0u8; 1024]);
23     calls_fut(fut).await;
24 }