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