]> git.lizzy.rs Git - rust.git/blobdiff - tests/ui/generic-associated-types/bugs/issue-100013.rs
Move /src/test to /tests
[rust.git] / tests / ui / generic-associated-types / bugs / issue-100013.rs
diff --git a/tests/ui/generic-associated-types/bugs/issue-100013.rs b/tests/ui/generic-associated-types/bugs/issue-100013.rs
new file mode 100644 (file)
index 0000000..fc4e47a
--- /dev/null
@@ -0,0 +1,39 @@
+// check-fail
+// known-bug
+// edition: 2021
+
+// We really should accept this, but we need implied bounds between the regions
+// in a generator interior.
+
+pub trait FutureIterator {
+    type Future<'s, 'cx>: Send
+    where
+        's: 'cx;
+}
+
+fn call<I: FutureIterator>() -> impl Send {
+    async { // a generator checked for autotrait impl `Send`
+        //~^ lifetime bound not satisfied
+        let x = None::<I::Future<'_, '_>>; // a type referencing GAT
+        async {}.await; // a yield point
+    }
+}
+
+fn call2<'a, 'b, I: FutureIterator>() -> impl Send {
+    async { // a generator checked for autotrait impl `Send`
+        //~^ lifetime bound not satisfied
+        let x = None::<I::Future<'a, 'b>>; // a type referencing GAT
+        //~^ lifetime may not live long enough
+        async {}.await; // a yield point
+    }
+}
+
+fn call3<'a: 'b, 'b, I: FutureIterator>() -> impl Send {
+    async { // a generator checked for autotrait impl `Send`
+        //~^ lifetime bound not satisfied
+        let x = None::<I::Future<'a, 'b>>; // a type referencing GAT
+        async {}.await; // a yield point
+    }
+}
+
+fn main() {}