Rollup merge of #125008 - Dirbaio:test-issue-122775, r=compiler-errors

Add test for #122775

Closes #122775
diff --git a/tests/ui/type-alias-impl-trait/static-lifetime-through-closure-issue-122775.rs b/tests/ui/type-alias-impl-trait/static-lifetime-through-closure-issue-122775.rs
new file mode 100644
index 0000000..1bb0acf
--- /dev/null
+++ b/tests/ui/type-alias-impl-trait/static-lifetime-through-closure-issue-122775.rs
@@ -0,0 +1,17 @@
+//@ check-pass
+
+#![feature(type_alias_impl_trait)]
+
+fn spawn<T, F>(future: F) -> impl Sized
+where
+    F: FnOnce() -> T,
+{
+    future
+}
+
+fn spawn_task(sender: &'static ()) -> impl Sized {
+    type Tait = impl Sized + 'static;
+    spawn::<Tait, _>(move || sender)
+}
+
+fn main() {}