Open
Description
Suppose I have some trait with a default method:
trait Foo {
fn bar(&self, isize) { .. }
}
and I want to add an associated type:
trait Foo {
type Baz = isize;
fn bar(&self, Self::Baz);
}
This is a breaking change unless I move the old default method to a new default impl
. But there is no way to condition the default impl
on choice the choice of associated type. For example:
default impl<A: Foo<Baz = isize>> Foo for A {
fn bar(&self, isize) { .. }
}
is prohibited, and both
default impl<A> Foo for A {
type Baz = isize;
fn bar(&self, Self::Baz);
}
and
default impl<A> Foo for A {
default type Baz = isize;
fn bar(&self, Self::Baz);
}
do the wrong thing.