-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Improve Ord docs #129003
Improve Ord docs #129003
Conversation
@Voultapher I scanned this a bit. If you want to split it out, the diff that only concerns PartialEq and Eq already has my r+ modulo "Jubilee finds a typo on a second/third pass". The rest will take more time to review. |
@workingjubilee I have a slight preference for keeping it as one PR if that's fine for you. |
@Voultapher Understandable, then! I just wanted to extend the option. |
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.
I got through the non-example text. The large number of whitespace-only changes are part of why this has been a bit slow to review. They are all very distracting, and some of them actually are incorrect. I haven't reviewed the examples yet.
I will probably not be able to review the examples without these being fixed, since I will be trying to relate the examples back to prior text. |
In hindsight I should have split the whitespace changes out as a separate commit, sorry. |
9155758
to
386e04e
Compare
I've rebased the branch and added the requested changes as a new commit. |
@workingjubilee I think the PR is waiting on review |
It is, I was working yesterday mostly on making sure backtraces are handled correctly on Android (and a lot of other platforms tbh). |
No worries, please take your time. I mentioned it because the issue has the label |
Oh. |
brain? earth to Jubilee? |
- Makes wording more clear and re-structures some sections that can be overwhelming for some not already in the know. - Adds examples of how *not* to implement Ord, inspired by various anti-patterns found in real world code.
2bf9b72
to
a67d3bd
Compare
a67d3bd is the new commit, everything else is just a rebase to not fall too far behind master. |
Thank you for this. Sorry for taking so long at points. I think this looks good! I'm not entirely sure if providing examples of bad implementations is not more confusing, in a way? But I think we should try it and find out how people respond. We can easily remove it later if we find it has the "that sign can't stop me because I can't read!" effect, and if memory serves we currently use such "negative examples" in far more dicey situations. And that's a relatively small part of this PR overall. This is a clear improvement throughout. @bors r+ |
…iaskrgr Rollup of 4 pull requests Successful merges: - rust-lang#123932 (restate GlobalAlloc method safety preconditions in terms of what the caller has to do for greater clarity) - rust-lang#129003 (Improve Ord docs) - rust-lang#130972 (stabilize const_cell_into_inner) - rust-lang#130990 (try to get rid of mir::Const::normalize) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#129003 - Voultapher:improve-ord-docs, r=workingjubilee Improve Ord docs - Makes wording more clear and re-structures some sections that can be overwhelming for someone not already in the know. - Adds examples of how *not* to implement Ord, inspired by various anti-patterns found in real world code. Many of the wording changes are inspired directly by my personal experience of being confused by the `Ord` docs and seeing other people get it wrong as well, especially lately having looked at a number of `Ord` implementations as part of rust-lang#128899. Created with help by `@orlp.` r? `@workingjubilee`
...bors, calm down. |
Many of the wording changes are inspired directly by my personal experience of being confused by the
Ord
docs and seeing other people get it wrong as well, especially lately having looked at a number ofOrd
implementations as part of #128899.Created with help by @orlp.
r? @workingjubilee