about summary refs log tree commit diff
path: root/tests/ui/async-await/issue-60709.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/async-await/issue-60709.rs')
-rw-r--r--tests/ui/async-await/issue-60709.rs28
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/ui/async-await/issue-60709.rs b/tests/ui/async-await/issue-60709.rs
new file mode 100644
index 00000000000..61f6ed1b7b2
--- /dev/null
+++ b/tests/ui/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
+
+// run-pass
+// ignore-asmjs wasm2js does not support source maps yet
+
+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
+        Never().await;
+    };
+    let _bla = fut; // Moving the future is required.
+}