Closed
Description
Code
I tried this code:
async fn say(_: String) {}
async fn mention() -> u32 {
123
}
fn assert_send<T: Send>(_: T) {}
fn main() {
assert_send(async {
say(format!("{}{}", mention().await, mention().await)).await;
});
}
I expected to see this happen: successful compilation
Instead, this happened:
error: future cannot be sent between threads safely
--> src/main.rs:9:5
|
9 | assert_send(async {
| ^^^^^^^^^^^ future created by async block is not `Send`
|
= help: the trait `Sync` is not implemented for `core::fmt::Opaque`
note: required by a bound in `assert_send`
--> src/main.rs:6:19
|
6 | fn assert_send<T: Send>(_: T) {}
| ^^^^ required by this bound in `assert_send`
Version it worked on
It most recently worked on: Rust 1.59.0-beta
Version with regression
rustc --version --verbose
:
rustc 1.56.1 (59eed8a2a 2021-11-01)
binary: rustc
commit-hash: 59eed8a2aac0230a8b53e89d4e99d55912ba6b35
commit-date: 2021-11-01
host: x86_64-unknown-linux-gnu
release: 1.56.1
LLVM version: 13.0.0
Backtrace
Backtrace
<backtrace>