about summary refs log tree commit diff
diff options
context:
space:
mode:
authorGiles Cope <gilescope@gmail.com>2019-03-04 18:53:12 +0000
committerGiles Cope <gilescope@gmail.com>2019-03-04 18:53:12 +0000
commit6dd2a857aa60925e42e3d319534bee46f0664caf (patch)
treecc1be2f8d86cbe34484afa29125705b2b3797b6c
parent7dbba3d03c5d3e9fdb96556eac1be49449c41edc (diff)
downloadrust-6dd2a857aa60925e42e3d319534bee46f0664caf.tar.gz
rust-6dd2a857aa60925e42e3d319534bee46f0664caf.zip
Regression test added for an async ICE.
-rw-r--r--src/test/run-pass/issues/issue-57084-async-await.rs27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/test/run-pass/issues/issue-57084-async-await.rs b/src/test/run-pass/issues/issue-57084-async-await.rs
new file mode 100644
index 00000000000..feed68b5db1
--- /dev/null
+++ b/src/test/run-pass/issues/issue-57084-async-await.rs
@@ -0,0 +1,27 @@
+// This issue reproduces an ICE on compile (E.g. fails on 2018-12-19 nightly).
+// run-pass
+// edition:2018
+#![feature(async_await,futures_api,await_macro,generators)]
+
+pub struct Foo;
+
+impl Foo {
+    async fn with<'a, F, R>(&'a self, f: F) -> R
+    where F: Fn() -> R + 'a,
+    {
+        loop {
+            match f() {
+                _ => yield,
+            }
+        }
+    }
+
+    pub async fn run<'a>(&'a self, data: &'a [u8])
+    {
+        await!(self.with(move || {
+            println!("{:p}", data);
+        }))
+    }
+}
+
+fn main() {}