// rustc-compared: disjoint headers, impossible local bounds, associated projections, // const arguments, and common names in disjoint inherent impls. trait Tr { fn value() -> u32; } struct S; impl Tr for S { fn value() -> u32 { 1 } } impl Tr for S { fn value() -> u32 { 2 } } trait Bound {} trait Choose { fn choose() -> u32; } struct Local; impl Choose for T { fn choose() -> u32 { 3 } } impl Choose for Local { fn choose() -> u32 { 4 } } struct Wrap(T); impl Wrap { fn f() -> u32 { 5 } } impl Wrap { fn f() -> u32 { 6 } } trait Array {} impl Array for [u8; 1] {} impl Array for [u8; 2] {} trait Item { type Out; } impl Item for S { type Out = u32; } trait Projection {} impl Projection for ::Out {} impl Projection for u64 {} #[test] fn disjoint_impls() { assert_eq!(>::value(), 1); assert_eq!(>::value(), 2); assert_eq!(Local::choose(), 4); assert_eq!(Wrap::::f(), 5); assert_eq!(Wrap::::f(), 6); } // nightly specialization_graph.rs:130-152: overlap only without the leak check // is a future-compatibility warning, not E0119. trait HigherRanked {} impl HigherRanked for fn(T) {} impl HigherRanked for for<'a> fn(&'a T) {} // #[fundamental] Fn rules out an upstream impl for a foreign reference type. trait CallableOrStr {} impl CallableOrStr for F {} impl CallableOrStr for &str {}