-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Tracking Issue for #![feature(mixed_integer_ops)]
#87840
Comments
Somewhere you should write about use cases & purposes of these ops :) |
I've needed fn checked_add_signed(pos: u64, offset: i64) -> Option<u64> {
if offset >= 0 {
u64::checked_add(pos, offset as u64)
} else {
u64::checked_sub(pos, offset.unsigned_abs())
}
} It would be great to have this in the stdlib! |
This is exactly what prompted me to write these ! Also it is what |
Would love to see this get stabilized. Not sure what the right process is to start an FCP |
I love these methods! I would love to see *_sub_signed and friends too. I just had a use for saturating_sub_signed (subtracting a signed residual from an unsigned value to create a corrected value). In my case, I can just negate the residual. However, that might cause overflow, in which case the final calculated value would not be correct. This won't really matter in practice, but saturating_sub_signed still would have been nice! |
I just ran into a use case for these as well, in Cargo, for working with CPU counts (e.g. "use all but 1 CPU"). |
These have been around for a long time, and it seems like several people are interested in them. Shall we stabilize these? @rfcbot merge |
Team member @joshtriplett has proposed to merge this. The next step is review by the rest of the tagged team members: No concerns currently listed. Once a majority of reviewers approve (and at most 2 approvals are outstanding), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up! See this document for info about what commands tagged team members can give me. |
🔔 This is now entering its final comment period, as per the review above. 🔔 |
The final comment period, with a disposition to merge, as per the review above, is now complete. As the automated representative of the governance process, I would like to thank the author for their work and everyone else who contributed. This will be merged soon. |
…s, r=joshtriplett Stabilize `#![feature(mixed_integer_ops)]` Tracked and FCP completed in rust-lang#87840. `@rustbot` label +T-libs-api +S-waiting-on-review +relnotes r? rust-lang/t-libs-api
…s, r=joshtriplett Stabilize `#![feature(mixed_integer_ops)]` Tracked and FCP completed in rust-lang#87840. ``@rustbot`` label +T-libs-api +S-waiting-on-review +relnotes r? rust-lang/t-libs-api
…s, r=joshtriplett Stabilize `#![feature(mixed_integer_ops)]` Tracked and FCP completed in rust-lang#87840. ```@rustbot``` label +T-libs-api +S-waiting-on-review +relnotes r? rust-lang/t-libs-api
…s, r=joshtriplett Stabilize `#![feature(mixed_integer_ops)]` Tracked and FCP completed in rust-lang#87840. ````@rustbot```` label +T-libs-api +S-waiting-on-review +relnotes r? rust-lang/t-libs-api
The feature has been stabilized by #101555, closing. |
Previously, we only supported the abbreviation being shorter than its expansion, e.g. `gs` -> `git status`. Now, the opposite is supported, e.g. `exa` -> `ls`. This solution can be enhanced when the feature "mixed_integer_ops" is released in stable (tracking: rust-lang/rust#87840).
Previously, we only supported the abbreviation being shorter than its expansion, e.g. `gs` -> `git status`. Now, the opposite is supported, e.g. `exa` -> `ls`. This solution can be enhanced when the feature "mixed_integer_ops" is released in stable (tracking: rust-lang/rust#87840).
Feature gate:
#![feature(mixed_integer_ops)]
Public API
Steps / History
#![feature(mixed_integer_ops)]
#101555The text was updated successfully, but these errors were encountered: