]> git.lizzy.rs Git - rust.git/commit - src/tools/rust-analyzer
Auto merge of #81384 - tmiasko:partial-ord, r=petrochenkov
authorbors <bors@rust-lang.org>
Tue, 9 Feb 2021 08:47:38 +0000 (08:47 +0000)
committerbors <bors@rust-lang.org>
Tue, 9 Feb 2021 08:47:38 +0000 (08:47 +0000)
commitc648bd55580a918d6f26f39bc167913a9da5ae3d
treeb365028cade2f02b40ab3af5230d39bc3dcb5500
parentf4008fe94935d05ffb3a48fc5b7149070bb45550
parent62366ee6f14ed2798130aeedfbfe51e0d208d2c6
Auto merge of #81384 - tmiasko:partial-ord, r=petrochenkov

Fix derived PartialOrd operators

The derived implementation of `partial_cmp` compares matching fields one
by one, stopping the computation when the result of a comparison is not
equal to `Some(Equal)`.

On the other hand the derived implementation for `lt`, `le`, `gt` and
`ge` continues the computation when the result of a field comparison is
`None`, consequently those operators are not transitive and inconsistent
with `partial_cmp`.

Fix the inconsistency by using the default implementation that fall-backs
to the `partial_cmp`. This also avoids creating very deeply nested
closures that were quite costly to compile.

Fixes #81373.
Helps with #81278, #80118.