2019-09-27 22:19:37 -05:00
|
|
|
// Another regression test for #64477.
|
|
|
|
//
|
2019-09-27 16:15:17 -05:00
|
|
|
// In the past, the code generated by `format!` produced temporaries in the surrounding scope that
|
|
|
|
// borrowed the arguments through `&dyn Trait`. These temporaries do not implement `Send`, which
|
2023-10-19 16:46:28 -05:00
|
|
|
// meant that when `format!` was used in an async block, the resulting coroutine was not `Send`.
|
2019-09-27 16:15:17 -05:00
|
|
|
// See https://github.com/rust-lang/rust/issues/64477#issuecomment-534669068 for details
|
|
|
|
// and https://github.com/rust-lang/rust/issues/64477#issuecomment-531882958 for an example.
|
2019-09-27 22:19:37 -05:00
|
|
|
//
|
|
|
|
// check-pass
|
|
|
|
// edition:2018
|
|
|
|
|
2019-09-27 16:15:17 -05:00
|
|
|
async fn foo(_: String) {}
|
|
|
|
|
|
|
|
fn bar() -> impl Send {
|
|
|
|
async move {
|
|
|
|
foo(format!("{}:{}", 1, 2)).await;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
let _ = bar();
|
|
|
|
}
|