-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Add requirements of TotalEq and TotalOrd #13358
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
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
* This means, that additionally to `a == b` and `a != b` being strict | ||
* inverses, the following three properties are required: | ||
* | ||
* Reflexivity, which means that `a == a` must be true for all `a`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you make this a list, e.g.
/**
* Trait for equality comparisons that form an [equalence relation](...).
*
* The equality must be (for all `a`, `b` and `c`):
*
* - reflexive: `a == a`;
* - symmetric: `a == b` implies `b == a`; and
* - transitive: `a == b` and `b == c` implies `a == c`.
*
* `a == b` and `a != b` must be strict inverses.
*/
Clarify that TotalEq needs an underlying equivalence relation and that TotalOrd needs a total ordering and specifically named the required (and sufficient) attributes.
@@ -62,7 +62,18 @@ pub trait Eq { | |||
fn ne(&self, other: &Self) -> bool { !self.eq(other) } | |||
} | |||
|
|||
/// Trait for equality comparisons where `a == b` and `a != b` are strict inverses. | |||
/** |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: we don't use block comments, use ///
on every line.
bors
added a commit
that referenced
this pull request
Apr 7, 2014
Add requirements of TotalEq and TotalOrd Clarify that TotalEq needs an underlying equivalence relation and that TotalOrd needs a total ordering and specifically named the required (and sufficient) attributes.
What's wrong with block comments exactly? |
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Oct 18, 2022
…on, r=Veykril feat: Autocomplete Cargo-defined env vars in `env!` and `option_env!` (rust-lang#12448) Closes rust-lang#12448 Important to know: - Variables are taken from https://doc.rust-lang.org/cargo/reference/environment-variables.html and hardcoded as a const array. - For the sake of simplicity I didn't include the autocompletion of `CARGO_BIN_EXE_<name>` and `OUT_DIR` since it would require information about build.rs and binary name. If somebody knows an easy way of obtaining them I can add those vars as well :)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Add requirements of TotalEq and TotalOrd
Clarify that TotalEq needs an underlying equivalence relation and that TotalOrd
needs a total ordering and specifically named the required (and sufficient)
attributes.