rust-lang / rust-lang/rust

Document `PartialOrd` behavior for `Option<T> where T: PartialOrd`

Open
#161,746 2 comments 0 reactions 1 assignee View on GitHub

@zepredos is already working on this.

Since Aug 26, 2026.

A-docs E-easy
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

Location (URL)

https://doc.rust-lang.org/std/cmp/trait.PartialOrd.html#impl-PartialOrd-for-Option%3CT%3E

Summary

The behavior of impl<T> PartialOrd for Option<T> where T: PartialOrd isn't documented. One can take a look into the source code to check that, but I believe it would be better if it was explicitly documented like e.g. for impl PartialOrd for str or arrays, vectors, slices, etc. ("Implements comparison of ... lexicographically.")

I know that the policy is to maintain backwards compatibility and changing that behavior would be considered breaking, but I still believe it would be good to document the partial ordering strategy.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.