use async_trait::async_trait;
#[async_trait]
pub trait Trait {
async fn f(&self) {} // works
async fn g(self: &Self) {} // does not work
}
error[E0277]: `Self` cannot be shared between threads safely
--> tests/test.rs:564:33
|
564 | async fn g(self: &Self) {}
| ^^ `Self` cannot be shared between threads safely
|
= help: the trait `std::marker::Sync` is not implemented for `Self`
= note: required because of the requirements on the impl of `std::marker::Send` for `&Self`
= note: required because it appears within the type `[static generator@tests/test.rs:564:33: 564:35 _self:&Self {}]`
= note: required because it appears within the type `std::future::from_generator::GenFuture<[static generator@tests/test.rs:564:33: 564:35 _self:&Self {}]>`
= note: required because it appears within the type `impl std::future::Future`
= note: required because it appears within the type `impl std::future::Future`
= note: required for the cast to the object type `dyn std::future::Future<Output = ()> + std::marker::Send`