mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-30 18:53:39 +00:00
7a7b2e3521
This adds one more test that should track improvements to generator layout, like #62958 and #62575. In particular, this test highlights suboptimal layout, as the storage for the argument future is not being reused across its usage as `upvar`, `local` and `awaitee` (being polled to completion).
25 lines
453 B
Rust
25 lines
453 B
Rust
// compile-flags: -Z print-type-sizes --crate-type lib
|
|
// edition:2021
|
|
// build-pass
|
|
// ignore-pass
|
|
|
|
async fn wait() {}
|
|
|
|
async fn big_fut(arg: [u8; 1024]) {}
|
|
|
|
async fn calls_fut(fut: impl std::future::Future<Output = ()>) {
|
|
loop {
|
|
wait().await;
|
|
if true {
|
|
return fut.await;
|
|
} else {
|
|
wait().await;
|
|
}
|
|
}
|
|
}
|
|
|
|
pub async fn test() {
|
|
let fut = big_fut([0u8; 1024]);
|
|
calls_fut(fut).await;
|
|
}
|