Closed
Description
use std::marker::PhantomData;
trait Foo {
type Bar: Interface<Self>; // = Default<Self>
}
trait Interface<T: Foo> {}
// default implementation, we never implement Alternate<T> for this.
trait DefaultFoo: Foo<Bar=Default<Self>> {}
struct Default<T: DefaultFoo> {
_marker: PhantomData<T>,
}
impl<T: DefaultFoo> Interface<T> for Default<T> {}
// alternate implementations must use this trait
// predicate on A: Alternate<T> should preclude Default<T>.
trait Alternate<T: Foo<Bar=Self>> {}
impl<T, A> Interface<T> for A
where T: Foo<Bar=A>, A: Alternate<T> {}
fn main() {}
fails with E0119, although the Self types don't overlap.
Playpen: http://is.gd/vT98nf, fails on Stable, Beta, and Nightly.