diff --git a/hugr-core/src/ops/constant/custom.rs b/hugr-core/src/ops/constant/custom.rs index 8ce00bec3..7e685bc6e 100644 --- a/hugr-core/src/ops/constant/custom.rs +++ b/hugr-core/src/ops/constant/custom.rs @@ -75,8 +75,14 @@ pub trait CustomConst: /// Compare two constants for equality, using downcasting and comparing the definitions. /// /// If the type implements `PartialEq`, use [`downcast_equal_consts`] to compare the values. + /// + /// Note that this does not require any equivalent of [Eq]: it is permissible to return + /// `false` if in doubt, and in particular, there is no requirement for reflexivity + /// (i.e. `x.equal_consts(x)` can be `false`). However, we do expect both + /// symmetry (`x.equal_consts(y) == y.equal_consts(x)`) and transitivity + /// (if `x.equal_consts(y) && y.equal_consts(z)` then `x.equal_consts(z)`). fn equal_consts(&self, _other: &dyn CustomConst) -> bool { - // false unless overloaded + // false unless overridden false }