Closed marioortizmanero closed 2 years ago
This is fixed in async-trait 0.1.53.
error: future cannot be sent between threads safely
--> src/main.rs:6:53
|
6 | async fn thing<T: std::fmt::Debug>(&self, x: T) {
| _____________________________________________________^
7 | | todo!()
8 | | }
| |_____^ future created by async block is not `Send`
|
note: captured value is not `Send`
--> src/main.rs:6:47
|
6 | async fn thing<T: std::fmt::Debug>(&self, x: T) {
| ^ has type `T` which is not `Send`
= note: required for the cast to the object type `dyn Future<Output = ()> + Send`
help: consider further restricting this bound
|
6 | async fn thing<T: std::fmt::Debug + std::marker::Send>(&self, x: T) {
| +++++++++++++++++++
The code in this playground snippet: https://play.rust-lang.org/?version=nightly&mode=debug&edition=2018&gist=64f6ad88a914108d98ddc94816e7eafd reports an invalid error suggestion:
The
+ Send
part should be afterT
, and not inside its own declaration; otherwise this is a syntax error.