about summary refs log tree commit diff
diff options
context:
space:
mode:
authorsatler <satler@satler.dev>2025-05-17 01:09:02 +0900
committersatler <satler@satler.dev>2025-05-17 01:30:07 +0900
commit067fe1ffb5789ff2cfdb3d01f756e48911c48063 (patch)
treeb2b80180ad3ca0f0a32a46863e116f00c7168274
parent1b9efcd18f1cb95348c3ffadd4db47bfa15292e5 (diff)
downloadrust-067fe1ffb5789ff2cfdb3d01f756e48911c48063.tar.gz
rust-067fe1ffb5789ff2cfdb3d01f756e48911c48063.zip
add regression test for rust-lang#101650
-rw-r--r--tests/ui/async-await/format-await-send.rs24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/ui/async-await/format-await-send.rs b/tests/ui/async-await/format-await-send.rs
new file mode 100644
index 00000000000..13ae7233fd6
--- /dev/null
+++ b/tests/ui/async-await/format-await-send.rs
@@ -0,0 +1,24 @@
+// regression test for <https://github.com/rust-lang/rust/issues/101650>
+// assert that Future which has format!() with an async function is Send
+
+#![allow(unused)]
+
+//@ check-pass
+//@ edition: 2018
+
+use core::future::Future;
+use core::pin::Pin;
+
+fn build_string() -> Pin<Box<dyn Future<Output = String> + Send>> {
+    Box::pin(async move {
+        let mut string_builder = String::new();
+        string_builder += &format!("Hello {}", helper().await);
+        string_builder
+    })
+}
+
+async fn helper() -> String {
+    "World".to_string()
+}
+
+fn main() {}