From: Taylor Cramer Date: Wed, 26 Jun 2019 17:23:27 +0000 (-0700) Subject: Add regression test for MIR drop generation in async loops X-Git-Url: https://git.lizzy.rs/?a=commitdiff_plain;h=72ca844ca7d9debbb849eb3aa16c5c4df14d1293;hp=d3e2cec29225a46298ec4ebf082f34ebd7cfeecf;p=rust.git Add regression test for MIR drop generation in async loops Fixes #61986. --- diff --git a/src/test/ui/async-await/issues/issue-61986.rs b/src/test/ui/async-await/issues/issue-61986.rs new file mode 100644 index 00000000000..da8b22bc104 --- /dev/null +++ b/src/test/ui/async-await/issues/issue-61986.rs @@ -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(); +}