[BUG] calling async trait fn gives compiler error 'type annotations needed' when type annotation is already provided #119893
Labels
A-inference
Area: Type inference
C-bug
Category: This is a bug.
D-confusing
Diagnostics: Confusing error or lint that should be reworked.
S-has-mcve
Status: A Minimal Complete and Verifiable Example has been found for this issue
In the case that an async trait fn returns a trait level generic
T
, if that trait is implemented for multipleT
, the compiler complains that type annotations are needed (to specifyT
) even though that type annotation is specified. It's suggestion is to try using a fully qualified path to specify the types. When the fully qualified trait::fn path is used, it does compile, but this is unnecessary and is not needed for the synchronous couterpart.Code to reproduce with explanations in the comments.
The signatures of the sync and async fns are the same, so the code calling the async fn should compile if it works in the sync and async_trait cases.
Meta
rustc --version --verbose
:Backtrace
The text was updated successfully, but these errors were encountered: