Description
This is a step towards full support for specialization (#9). This particular step sidesteps some of the trickier bits of specialization (in particular, it sidesteps the parts related to regions and soundness). The goal is this:
- If we know that impl A specializes impl B, adjust the logic to take that into account.
I'll try to post more detailed mentoring instructions, but here are some high-level notes:
Specialization does not effect whether or not a trait is implemented. Therefore, the "lowering" for an impl ought to be unaffected -- overlapping impls simply mean more than one way to prove the same set of types, and the solver ought to be able to handle that.
The "normalization rules", however, are effected. If you have an impl with a default item:
impl Iterator for Foo<T> {
default type Item = u32;
}
then we cannot normalize <Foo<T> as Iterator>::Item
to u32
unless we know that there is no "more specific" impl that applies.
Moreover, at least in rustc at the moment, we sometimes wish to assume that a more specialized impl could be added in the future. In rustc, we currently distinguish between "reveal mode", at which point we are allowed to normalize a default
type, and "normal mode", when we are not.