Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: Clarify CustomConst::equal_consts #1396

Merged
merged 3 commits into from
Aug 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion hugr-core/src/ops/constant/custom.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
Loading