Skip to content

Commit 647a36d

Browse files
author
Ariel Ben-Yehuda
authored
Rollup merge of #42920 - behnam:cmp, r=BurntSushi
[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.
2 parents bfe0098 + 330dab8 commit 647a36d

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/libcore/cmp.rs

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

0 commit comments

Comments
 (0)