about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorTyler Mandry <tmandry@gmail.com>2019-06-13 15:58:26 -0700
committerTyler Mandry <tmandry@gmail.com>2019-06-28 15:31:19 -0700
commit65021ec9282c190168e4f364c21d948679bdfaff (patch)
treeb09ee76f676da6c80792d8e45eb18b943533f74e /src
parent433a46781544da61801400316e7e546f01b81952 (diff)
downloadrust-65021ec9282c190168e4f364c21d948679bdfaff.tar.gz
rust-65021ec9282c190168e4f364c21d948679bdfaff.zip
Add regression test for #60709
Closes #60709.
Diffstat (limited to 'src')
-rw-r--r--src/test/run-pass/async-await/issue-60709.rs28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/test/run-pass/async-await/issue-60709.rs b/src/test/run-pass/async-await/issue-60709.rs
new file mode 100644
index 00000000000..778d3ee0c70
--- /dev/null
+++ b/src/test/run-pass/async-await/issue-60709.rs
@@ -0,0 +1,28 @@
+// This used to compile the future down to ud2, due to uninhabited types being
+// handled incorrectly in generators.
+// compile-flags: -Copt-level=z -Cdebuginfo=2 --edition=2018
+
+#![feature(async_await, await_macro)]
+#![allow(unused)]
+
+use std::future::Future;
+use std::task::Poll;
+use std::task::Context;
+use std::pin::Pin;
+use std::rc::Rc;
+
+struct Never();
+impl Future for Never {
+    type Output = ();
+    fn poll(self: Pin<&mut Self>, _cx: &mut Context<'_>) -> Poll<Self::Output> {
+        Poll::Pending
+    }
+}
+
+fn main() {
+    let fut = async {
+        let _rc = Rc::new(()); // Also crashes with Arc
+        await!(Never());
+    };
+    let _bla = fut; // Moving the future is required.
+}