Check for opaque types behind projections#99857
Check for opaque types behind projections#99857oli-obk wants to merge 1 commit intorust-lang:masterfrom
Conversation
|
that approach doesn't work i think, consider #![feature(type_alias_impl_trait)]
trait Foo {
type Assoc;
}
impl Foo for i32 {
type Assoc = u32;
}
type ImplTrait = impl Sized;
fn constrain() -> ImplTrait {
1u64
}
impl Foo for i64 {
type Assoc = ImplTrait;
}
trait Bar<T> {}
impl<T: Foo> Bar<<T as Foo>::Assoc> for T {}i don't think we can avoid opaque types during coherence. I think we should allow them but treat them as opaque so that they block impls for any other type which i added to #99840 (comment) as an edit 😁 |
|
for #76202 we have to not return a not sure about #86411 but it seems fixable and #84660 is caused by opaque types not being considered "opaque enough" i think |
|
if this approach is not going to work or land soon, should we revert #99383 in the meantime ? |
No, this is all behind feature gates, so we're not going to affect stable code. |
Fixes #99840
I still dislike how fragile this is, but integrating into the regular orphan check doesn't really make sense either, it's not about orphan checking at all.
r? @lcnr