about summary refs log tree commit diff
path: root/tests/ui/async-await/format-await-send.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/async-await/format-await-send.rs')
-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() {}