Skip to content

Conversation

Dan54
Copy link

@Dan54 Dan54 commented Oct 16, 2025

For #142309: change the error message for Ord::clamp() for std integer types if min > max to be more useful.

Message is now min > max. min = {min:?}, max = {max:?}

Also add #[track_caller] to clamp()

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Oct 16, 2025
@rustbot
Copy link
Collaborator

rustbot commented Oct 16, 2025

r? @scottmcm

rustbot has assigned @scottmcm.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Copy link
Member

@hkBst hkBst left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you should instead just improve the default implementation of clamp to have a better error message...

View changes since this review

@Dan54
Copy link
Author

Dan54 commented Oct 16, 2025

The nicer error message requires Self: Debug, which is not required by Ord. Adding the trait bound would be a breaking change.

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

Labels

S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants