Rollup merge of #141094 - satler-git:issue-101650, r=lcnr
add regression test for rust-lang#101650 closes #101650, which was already fixed.
This commit is contained in:
commit
d5e59b8a38
1 changed files with 24 additions and 0 deletions
24
tests/ui/async-await/format-await-send.rs
Normal file
24
tests/ui/async-await/format-await-send.rs
Normal file
|
|
@ -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() {}
|
||||
Loading…
Add table
Add a link
Reference in a new issue