Skip to content

Int and Integer traits should imply "Ord" #18776

New issue

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

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

Already on GitHub? # to your account

Closed
haberman opened this issue Nov 8, 2014 · 4 comments · Fixed by #18795
Closed

Int and Integer traits should imply "Ord" #18776

haberman opened this issue Nov 8, 2014 · 4 comments · Fixed by #18795

Comments

@haberman
Copy link
Contributor

haberman commented Nov 8, 2014

Right now the Int and Integer traits imply PartialOrd but not Ord.

Is there a reason for this? It seems like integers do have a total order, not just partial. I asked on IRC and people seemed to think Int should imply Ord.

If this is correct I can send a pull request?

@gamazeps
Copy link
Contributor

gamazeps commented Nov 8, 2014

Yup :)

@nodakai
Copy link
Contributor

nodakai commented Nov 8, 2014

@haberman I have two questions:

May I ask what is the Integer trait? Couldn't find any in the std doc:

Did you mean std::num::Int (core::num::Int) when you wrote "the Int trait"? But it doesn't even inherit PartialOrd. Am I missing something?

@japaric
Copy link
Member

japaric commented Nov 8, 2014

@nodakai The Integer trait is in the num crate.

@nodakai
Copy link
Contributor

nodakai commented Nov 8, 2014

@japaric Ah, it was the big int code separated from the std lib! Thanks.

I also overlooked std::num::Int implemented Primitive, implying PartialOrd. Sorry for the noise!

bors added a commit that referenced this issue Nov 10, 2014
Previously Int inherited from PartialOrd (via Primitive)
but not Ord.  But integers have a total order, so
inheriting from Ord is appropriate. Fixes #18776.
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants