Skip to content

Commit 330dab8

Browse files
committed
[libcore/cmp] Expand Ord/PartialOrd Derivable doc for enum types
Expand Derivable docblock section for `Ord` and `PartialOrd` to cover `enum` types, in addition to the existing language explaining it for `struct` types.
1 parent 859c323 commit 330dab8

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

Diff for: src/libcore/cmp.rs

+6-4
Original file line numberDiff line numberDiff line change
@@ -380,8 +380,9 @@ impl<T: Ord> Ord for Reverse<T> {
380380
///
381381
/// ## Derivable
382382
///
383-
/// This trait can be used with `#[derive]`. When `derive`d, it will produce a lexicographic
384-
/// ordering based on the top-to-bottom declaration order of the struct's members.
383+
/// This trait can be used with `#[derive]`. When `derive`d on structs, it will produce a
384+
/// lexicographic ordering based on the top-to-bottom declaration order of the struct's members.
385+
/// When `derive`d on enums, variants are ordered by their top-to-bottom declaration order.
385386
///
386387
/// ## How can I implement `Ord`?
387388
///
@@ -513,8 +514,9 @@ impl PartialOrd for Ordering {
513514
///
514515
/// ## Derivable
515516
///
516-
/// This trait can be used with `#[derive]`. When `derive`d, it will produce a lexicographic
517-
/// ordering based on the top-to-bottom declaration order of the struct's members.
517+
/// This trait can be used with `#[derive]`. When `derive`d on structs, it will produce a
518+
/// lexicographic ordering based on the top-to-bottom declaration order of the struct's members.
519+
/// When `derive`d on enums, variants are ordered by their top-to-bottom declaration order.
518520
///
519521
/// ## How can I implement `PartialOrd`?
520522
///

0 commit comments

Comments
 (0)