#![feature(specialization)] pub trait Foo { fn foo(&self) -> &'static str; } impl Foo for T { default fn foo(&self) -> &'static str { "generic" } } impl Foo for T { default fn foo(&self) -> &'static str { "generic Clone" } } impl Foo for (T, U) where T: Clone, U: Clone { default fn foo(&self) -> &'static str { "generic pair" } } impl Foo for (T, T) { default fn foo(&self) -> &'static str { "generic uniform pair" } } impl Foo for (u8, u32) { default fn foo(&self) -> &'static str { "(u8, u32)" } } impl Foo for (u8, u8) { default fn foo(&self) -> &'static str { "(u8, u8)" } } impl Foo for Vec { default fn foo(&self) -> &'static str { "generic Vec" } } impl Foo for Vec { fn foo(&self) -> &'static str { "Vec" } } impl Foo for String { fn foo(&self) -> &'static str { "String" } } impl Foo for i32 { fn foo(&self) -> &'static str { "i32" } } pub trait MyMarker {} impl Foo for T { default fn foo(&self) -> &'static str { "generic Clone + MyMarker" } }