#![allow(unused)]
fn main() {
trait Subtrait: Supertrait {
auto impl Supertrait {
// Supertrait items defined in terms of Subtrait items, if any
}
}
}
Additionally, there is an open question around the syntax of auto impl for unsafe supertraits. The current proposal is to require unsafe auto impl Supertrait.
#![allow(unused)]
fn main() {
impl Supertrait for MyType {}
impl Subtrait for MyType {
// Required in order to manually write Supertrait
}
for MyType.
extern impl Supertrait;
}
This makes it explicit via opt-out whether an auto impl is being applied. However, this is in conflict with the goal of allowing auto impls to be added to existing trait hierarchies. The RFC proposes to resolve this via a temporary attribute which triggers a warning. See my comment here.