Skip to content

Commit 72ca844

Browse files
committed
Add regression test for MIR drop generation in async loops
Fixes rust-lang#61986.
1 parent d3e2cec commit 72ca844

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

Diff for: src/test/ui/async-await/issues/issue-61986.rs

+21
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)