Skip to content

Commit dd7dca9

Browse files
authored
Rollup merge of rust-lang#62155 - cramertj:61872, r=centril
Add regression test for MIR drop generation in async loops Fixes rust-lang#61986. r? @Centril
2 parents 72b56cf + 72ca844 commit dd7dca9

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
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+
}

0 commit comments

Comments
 (0)