about summary refs log tree commit diff
path: root/tests/ui/async-await
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/async-await')
-rw-r--r--tests/ui/async-await/async-closures/post-mono-higher-ranked-hang.current.stderr (renamed from tests/ui/async-await/async-closures/post-mono-higher-ranked-hang.stderr)6
-rw-r--r--tests/ui/async-await/async-closures/post-mono-higher-ranked-hang.next.stderr21
-rw-r--r--tests/ui/async-await/async-closures/post-mono-higher-ranked-hang.rs4
-rw-r--r--tests/ui/async-await/higher-ranked-normalize-assumptions-2.rs38
-rw-r--r--tests/ui/async-await/higher-ranked-normalize-assumptions.rs51
5 files changed, 117 insertions, 3 deletions
diff --git a/tests/ui/async-await/async-closures/post-mono-higher-ranked-hang.stderr b/tests/ui/async-await/async-closures/post-mono-higher-ranked-hang.current.stderr
index 486e5f94165..f3938ff606f 100644
--- a/tests/ui/async-await/async-closures/post-mono-higher-ranked-hang.stderr
+++ b/tests/ui/async-await/async-closures/post-mono-higher-ranked-hang.current.stderr
@@ -1,5 +1,5 @@
-error: reached the recursion limit while instantiating `ToChain::<'_, '_>::perm_pairs::<{async closure@$DIR/post-mono-higher-ranked-hang.rs:43:45: 43:67}>`
-  --> $DIR/post-mono-higher-ranked-hang.rs:43:21
+error: reached the recursion limit while instantiating `ToChain::<'_, '_>::perm_pairs::<{async closure@$DIR/post-mono-higher-ranked-hang.rs:47:45: 47:67}>`
+  --> $DIR/post-mono-higher-ranked-hang.rs:47:21
    |
 LL | /                     self.perm_pairs(l, &mut async move |left_pair| {
 LL | |
@@ -8,7 +8,7 @@ LL | |                     })
    | |______________________^
    |
 note: `ToChain::<'env, 'db>::perm_pairs` defined here
-  --> $DIR/post-mono-higher-ranked-hang.rs:34:5
+  --> $DIR/post-mono-higher-ranked-hang.rs:38:5
    |
 LL | /     fn perm_pairs<'l>(
 LL | |         &'l self,
diff --git a/tests/ui/async-await/async-closures/post-mono-higher-ranked-hang.next.stderr b/tests/ui/async-await/async-closures/post-mono-higher-ranked-hang.next.stderr
new file mode 100644
index 00000000000..f3938ff606f
--- /dev/null
+++ b/tests/ui/async-await/async-closures/post-mono-higher-ranked-hang.next.stderr
@@ -0,0 +1,21 @@
+error: reached the recursion limit while instantiating `ToChain::<'_, '_>::perm_pairs::<{async closure@$DIR/post-mono-higher-ranked-hang.rs:47:45: 47:67}>`
+  --> $DIR/post-mono-higher-ranked-hang.rs:47:21
+   |
+LL | /                     self.perm_pairs(l, &mut async move |left_pair| {
+LL | |
+LL | |                         self.perm_pairs(r, yield_chain).await
+LL | |                     })
+   | |______________________^
+   |
+note: `ToChain::<'env, 'db>::perm_pairs` defined here
+  --> $DIR/post-mono-higher-ranked-hang.rs:38:5
+   |
+LL | /     fn perm_pairs<'l>(
+LL | |         &'l self,
+LL | |         perm: &'l SymPerm<'db>,
+LL | |         yield_chain: &'l mut impl AsyncFnMut(&SymPerm<'db>),
+LL | |     ) -> Pin<Box<dyn std::future::Future<Output = ()> + 'l>> {
+   | |____________________________________________________________^
+
+error: aborting due to 1 previous error
+
diff --git a/tests/ui/async-await/async-closures/post-mono-higher-ranked-hang.rs b/tests/ui/async-await/async-closures/post-mono-higher-ranked-hang.rs
index f6ebf787f81..55d7cc30ec9 100644
--- a/tests/ui/async-await/async-closures/post-mono-higher-ranked-hang.rs
+++ b/tests/ui/async-await/async-closures/post-mono-higher-ranked-hang.rs
@@ -2,6 +2,10 @@
 //@ aux-build:block-on.rs
 //@ edition:2021
 
+//@ revisions: current next
+//@ ignore-compare-mode-next-solver (explicit revisions)
+//@[next] compile-flags: -Znext-solver
+
 // Regression test for <https://github.com/rust-lang/rust/issues/135780>.
 
 extern crate block_on;
diff --git a/tests/ui/async-await/higher-ranked-normalize-assumptions-2.rs b/tests/ui/async-await/higher-ranked-normalize-assumptions-2.rs
new file mode 100644
index 00000000000..410d4e503b7
--- /dev/null
+++ b/tests/ui/async-await/higher-ranked-normalize-assumptions-2.rs
@@ -0,0 +1,38 @@
+//@ revisions: stock hr
+//@[hr] compile-flags: -Zhigher-ranked-assumptions
+//@ edition: 2024
+//@ check-pass
+
+// Test that we don't normalize the higher-ranked assumptions of an auto trait goal
+// unless we have `-Zhigher-ranked-assumptions`, since obligations that result from
+// this normalization may lead to higher-ranked lifetime errors when the flag is not
+// enabled.
+
+// Regression test for <https://github.com/rust-lang/rust/issues/147244>.
+
+pub fn a() -> impl Future + Send {
+    async {
+        let queries = core::iter::empty().map(Thing::f);
+        b(queries).await;
+    }
+}
+
+async fn b(queries: impl IntoIterator) {
+    c(queries).await;
+}
+
+fn c<'a, I>(_queries: I) -> impl Future
+where
+    I: IntoIterator,
+    I::IntoIter: 'a,
+{
+    async {}
+}
+
+pub struct Thing<'a>(pub &'a ());
+
+impl Thing<'_> {
+    fn f(_: &Self) {}
+}
+
+fn main() {}
diff --git a/tests/ui/async-await/higher-ranked-normalize-assumptions.rs b/tests/ui/async-await/higher-ranked-normalize-assumptions.rs
new file mode 100644
index 00000000000..ec9cf3a1522
--- /dev/null
+++ b/tests/ui/async-await/higher-ranked-normalize-assumptions.rs
@@ -0,0 +1,51 @@
+//@ revisions: stock hr
+//@[hr] compile-flags: -Zhigher-ranked-assumptions
+//@ edition: 2024
+//@ check-pass
+
+// Test that we don't normalize the higher-ranked assumptions of an auto trait goal
+// unless we have `-Zhigher-ranked-assumptions`, since obligations that result from
+// this normalization may lead to higher-ranked lifetime errors when the flag is not
+// enabled.
+
+// Regression test for <https://github.com/rust-lang/rust/issues/147285>.
+
+pub trait Service {
+    type Response;
+}
+
+impl<T, R> Service for T
+where
+    T: FnMut() -> R,
+    R: 'static,
+{
+    type Response = R;
+}
+
+async fn serve<C>(_: C)
+where
+    C: Service,
+    C::Response: 'static,
+{
+    connect::<C>().await;
+}
+
+async fn connect<C>()
+where
+    C: Service,
+    C::Response: 'static,
+{
+}
+
+fn repro() -> impl Send {
+    async {
+        let server = || do_something();
+        serve(server).await;
+    }
+}
+
+fn do_something() -> Box<dyn std::error::Error> {
+    unimplemented!()
+}
+
+fn main() {}