We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The following async trait fails to compile. Notice that the same method body is fine in an ordinary async fn outside of an async trait.
This worked prior to #143.
use async_trait::async_trait; struct Thing; trait Ret {} impl Ret for Thing {} async fn ok() -> &'static dyn Ret { return &Thing; } #[async_trait] trait Trait { async fn fail() -> &'static dyn Ret { return &Thing; } }
error[E0308]: mismatched types --> src/main.rs:13:41 | 13 | async fn fail() -> &'static dyn Ret { | _________________________________________^ 14 | | return &Thing; 15 | | } | |_____^ expected struct `Thing`, found trait object `dyn Ret` | = note: expected type `&Thing` found reference `&'static (dyn Ret + 'static)` note: return type inferred to be `&Thing` here --> src/main.rs:14:16 | 14 | return &Thing; | ^^^^^^ error[E0271]: type mismatch resolving `<impl Future as Future>::Output == &'static (dyn Ret + 'static)` --> src/main.rs:13:41 | 13 | async fn fail() -> &'static dyn Ret { | _________________________________________^ 14 | | return &Thing; 15 | | } | |_____^ expected trait object `dyn Ret`, found struct `Thing` | = note: expected reference `&'static (dyn Ret + 'static)` found reference `&Thing` = note: required for the cast to the object type `dyn Future<Output = &'static (dyn Ret + 'static)> + Send`
The text was updated successfully, but these errors were encountered:
Successfully merging a pull request may close this issue.
The following async trait fails to compile. Notice that the same method body is fine in an ordinary async fn outside of an async trait.
This worked prior to #143.
The text was updated successfully, but these errors were encountered: