]> git.lizzy.rs Git - rust.git/blob - src/test/ui/async-await/issues/issue-64477-2.rs
Rollup merge of #103766 - lukas-code:error-in-core, r=Dylan-DPC
[rust.git] / src / test / ui / async-await / issues / issue-64477-2.rs
1 // Another regression test for #64477.
2 //
3 // In the past, the code generated by `format!` produced temporaries in the surrounding scope that
4 // borrowed the arguments through `&dyn Trait`. These temporaries do not implement `Send`, which
5 // meant that when `format!` was used in an async block, the resulting generator was not `Send`.
6 // See https://github.com/rust-lang/rust/issues/64477#issuecomment-534669068 for details
7 // and https://github.com/rust-lang/rust/issues/64477#issuecomment-531882958 for an example.
8 //
9 // check-pass
10 // edition:2018
11
12 async fn foo(_: String) {}
13
14 fn bar() -> impl Send {
15     async move {
16         foo(format!("{}:{}", 1, 2)).await;
17     }
18 }
19
20 fn main() {
21     let _ = bar();
22 }