Skip to content

Fix parameter order for _by() variants of min / max/ minmax in std::cmp#139357

Merged
bors merged 3 commits intorust-lang:masterfrom
miried:master
Aug 20, 2025
Merged

Fix parameter order for _by() variants of min / max/ minmax in std::cmp#139357
bors merged 3 commits intorust-lang:masterfrom
miried:master

Conversation

@miried
Copy link
Contributor

@miried miried commented Apr 4, 2025

We saw a regression introduced in version 1.86 that seems to be coming from switching the order of v1 and v2 when calling comparison functions in min_by / max_by / minmax_by (cf. this PR: #136307)

When the compare function is not symmetric in the arguments, this leads to false results. Apparently, the test cases do not cover this scenario currently. While asymmetric comparison may be an edge case, but current behavior is unexpected nevertheless.

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

disposition-merge This issue / PR is in PFCP or FCP with a disposition to merge it. finished-final-comment-period The final comment period is finished for this PR / Issue. regression-from-stable-to-stable Performance or correctness regression from one stable version to another. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants