Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

AFIT: strange errors on circular impls #112626

Copy link
Copy link
@Dirbaio

Description

@Dirbaio
Issue body actions

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

No one assigned

    Labels

    C-bugCategory: This is a bug.Category: This is a bug.D-confusingDiagnostics: Confusing error or lint that should be reworked.Diagnostics: Confusing error or lint that should be reworked.D-incorrectDiagnostics: A diagnostic that is giving misleading or incorrect information.Diagnostics: A diagnostic that is giving misleading or incorrect information.D-terseDiagnostics: An error or lint that doesn't give enough information about the problem at hand.Diagnostics: An error or lint that doesn't give enough information about the problem at hand.F-async_fn_in_traitStatic async fn in traitsStatic async fn in traitsT-typesRelevant to the types team, which will review and decide on the PR/issue.Relevant to the types team, which will review and decide on the PR/issue.fixed-by-next-solverFixed by the next-generation trait solver, `-Znext-solver`.Fixed by the next-generation trait solver, `-Znext-solver`.

    Type

    No type

    Projects

    Status

    Non-blocking
    Show more project fields

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.