use disjoint_impls::disjoint_impls; pub trait Dispatch { type Group; } pub enum GroupA {} impl Dispatch for Option { type Group = GroupA; } impl Dispatch for Option> { type Group = GroupA; } pub enum GroupB {} impl Dispatch for Option { type Group = GroupB; } impl Dispatch for Option { type Group = GroupB; } disjoint_impls! { pub trait Kita { const NAME: &'static str; } impl Kita for T where Option: Dispatch { const NAME: &'static str = "Blanket A"; } impl Kita for T where Option: Dispatch { const NAME: &'static str = "Blanket B"; } } /* pub trait Kita { const NAME: &'static str; } const _: () = { pub trait _Kita0<_0: ?Sized> { const NAME: &'static str; } impl<_0> _Kita0 for _0 where Option<_0>: Dispatch { const NAME: &'static str = "Blanket A"; } impl<_0> _Kita0 for _0 where Option<_0>: Dispatch { const NAME: &'static str = "Blanket B"; } impl<_0> Kita for _0 where Option<_0>: Dispatch, Self: _Kita0< as Dispatch>::Group> { const NAME: &'static str = as Dispatch>::Group>>::NAME; } }; */ #[test] fn composite_where_clause() { assert_eq!("Blanket A", ::NAME); assert_eq!("Blanket A", as Kita>::NAME); assert_eq!("Blanket B", ::NAME); assert_eq!("Blanket B", ::NAME); }