Open
Description
#![feature(associated_type_defaults)]
trait Foo {
type Bar<T>: Baz<Self> = i32;
// We should be able to prove that `i32: Baz<Self>` because of
// the impl below, which requires that `Self::Bar<()>: Eq<i32>`
// which is true, because we assume `for<T> Self::Bar<T> = i32`.
}
trait Baz<T: ?Sized> {}
impl<T: Foo + ?Sized> Baz<T> for i32 where T::Bar<()>: Eq<i32> {}
trait Eq<T> {}
impl<T> Eq<T> for T {}
fn main() {}
This code should pass, but it doesn't after #117542.
Instead, it fails with:
error[E0277]: the trait bound `<Self as Foo>::Bar<()>: Eq<i32>` is not satisfied
--> $DIR/assume-gat-normalization-for-nested-goals.rs:6:30
|
LL | type Bar<T>: Baz<Self> = i32;
| ^^^ the trait `Eq<i32>` is not implemented for `<Self as Foo>::Bar<()>`
|
note: required for `i32` to implement `Baz<Self>`
--> $DIR/assume-gat-normalization-for-nested-goals.rs:13:23
|
LL | impl<T: Foo + ?Sized> Baz<T> for i32 where T::Bar<()>: Eq<i32> {}
| ^^^^^^ ^^^ ------- unsatisfied trait bound introduced here
note: required by a bound in `Foo::Bar`
--> $DIR/assume-gat-normalization-for-nested-goals.rs:6:18
|
LL | type Bar<T>: Baz<Self> = i32;
| ^^^^^^^^^ required by this bound in `Foo::Bar`
help: consider further restricting the associated type
|
LL | trait Foo where <Self as Foo>::Bar<()>: Eq<i32> {
| +++++++++++++++++++++++++++++++++++++
error: aborting due to previous error
For more information about this error, try `rustc --explain E0277`.