]> git.lizzy.rs Git - rust.git/blob - src/test/ui/async-await/issues/issue-61986.rs
Add regression test for MIR drop generation in async loops
[rust.git] / src / test / ui / async-await / issues / issue-61986.rs
1 // compile-pass
2 // edition:2018
3 //
4 // Tests that we properly handle StorageDead/StorageLives for temporaries
5 // created in async loop bodies.
6
7 #![feature(async_await)]
8
9 async fn bar() -> Option<()> {
10     Some(())
11 }
12
13 async fn listen() {
14     while let Some(_) = bar().await {
15         String::new();
16     }
17 }
18
19 fn main() {
20     listen();
21 }