use min_specialization::specialization; #[specialization] mod test_mod { #[allow(unused)] trait Trait { type Ty; fn number(_: U) -> Self::Ty; } impl Trait for T { type Ty = usize; default fn number(_: U) -> Self::Ty { 0 } } impl Trait for () { fn number(_: U) -> Self::Ty { 1 } } #[allow(unused)] struct S(T); impl core::ops::AddAssign for S { default fn add_assign(&mut self, _rhs: Self) {} } impl core::ops::AddAssign for S { fn add_assign(&mut self, _rhs: Self) {} } }