about summary refs log tree commit diff
path: root/tests/ui
diff options
context:
space:
mode:
author许杰友 Jieyou Xu (Joe) <39484203+jieyouxu@users.noreply.github.com>2025-08-19 19:45:30 +0800
committerGitHub <noreply@github.com>2025-08-19 19:45:30 +0800
commit99de64bac7d4f7f4a07a1ac38cd4457f3480ee1a (patch)
treebf733664dcd6d9743c3f6c57c1f04834d2a9bda5 /tests/ui
parent8365fcb2b840c95eeb0bc377af8bd498fad22245 (diff)
parent4d841497da34dbe1c51071d38b5b1c440ae308b7 (diff)
downloadrust-99de64bac7d4f7f4a07a1ac38cd4457f3480ee1a.tar.gz
rust-99de64bac7d4f7f4a07a1ac38cd4457f3480ee1a.zip
Rollup merge of #145338 - lcnr:coroutine-witness-yikes, r=compiler-errors
actually provide the correct args to coroutine witnesses

rust-lang/rust#145194 accidentally provided all arguments of the closure to the witness, but the witness only takes the generic parameters of the defining scope: https://github.com/rust-lang/rust/blob/216cdb7b22b637cef75b7225c642cb7587192643/compiler/rustc_hir_typeck/src/closure.rs#L164

Fixes rust-lang/rust#145288
Diffstat (limited to 'tests/ui')
-rw-r--r--tests/ui/async-await/recursive-async-auto-trait-overflow-only-parent-args.rs17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/ui/async-await/recursive-async-auto-trait-overflow-only-parent-args.rs b/tests/ui/async-await/recursive-async-auto-trait-overflow-only-parent-args.rs
new file mode 100644
index 00000000000..9681f66412a
--- /dev/null
+++ b/tests/ui/async-await/recursive-async-auto-trait-overflow-only-parent-args.rs
@@ -0,0 +1,17 @@
+// Regression test for #145288. This is the same issue as #145151
+// which we fixed in #145194. However in that PR we accidentally created
+// a `CoroutineWitness` which referenced all generic arguments of the
+// coroutine, including upvars and the signature.
+
+//@ edition: 2024
+//@ check-pass
+
+async fn process<'a>(x: &'a u32) {
+    Box::pin(process(x)).await;
+}
+
+fn require_send(_: impl Send) {}
+
+fn main() {
+    require_send(process(&1));
+}