I forgot to take a reference to a parameter, example (Playground):
use async_trait::async_trait; // 0.1.68
#[async_trait]
trait MyTrait {
async fn foo<T: Send>(
&self, s: &String, t: T
);
}
struct MyType;
#[async_trait]
impl MyTrait for MyType {
async fn foo<T: Send>(
&self, s: String, t: T
) {}
}
This results in the following error message, which doesn't explain the problem at all:
error[E0195]: lifetime parameters or bounds on method `foo` do not match the trait declaration
--> src/lib.rs:14:17
|
5 | async fn foo<T: Send>(
| --------- lifetimes in impl do not match this method in trait
...
14 | async fn foo<T: Send>(
| ^^^^^^^^^ lifetimes do not match method in trait
For more information about this error, try `rustc --explain E0195`.
error: could not compile `playground` due to previous error
I forgot to take a reference to a parameter, example (Playground):
This results in the following error message, which doesn't explain the problem at all: