about summary refs log tree commit diff
path: root/tests/ui/async-await/issues/issue-60655-latebound-regions.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/async-await/issues/issue-60655-latebound-regions.rs')
-rw-r--r--tests/ui/async-await/issues/issue-60655-latebound-regions.rs30
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/ui/async-await/issues/issue-60655-latebound-regions.rs b/tests/ui/async-await/issues/issue-60655-latebound-regions.rs
new file mode 100644
index 00000000000..66a3b07c3bd
--- /dev/null
+++ b/tests/ui/async-await/issues/issue-60655-latebound-regions.rs
@@ -0,0 +1,30 @@
+// Test that opaque `impl Trait` types are allowed to contain late-bound regions.
+
+// check-pass
+// edition:2018
+
+#![feature(type_alias_impl_trait)]
+
+use std::future::Future;
+
+pub type Func = impl Sized;
+
+// Late bound region should be allowed to escape the function, since it's bound
+// in the type.
+fn null_function_ptr() -> Func {
+    None::<for<'a> fn(&'a ())>
+}
+
+async fn async_nop(_: &u8) {}
+
+pub type ServeFut = impl Future<Output=()>;
+
+// Late bound regions occur in the generator witness type here.
+fn serve() -> ServeFut {
+    async move {
+        let x = 5;
+        async_nop(&x).await
+    }
+}
+
+fn main() {}