diff options
Diffstat (limited to 'tests/ui/async-await/issues/issue-61986.rs')
-rw-r--r-- | tests/ui/async-await/issues/issue-61986.rs | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/ui/async-await/issues/issue-61986.rs b/tests/ui/async-await/issues/issue-61986.rs new file mode 100644 index 000000000..879bc6912 --- /dev/null +++ b/tests/ui/async-await/issues/issue-61986.rs @@ -0,0 +1,19 @@ +// build-pass (FIXME(62277): could be check-pass?) +// edition:2018 +// +// Tests that we properly handle StorageDead/StorageLives for temporaries +// created in async loop bodies. + +async fn bar() -> Option<()> { + Some(()) +} + +async fn listen() { + while let Some(_) = bar().await { + String::new(); + } +} + +fn main() { + listen(); +} |