use compile_type_eq::{CompileEq, CompileEqResult}; struct Barbarians; struct Greeks; struct Romans; trait War { fn battle(self, other: Other); } impl War for T where T: CompileEq, Proof: CompileEqResult, { fn battle(self, _: U) {} } fn main() { Barbarians.battle(Greeks); // ok Barbarians.battle(Romans); // ok Romans.battle(Greeks); // ok Greeks.battle(Greeks); // error }