Change:
<!-- NOTE: For library features, please use the "Library Tracking Issue" template instead. Thank you for creating a tracking issue! Tracking issues are for tracking a feature from implementation to stabilisation. Make sure to include the relevant RFC for the feature if it has one. Otherwise provide a short summary of the feature and link any relevant PRs or issues, and remove any sections that are not relevant to the feature. Remember to add team labels to the tracking issue. For a language team feature, this would e.g., be . Such a feature should also be labeled with e.g., . This label is used to associate issues (e.g., bugs and design questions) to the feature. --The feature gate for the issue is . This tracking issue tracks the progress of the feature, which shall provide a saturating division for integer types. It is part of the ongoing effort to stabilize the type <!-- Include any open questions that need to be answered before the feature can be stabilised. --None. The implementation has been discussed and . <!-- Include each step required to complete the feature. Typically this is a PR implementing a feature, followed by a PR that stabilises the feature. However for larger features an implementation could be broken up into multiple PRs. --- [x] implement () [x] Stabilize () <!-- [ ] Adjust documentation ([see instructions on rustc-dev-guide][doc-guide]) [ ] Stabilization PR ([see instructions on rustc-dev-guide][stabilization-guide]) --[stabilization-guide]: https://rustc-dev- [doc-guide]: https://rustc-dev- <!-- Include a list of all the PRs that were involved in implementing the feature. --- Implementation Adds and
merge
Team member has proposed to merge this. The next step is review by the rest of the tagged team members: [x] [x] [x] [x] [ ] [x] 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 for info about what commands tagged team members can give me.
:bell: This is now entering its final comment period, as per the . :bell:
The final comment period, with a disposition to merge, as per the , 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.
I'm just curious: why was this feature stabilized so soon after being ? IIRC, usually features wait for at least a couple months before being stabilized.
AFAIK it has been a couple months, I think that it was just missing the tracking issue because they split this out as a partial stabilization from The original PR adding it landed in late august, , so it was a bit on the fast side but AFAIK we don't have any rule about how long things should remain on nightly before they're eligible for stabilization. Maybe we should? In this case I don't expect it will be a problem, this one seems pretty non-controversial, but I'm curious what the rest of thinks.
IIRC, is the only operator that panics. Although obvious, such behavior should probably deserve a improved documentation.

Discussion:
/// Basic usage: /// /// ``` <del> /// #![feature(saturating_div)] /// </del> #[doc = concat!("assert_eq!(5", stringify!($SelfT), ".saturating_div(2), 2);")] #[doc = concat!("assert_eq!(", stringify!($SelfT), "::MAX.saturating_div(-1), ", stringify!($SelfT), "::MIN + 1);")] #[doc = concat!("assert_eq!(", stringify!($SelfT), "::MIN.saturating_div(-1), ", stringify!($SelfT), "::MAX);")]

/// ``` /// /// ```should_panic <del> /// #![feature(saturating_div)] /// </del> #[doc = concat!("let _ = 1", stringify!($SelfT), ".saturating_div(0);")] /// /// ``` <del> #[unstable(feature = "saturating_div", issue = "87920")] #[rustc_const_unstable(feature = "saturating_div", issue = "87920")] </del> <ins> #[stable(feature = "saturating_div", since = "1.58.0")] </ins> #[must_use = "this returns the result of the operation,  without modifying the original"] #[inline]

/// Basic usage: /// /// ``` <del> /// #![feature(saturating_int_impl, saturating_div)] </del> <ins> /// #![feature(saturating_int_impl)] </ins> /// use std::num::Saturating; /// #[doc = concat!("assert_eq!(Saturating(2", stringify!($t), "), Saturating(5", stringify!($t), ") / Saturating(2));")]

/// ``` /// /// ```should_panic <del> /// #![feature(saturating_int_impl, saturating_div)] </del> <ins> /// #![feature(saturating_int_impl)] </ins> /// use std::num::Saturating; /// #[doc = concat!("let _ = Saturating(0", stringify!($t), ") / Saturating(0);")]

/// Basic usage: /// /// ``` <del> /// #![feature(saturating_div)] /// </del> #[doc = concat!("assert_eq!(5", stringify!($SelfT), ".saturating_div(2), 2);")] /// /// ``` /// /// ```should_panic <del> /// #![feature(saturating_div)] /// </del> #[doc = concat!("let _ = 1", stringify!($SelfT), ".saturating_div(0);")] /// /// ``` <del> #[unstable(feature = "saturating_div", issue = "87920")] #[rustc_const_unstable(feature = "saturating_div", issue = "87920")] </del> <ins> #[stable(feature = "saturating_div", since = "1.58.0")] </ins> #[must_use = "this returns the result of the operation,  without modifying the original"] #[inline]

#![feature(ptr_internals)] #![feature(rustc_attrs)] #![feature(rustc_private)] <del> #![feature(saturating_div)] </del> #![feature(saturating_int_impl)] #![feature(slice_concat_ext)] #![feature(slice_internals)]