Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added unchecked_div and unchecked_rem to signed and unsigned numerical types #137598

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

madhav-madhusoodanan
Copy link
Contributor

Context

Adds unchecked_div and unchecked_rem to signed and unsigned numerical types in core.
This is an unstable addition.

Related Issue

@rustbot
Copy link
Collaborator

rustbot commented Feb 25, 2025

r? @tgross35

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

@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 Feb 25, 2025
@madhav-madhusoodanan madhav-madhusoodanan changed the title [WIP] Added unchecked_div and unchecked_rem to signed and unsigned numerical types Added unchecked_div and unchecked_rem to signed and unsigned numerical types Feb 25, 2025
@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@madhav-madhusoodanan madhav-madhusoodanan force-pushed the feature-unchecked-div-rem branch 2 times, most recently from ed68857 to 1a6551b Compare February 25, 2025 11:44
@tgross35
Copy link
Contributor

r? @the8472 since you expressed some concerns at #136716

@rustbot rustbot assigned the8472 and unassigned tgross35 Feb 25, 2025
@the8472
Copy link
Member

the8472 commented Feb 25, 2025

On the tracking issue I was mostly voicing conern about the naming, i.e. having two functions with the same name but different safety preconditions.
The libs-API team already accepted this as unstable addition so my concern shouldn't be a blocker for this PR, but I'd want to be reconsidered before stabilization, that's why I noted it on the tracking issue.

Copy link
Contributor

@Sky9x Sky9x left a comment

Choose a reason for hiding this comment

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

Some of the requested changes are only on 1 of the functions, please make sure they are applied to all 4 (if applicable).

@rust-log-analyzer

This comment has been minimized.

@madhav-madhusoodanan
Copy link
Contributor Author

Have updated documentation and corrected the failure condition being passed to assert_unsafe_precondition for unchecked_div and unchecked_rem functions in int_macros.rs.

Special thanks to @Sky9x for the suggestions.

@rustbot review

@rust-log-analyzer

This comment has been minimized.

@madhav-madhusoodanan madhav-madhusoodanan changed the title Added unchecked_div and unchecked_rem to signed and unsigned numerical types [WIP] Added unchecked_div and unchecked_rem to signed and unsigned numerical types Feb 26, 2025
@rust-log-analyzer

This comment has been minimized.

@madhav-madhusoodanan madhav-madhusoodanan force-pushed the feature-unchecked-div-rem branch 2 times, most recently from 0878b5e to 5d40a59 Compare February 26, 2025 09:48
@madhav-madhusoodanan madhav-madhusoodanan changed the title [WIP] Added unchecked_div and unchecked_rem to signed and unsigned numerical types Added unchecked_div and unchecked_rem to signed and unsigned numerical types Feb 26, 2025
Copy link
Contributor

@Sky9x Sky9x left a comment

Choose a reason for hiding this comment

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

LGTM!
Tip: You can collapse review comments by clicking on "Resolve Conversation" once you've addressed it

@madhav-madhusoodanan madhav-madhusoodanan force-pushed the feature-unchecked-div-rem branch from 8d2a5b6 to 2c9342d Compare March 2, 2025 04:21
@madhav-madhusoodanan
Copy link
Contributor Author

madhav-madhusoodanan commented Mar 28, 2025

I would be grateful if you could please take a look at this PR @the8472.

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.

8 participants