Open
Description
case 1 playground:
pub trait Foo {
async fn foo(&mut self);
}
impl<T: Foo> Foo for T {
async fn foo(&mut self) {}
}
case 2 playground:
pub trait Foo {
async fn foo(&mut self);
}
pub trait Bar: Foo {
async fn bar(&mut self);
}
impl<T: Bar> Foo for T {
async fn foo(&mut self) {}
}
fails with a strange error. The equivalent without AFIT is accepted, but the impls are considered to apply to no type because they're circular turns out the version with 2 traits does result in usable impls, it's an odd way of doing extension traits: playground. So I do think these should compile.
error[[E0053]](https://doc.rust-lang.org/nightly/error_codes/E0053.html): method `foo` has an incompatible type for trait
--> src/lib.rs:8:29
|
8 | async fn foo(&mut self) {}
| ^ expected associated type, found future
|
note: type in trait
--> src/lib.rs:4:28
|
4 | async fn foo(&mut self);
| ^
= note: expected signature `fn(&mut T) -> impl Future<Output = ()>`
found signature `fn(&mut T) -> impl Future<Output = ()>`
@rustbot label F-async_fn_in_trait
Metadata
Metadata
Assignees
Labels
Category: This is a bug.Diagnostics: Confusing error or lint that should be reworked.Diagnostics: A diagnostic that is giving misleading or incorrect information.Diagnostics: An error or lint that doesn't give enough information about the problem at hand.Static async fn in traitsRelevant to the types team, which will review and decide on the PR/issue.Fixed by the next-generation trait solver, `-Znext-solver`.
Type
Projects
Status
Non-blocking