Skip to content

Implement clamp_min and clamp_max#147786

Closed
Kyuuhachi wants to merge 1 commit into
rust-lang:mainfrom
Kyuuhachi:clamp-min-max
Closed

Implement clamp_min and clamp_max#147786
Kyuuhachi wants to merge 1 commit into
rust-lang:mainfrom
Kyuuhachi:clamp-min-max

Conversation

@Kyuuhachi

Copy link
Copy Markdown
Contributor

Implements #147781.

@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

rustbot commented Oct 16, 2025

Copy link
Copy Markdown
Collaborator

r? @joboet

rustbot has assigned @joboet.
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

@Kyuuhachi Kyuuhachi mentioned this pull request Oct 16, 2025
5 tasks
Comment thread library/core/src/num/f64.rs Outdated
Comment thread library/core/src/num/f32.rs Outdated
Comment thread library/core/src/num/f16.rs Outdated
Comment thread library/core/src/num/f128.rs Outdated
@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Oct 21, 2025
@Kyuuhachi

Copy link
Copy Markdown
Contributor Author

Oops. Silly copypaste mistakes.

@Kyuuhachi

Copy link
Copy Markdown
Contributor Author

@rustbot ready

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Oct 23, 2025
@joboet

joboet commented Oct 30, 2025

Copy link
Copy Markdown
Member

r=me after squashing commits

@bors delegate+

@bors

bors commented Oct 30, 2025

Copy link
Copy Markdown
Collaborator

✌️ @Kyuuhachi, you can now approve this pull request!

If @joboet told you to "r=me" after making some further change, please make that change, then do @bors r=@joboet

Add example clamping by length

Implement clamp_min/max on floats

Fix copypaste mistakes in tests
@rustbot

rustbot commented Oct 31, 2025

Copy link
Copy Markdown
Collaborator

This PR was rebased onto a different master commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

@Kyuuhachi

Copy link
Copy Markdown
Contributor Author

@bors r=@joboet

@bors

bors commented Oct 31, 2025

Copy link
Copy Markdown
Collaborator

📌 Commit af5b798 has been approved by joboet

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Oct 31, 2025
Zalathar added a commit to Zalathar/rust that referenced this pull request Nov 1, 2025
Zalathar added a commit to Zalathar/rust that referenced this pull request Nov 1, 2025
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Nov 1, 2025
@Zalathar

Zalathar commented Nov 1, 2025

Copy link
Copy Markdown
Member

Failed in rollup in test-various: #148354 (comment)

@bors r-

@bors bors removed the S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. label Nov 1, 2025
@bors bors added the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Nov 1, 2025
@matthiaskrgr

Copy link
Copy Markdown
Member

@bors r- #148354 (comment)

@bors

bors commented Dec 1, 2025

Copy link
Copy Markdown
Collaborator

☔ The latest upstream changes (presumably #149510) made this pull request unmergeable. Please resolve the merge conflicts.

@Kyuuhachi

Copy link
Copy Markdown
Contributor Author

Closing as superseded by #150075.

@Kyuuhachi Kyuuhachi closed this Dec 16, 2025
@rustbot rustbot removed the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Dec 16, 2025
rust-bors Bot pushed a commit that referenced this pull request Jul 1, 2026
Implement clamp_to





Implements the revised version of #147781. Supersedes #147786.

Currently I restrict the ClampBounds trait using a second, perma-unstable feature. I don't know if that's the usual way to deal with this kind of traits, I'd be happy to change it if not.

~~I currently define NaN as equal to no bound. This is consistent with `max` and `min`, but is inconsistent with `clamp`, which panics.~~

Changed so that the float versions panic if any bound is NaN, just like `clamp` does.
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Jul 1, 2026
…,ChrisDenton

Implement clamp_to

Implements the revised version of rust-lang#147781. Supersedes rust-lang#147786.

Currently I restrict the ClampBounds trait using a second, perma-unstable feature. I don't know if that's the usual way to deal with this kind of traits, I'd be happy to change it if not.

~~I currently define NaN as equal to no bound. This is consistent with `max` and `min`, but is inconsistent with `clamp`, which panics.~~

Changed so that the float versions panic if any bound is NaN, just like `clamp` does.
rust-bors Bot pushed a commit that referenced this pull request Jul 1, 2026
Implement clamp_to





Implements the revised version of #147781. Supersedes #147786.

Currently I restrict the ClampBounds trait using a second, perma-unstable feature. I don't know if that's the usual way to deal with this kind of traits, I'd be happy to change it if not.

~~I currently define NaN as equal to no bound. This is consistent with `max` and `min`, but is inconsistent with `clamp`, which panics.~~

Changed so that the float versions panic if any bound is NaN, just like `clamp` does.
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Jul 1, 2026
…,ChrisDenton

Implement clamp_to

Implements the revised version of rust-lang#147781. Supersedes rust-lang#147786.

Currently I restrict the ClampBounds trait using a second, perma-unstable feature. I don't know if that's the usual way to deal with this kind of traits, I'd be happy to change it if not.

~~I currently define NaN as equal to no bound. This is consistent with `max` and `min`, but is inconsistent with `clamp`, which panics.~~

Changed so that the float versions panic if any bound is NaN, just like `clamp` does.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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.

6 participants