Rollup merge of #62155 - cramertj:61872, r=centril

Add regression test for MIR drop generation in async loops

Fixes #61986.

r? @Centril
This commit is contained in:
Mazdak Farrokhzad 2019-06-27 23:01:13 +02:00 committed by GitHub
commit a1a0e0c945
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 21 additions and 0 deletions

View File

@ -0,0 +1,21 @@
// compile-pass
// edition:2018
//
// Tests that we properly handle StorageDead/StorageLives for temporaries
// created in async loop bodies.
#![feature(async_await)]
async fn bar() -> Option<()> {
Some(())
}
async fn listen() {
while let Some(_) = bar().await {
String::new();
}
}
fn main() {
listen();
}