Change:
No response No response No response
(for compiler people:) We could fix this by merging the impl WF and coherence checks into one compiler stage. I'll put up a PR and see what T-types thinks.
labels +AsyncAwait-Triaged We discussed this in a WG-async meeting and are deferring to the resolution suggested above. He noted that this is a fix to the diagnostics only. That fact that this is an error is correct.

Discussion:
} tcx.sess.track_errors(|| { <del> tcx.sess.time("impl_wf_inference", || { tcx.hir().for_each_module(|module| tcx.ensure().check_mod_impl_wf(module)) }); })?; tcx.sess.track_errors(|| { </del> tcx.sess.time("coherence_checking", || { <ins> // Check impls constrain their parameters tcx.hir().for_each_module(|module| tcx.ensure().check_mod_impl_wf(module)); </ins> for &trait_def_id in tcx.all_local_trait_impls(()).keys() { tcx.ensure().coherent_trait(trait_def_id); }

<ins> // edition: 2021 trait Foo { type T; async fn foo(&self) -> Self::T; } struct Bar; impl Foo for Bar { type T = (); async fn foo(&self) {} //~^ ERROR type annotations needed: cannot satisfy `<Bar as Foo>::T == ()` } impl Foo for Bar { //~^ ERROR conflicting implementations of trait `Foo` for type `Bar` type T = (); async fn foo(&self) {} //~^ ERROR type annotations needed: cannot satisfy `<Bar as Foo>::T == ()` } fn main() {} </ins>

<ins> error[E0284]: type annotations needed: cannot satisfy `<Bar as Foo>::T == ()` --> $DIR/coherence-constrained.rs:14:5 | LL |     async fn foo(&self) {} |     ^^^^^^^^^^^^^^^^^^^ cannot satisfy `<Bar as Foo>::T == ()` error[E0284]: type annotations needed: cannot satisfy `<Bar as Foo>::T == ()` --> $DIR/coherence-constrained.rs:22:5 | LL |     async fn foo(&self) {} |     ^^^^^^^^^^^^^^^^^^^ cannot satisfy `<Bar as Foo>::T == ()` error[E0119]: conflicting implementations of trait `Foo` for type `Bar` --> $DIR/coherence-constrained.rs:18:1 | LL | impl Foo for Bar { | ---------------- first implementation here ... LL | impl Foo for Bar { | ^^^^^^^^^^^^^^^^ conflicting implementation for `Bar` error: aborting due to 3 previous errors Some errors have detailed explanations: E0119, E0284. For more information about an error, try `rustc --explain E0119`. </ins>

<ins> //~ ERROR overflow evaluating the requirement `([isize; 0], _): Sized </ins> trait Foo<A> { fn get(&self, A: &A) { } }

} impl<T,U> Foo<T> for U { <del> // OK, T, U are used everywhere. Note that the coherence check // hasn't executed yet, so no errors about overlap. </del> <ins> //~^ ERROR conflicting implementations of trait `Foo<_>` for type `[isize; 0]` </ins> } impl<T,U> Bar for T {

error[E0207]: the type parameter `U` is not constrained by the impl trait, self type, or predicates <del> --> $DIR/impl-unused-tps.rs:13:8 </del> <ins> --> $DIR/impl-unused-tps.rs:15:8 </ins> | LL | impl<T,U> Foo<T> for [isize;1] { |        ^ unconstrained type parameter error[E0207]: the type parameter `U` is not constrained by the impl trait, self type, or predicates <del> --> $DIR/impl-unused-tps.rs:30:8 </del> <ins> --> $DIR/impl-unused-tps.rs:31:8 </ins> | LL | impl<T,U> Bar for T { |        ^ unconstrained type parameter error[E0207]: the type parameter `U` is not constrained by the impl trait, self type, or predicates <del> --> $DIR/impl-unused-tps.rs:38:8 </del> <ins> --> $DIR/impl-unused-tps.rs:39:8 </ins> | LL | impl<T,U> Bar for T |        ^ unconstrained type parameter error[E0207]: the type parameter `U` is not constrained by the impl trait, self type, or predicates <del> --> $DIR/impl-unused-tps.rs:46:8 </del> <ins> --> $DIR/impl-unused-tps.rs:47:8 </ins> | LL | impl<T,U,V> Foo<T> for T |        ^ unconstrained type parameter error[E0207]: the type parameter `V` is not constrained by the impl trait, self type, or predicates <del> --> $DIR/impl-unused-tps.rs:46:10 </del> <ins> --> $DIR/impl-unused-tps.rs:47:10 </ins> | LL | impl<T,U,V> Foo<T> for T |          ^ unconstrained type parameter <del> error: aborting due to 5 previous errors </del> <ins> error[E0119]: conflicting implementations of trait `Foo<_>` for type `[isize; 0]` --> $DIR/impl-unused-tps.rs:27:1 | LL | impl<T> Foo<T> for [isize;0] { | ---------------------------- first implementation here ... LL | impl<T,U> Foo<T> for U { | ^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `[isize; 0]` error[E0275]: overflow evaluating the requirement `([isize; 0], _): Sized` | = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`impl_unused_tps`) note: required for `([isize; 0], _)` to implement `Bar` --> $DIR/impl-unused-tps.rs:31:11 | LL | impl<T,U> Bar for T { |      -    ^^^     ^ |      | |      unsatisfied trait bound introduced here = note: 126 redundant requirements hidden = note: required for `([isize; 0], _)` to implement `Bar` error: aborting due to 7 previous errors </ins> <del> For more information about this error, try `rustc --explain E0207`. </del> <ins> Some errors have detailed explanations: E0119, E0207, E0275. For more information about an error, try `rustc --explain E0119`. </ins>