Now rust support it https://github.com/rust-lang/rust/pull/134367
example in the problem
trait Base {
fn a(&self);
fn b(&self);
fn c(&self);
fn d(&self);
}
trait Derived : Base {
fn e(&self);
fn f(&self);
fn g(&self);
}
struct S;
impl Derived for S {
fn e(&self) {}
fn f(&self) {}
fn g(&self) {}
}
impl Base for S {
fn a(&self) {}
fn b(&self) {}
fn c(&self) {}
fn d(&self) {}
}
fn example(v: &dyn Derived) {
v as &dyn Base;
}
playground link https://play.rust-lang.org/?version=stable&mode=debug&edition=2024&gist=e13f174aa408f890a771284206fab07b