You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Auto merge of #795 - lowr:fix/clauses-for-assoc-placeholders, r=jackh726
Generate clauses for placeholder associated types
Currently, we don't generate clauses for placeholder associated types (`TyKind::AssociatedType`) except for some `FromEnv`s. This leads to `NoSolution` for goals like `(IntoIterator::IntoIter)<Opaque>: Iterator` where `Opaque = impl IntoIterator`.
For every associated type in a trait definition
```rust
trait Foo {
type Assoc<'a, T>: Bar<U = Ty> where WC;
}
```
chalk with this patch generates
```rust
forall<Self, 'a, T> {
Implemented((Foo::Assoc<'a, T>)<Self>: Bar) :- WC.
AliasEq(<<(Foo::Assoc<'a, T>)<Self>> as Bar>::U = Ty) :- WC.
}
```
To be honest, I'm not entirely sure if `AssociatedTyDatum::to_program_clauses()` is the best place to generate those clauses in, but analogous clauses for placeholder opaque types are generated in `OpaqueTyDatum::to_program_clauses()`, which I modeled after.
Spotted in rust-lang/rust-analyzer#14680.
0 commit comments