mirror of https://github.com/rust-lang/rust.git
Add regression test for MIR drop generation in async loops
Fixes #61986.
This commit is contained in:
parent
d3e2cec292
commit
72ca844ca7
|
@ -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();
|
||||
}
|
Loading…
Reference in New Issue