APITIT get treated as ordinary params in "not all trait impls implemented" error · Issue #126395 · rust-lang/rust (original) (raw)

// crate dep pub trait Trait { fn foo(: impl Sized); fn bar(: impl Sized); } // root use dep::*;

struct Local; impl Trait for Local {}

results in the following error:

error[E0046]: not all trait items implemented, missing: `foo`, `bar`
 --> src/main.rs:4:1
  |
4 | impl Trait for Local {}
  | ^^^^^^^^^^^^^^^^^^^^ missing `foo`, `bar` in implementation
  |
  = help: implement the missing item: `fn foo<impl Sized>(_: impl Sized) { todo!() }`
  = help: implement the missing item: `fn bar<T, impl Sized>(_: impl Sized) { todo!() }`

This wrongly includes the APITIT in the generic args. It should be

  = help: implement the missing item: `fn foo(_: impl Sized) { todo!() }`
  = help: implement the missing item: `fn bar<T>(_: impl Sized) { todo!() }`