about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorMazdak Farrokhzad <twingoow@gmail.com>2019-06-29 11:18:08 +0200
committerGitHub <noreply@github.com>2019-06-29 11:18:08 +0200
commit2238a94b96380846353821c0f8d5bb1300727e38 (patch)
treef36b285577c952c9f90a5515a2e6a69488f2969c /src
parent0721364f0de6191cddeaaaeb112fb74aa1a9e30a (diff)
parentb7397cc00b052cf49c26b095c72b895cd0a3e254 (diff)
downloadrust-2238a94b96380846353821c0f8d5bb1300727e38.tar.gz
rust-2238a94b96380846353821c0f8d5bb1300727e38.zip
Rollup merge of #61818 - tmandry:issue-60709-test, r=cramertj
Issue #60709 test

Adds a test for #60709, which was fixed as part of #59897.

r? @cramertj
Diffstat (limited to 'src')
-rw-r--r--src/test/run-pass/async-await/async-fn-size.rs (renamed from src/test/run-pass/async-fn-size.rs)4
-rw-r--r--src/test/run-pass/async-await/issue-60709.rs28
2 files changed, 30 insertions, 2 deletions
diff --git a/src/test/run-pass/async-fn-size.rs b/src/test/run-pass/async-await/async-fn-size.rs
index 05afd6d4019..c4e328560dd 100644
--- a/src/test/run-pass/async-fn-size.rs
+++ b/src/test/run-pass/async-await/async-fn-size.rs
@@ -1,9 +1,9 @@
 // edition:2018
-// aux-build:arc_wake.rs
 
 #![feature(async_await, await_macro)]
 
-extern crate arc_wake;
+#[path = "../auxiliary/arc_wake.rs"]
+mod arc_wake;
 
 use std::pin::Pin;
 use std::future::Future;
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.
+}