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

std::min and std::max should require TotalOrd #12712

Closed
thestinger opened this issue Mar 5, 2014 · 3 comments · Fixed by #12869
Closed

std::min and std::max should require TotalOrd #12712

thestinger opened this issue Mar 5, 2014 · 3 comments · Fixed by #12869

Comments

@thestinger
Copy link
Contributor

These do not handle partial orderings correctly. #12509 adds correct min and max methods to the Float trait to be used in place of these. These will likely end up as LLVM intrinsics at some point in the future too.

This can be fixed either by making the functions require TotalOrd, or by making them default methods on Ord and doing an override for floating point types.

@pongad
Copy link
Contributor

pongad commented Mar 5, 2014

Having methods min and max on integers and floating point seems to broad. I like changing to TotalOrd better. Can work on it if we have enough people agreeing with the change.

@thestinger
Copy link
Contributor Author

There are now min and max methods on the Float trait. I don't really like the idea of reserving these method names, and I guess it's not actually going to work properly with deriving...

If they're going to be switched to TotalOrd, it should be done after the trait inheritance lands.

@pongad
Copy link
Contributor

pongad commented Mar 5, 2014

+1 to that plan.

bors added a commit that referenced this issue Mar 14, 2014
The `Float` trait provides correct `min` and `max` methods on floating
point types, providing a consistent result regardless of the order the
parameters are passed.

These generic functions do not take the necessary performance hit to
correctly support a partial order, so the true requirement should be
given as a type bound.

Closes #12712
bors added a commit to rust-lang-ci/rust that referenced this issue Jul 25, 2022
…ykril

fix: ignore renames for crate root

close rust-lang#12684 . I just ignore renames for crate root in `rename_mod` func.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants