forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add regression test for MIR drop generation in async loops
Fixes rust-lang#61986.
- Loading branch information
Showing
1 changed file
with
21 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
} |