]> git.lizzy.rs Git - rust.git/commitdiff
Auto merge of #24270 - pnkfelix:use-disr-val-for-derive-ord, r=brson
authorbors <bors@rust-lang.org>
Fri, 10 Apr 2015 23:49:24 +0000 (23:49 +0000)
committerbors <bors@rust-lang.org>
Fri, 10 Apr 2015 23:49:24 +0000 (23:49 +0000)
Use `discriminant_value` intrinsic for `derive(PartialOrd)`

[breaking-change]

This is a [breaking-change] because it can change the result of comparison operators when enum discriminants have been explicitly assigned.  Notably in a case like:
```rust
#[derive(PartialOrd)]
enum E { A = 2, B = 1}
```

Under the old deriving, `A < B` held, because `A` came before `B` in the order of declaration.  But now we use the ordering according to the provided values, and thus `A > B`.  (However, this change is very unlikely to break much, if any, code, since the orderings themselves should all remain well-defined, total, etc.)

Fix #15523


Trivial merge