Skip to content

Commit

Permalink
Add regression test for MIR drop generation in async loops
Browse files Browse the repository at this point in the history
Fixes #61986.
  • Loading branch information
cramertj committed Jun 26, 2019
1 parent d3e2cec commit 72ca844
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/test/ui/async-await/issues/issue-61986.rs
Original file line number Diff line number Diff line change
@@ -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();
}

0 comments on commit 72ca844

Please sign in to comment.