-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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 Saturating
type
#87920
Comments
Saturating
type
Add Saturating type (based on Wrapping type) Tracking rust-lang#87920 ### Unresolved Questions <!-- Include any open questions that need to be answered before the feature can be stabilised. --> - [x] ~`impl Div for Saturating<T>` falls back on inner integer division - which seems alright?~ - [x] add `saturating_div`? (to respect division by `-1`) - [x] There is no `::saturating_shl` and `::saturating_shr`. (How to) implement `Shl`, `ShlAssign`, `Shr` and `ShrAssign`? - [naively](3f7d2ce) - [x] ~`saturating_neg` is only implemented on [signed integer types](https://doc.rust-lang.org/std/?search=saturating_n)~ - [x] Is the implementation copied over from the `Wrapping`-type correct for `Saturating`? - [x] `Saturating::rotate_left` - [x] `Saturating::rotate_right` - [x] `Not` - [x] `BitXorOr` and `BitXorOrAssign` - [x] `BitOr` and `BitOrAssign` - [x] `BitAnd` and `BitAndAssign` - [x] `Saturating::swap_bytes` - [x] `Saturating::reverse_bits`
FCP for stabilizing |
Team member @joshtriplett has proposed to merge this. The next step is review by the rest of the tagged team members: Concerns:
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. |
What about the remaining unresolved question regarding the correct behavior of |
@kennytm outlined possible implementations for that (#87921 (comment)), but I am not sure what seems to be the correct implementation and I would be happy for any input in that regards. |
I would like to see the situation with saturating shift clarified first before we stabilize this. There is an unsubmited RFC about this (cc @avitex) which has been discussed a bit in Zulip (1 2) but without coming to a conclusion. @rfcbot concern saturating shifts |
Hmm, it might be a bit confusing, but I initially intended to only stabilize @joshtriplett also mentioned it that way here? |
Oh right, I missed that message. TBF it's a bit confusing to have two very different features sharing the same tracking issue. @rfcbot resove saturating shift |
Yes, you are right about that, sorry 😅🙈 @avitex I would appreciate your implementation for shl and shr for the number types to use it in the @Amanieu You seem to have a typo in your second rfcbot command? |
@rfcbot resolve saturating shifts |
Should we go ahead and split this tracking issue? |
That's fine with me, I had the wrong impression that the rfcbot would be run on #88624. What effect does it have on the running poll? |
We would close the poll on this tracking issue and re-open it on the new one and check off the boxes for those who've already approved it here, so effectively none. |
Okay, I have just created a new tracking issue: #89381 |
@rfcbot cancel |
@yaahc proposal cancelled. |
I have a question. Why was the name |
Because all/most the underlying calls on the Integer are also already prefixed with https://doc.rust-lang.org/stable/std/intrinsics/fn.saturating_add.html |
The only contentious part of @rfcbot fcp merge |
Team member @Amanieu 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. |
Also stabilizes saturating_int_assign_impl, rust-langgh-92354. And also make pub fns const where the underlying saturating_* fns became const in the meantime since the Saturating type was created.
Rollup merge of rust-lang#115477 - kellerkindt:stabilized_int_impl, r=dtolnay Stabilize the `Saturating` type Closes rust-lang#87920 Closes rust-lang#92354 Stabilization report rust-lang#87920 (comment) FCP rust-lang#87920 (comment)
Also stabilizes saturating_int_assign_impl, rust-langgh-92354. And also make pub fns const where the underlying saturating_* fns became const in the meantime since the Saturating type was created.
Stabilize the `Saturating` type Closes #87920 Closes #92354 Stabilization report rust-lang/rust#87920 (comment) FCP rust-lang/rust#87920 (comment)
Also stabilizes saturating_int_assign_impl, rust-langgh-92354. And also make pub fns const where the underlying saturating_* fns became const in the meantime since the Saturating type was created.
The implementation in stdlib has been removed as part of stabilizing rust-lang/rust#87920. Support for saturating shifts will be added back once rust-lang/libs-team#230 is fixed.
This patch resolves below: ``` Compiling serde v1.0.198 error[E0658]: use of unstable library feature 'saturating_int_impl' --> /home/sangwan/.cargo/registry/src/index.crates.io-6f17d22bba15001f/serde-1.0.198/src/lib.rs:279:13 | 279 | pub use self::core::num::Saturating; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: see issue #87920 <rust-lang/rust#87920> for more information = help: add `#![feature(saturating_int_impl)]` to the crate attributes t ``` Signed-off-by: Sangwan Kwon <sangwan.kwon@samsung.com>
This patch resolves below: ``` Compiling serde v1.0.198 error[E0658]: use of unstable library feature 'saturating_int_impl' --> /home/sangwan/.cargo/registry/src/index.crates.io-6f17d22bba15001f/serde-1.0.198/src/lib.rs:279:13 | 279 | pub use self::core::num::Saturating; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: see issue #87920 <rust-lang/rust#87920> for more information = help: add `#![feature(saturating_int_impl)]` to the crate attributes t ``` Signed-off-by: Sangwan Kwon <sangwan.kwon@samsung.com>
This patch resolves below: ``` Compiling serde v1.0.198 error[E0658]: use of unstable library feature 'saturating_int_impl' --> /home/sangwan/.cargo/registry/src/index.crates.io-6f17d22bba15001f/serde-1.0.198/src/lib.rs:279:13 | 279 | pub use self::core::num::Saturating; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: see issue #87920 <rust-lang/rust#87920> for more information = help: add `#![feature(saturating_int_impl)]` to the crate attributes t ``` Signed-off-by: Sangwan Kwon <sangwan.kwon@samsung.com>
This fix is for resolving the below error in AnalysisHub. ``` $ ./scripts/deps/rust.sh ... Compiling tempfile v3.10.1 Compiling serde_derive v1.0.201 error[E0658]: use of unstable library feature 'saturating_int_impl' --> /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/serde-1.0.201/src/lib.rs:280:13 | 280 | pub use self::core::num::Saturating; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: see issue #87920 <rust-lang/rust#87920> for more information = help: add `#![feature(saturating_int_impl)]` to the crate attributes to enable ... ``` Signed-off-by: Changho Choi <ch754.choi@samsung.com>
This update will fix the below error in AnalysisHub. ``` $ ./scripts/deps/rust.sh ... Compiling tempfile v3.10.1 Compiling serde_derive v1.0.201 error[E0658]: use of unstable library feature 'saturating_int_impl' --> /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/serde-1.0.201/src/lib.rs:280:13 | 280 | pub use self::core::num::Saturating; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: see issue #87920 <rust-lang/rust#87920> for more information = help: add `#![feature(saturating_int_impl)]` to the crate attributes to enable ... ```
This update will fix the below error in AnalysisHub. ``` $ ./scripts/deps/rust.sh ... Compiling tempfile v3.10.1 Compiling serde_derive v1.0.201 error[E0658]: use of unstable library feature 'saturating_int_impl' --> /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/serde-1.0.201/src/lib.rs:280:13 | 280 | pub use self::core::num::Saturating; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: see issue #87920 <rust-lang/rust#87920> for more information = help: add `#![feature(saturating_int_impl)]` to the crate attributes to enable ... ``` Signed-off-by: Changho Choi <ch754.choi@samsung.com>
This fix is for resolving the below error in AnalysisHub. ``` $ ./scripts/deps/rust.sh ... Compiling tempfile v3.10.1 Compiling serde_derive v1.0.201 error[E0658]: use of unstable library feature 'saturating_int_impl' --> /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/serde-1.0.201/src/lib.rs:280:13 | 280 | pub use self::core::num::Saturating; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: see issue #87920 <rust-lang/rust#87920> for more information = help: add `#![feature(saturating_int_impl)]` to the crate attributes to enable ... ``` Signed-off-by: Changho Choi <ch754.choi@samsung.com>
This update will fix the below error in AnalysisHub. ``` $ ./scripts/deps/rust.sh ... Compiling tempfile v3.10.1 Compiling serde_derive v1.0.201 error[E0658]: use of unstable library feature 'saturating_int_impl' --> /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/serde-1.0.201/src/lib.rs:280:13 | 280 | pub use self::core::num::Saturating; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: see issue #87920 <rust-lang/rust#87920> for more information = help: add `#![feature(saturating_int_impl)]` to the crate attributes to enable ... ``` Signed-off-by: Changho Choi <ch754.choi@samsung.com>
This is a tracking issue for the RFC "928" (rust-lang/rfcs#928).
The feature gate for the issue is
#![feature(saturating_int_impl)]
.About tracking issues
Tracks progress for
Saturating
type analogue to #32463Unresolved Questions
Shl
andShalAssign
forSaturating<signed>
Add Saturating type (based on Wrapping type) #87921 (comment)
Possible solution: Tracking Issue for
Saturating
type #87920 (comment)@avitex https://github.com/avitex/rfcs/blob/master/text/0000-saturating-bit-shifts.md
Steps
saturating_div
(Tracking Issue forsaturating_div
#89381)saturating_shl
andsaturating_shr
on ints #103441)saturating_int_impl
Implementation history
struct Saturating
andfeature(saturating_int_impl)
The text was updated successfully, but these errors were encountered: