Skip to content

Commit 0c7b513

Browse files
authored
Rollup merge of rust-lang#88624 - kellerkindt:master, r=JohnTitor
Stabilize feature `saturating_div` for rust 1.58.0 The tracking issue is rust-lang#89381 This seems like a reasonable simple change(?). The feature `saturating_div` was added as part of the ongoing effort to implement a `Saturating` integer type (see rust-lang#87921). The implementation has been discussed [here](rust-lang#87921 (comment)) and [here](rust-lang#87921 (comment)). It extends the list of saturating operations on integer types (like `saturating_add`, `saturating_sub`, `saturating_mul`, ...) by the function `fn saturating_div(self, rhs: Self) -> Self`. The stabilization of the feature `saturating_int_impl` (for the `Saturating` type) needs to have this stabilized first. Closes rust-lang#89381
2 parents 121411d + 0dba9d0 commit 0c7b513

File tree

4 files changed

+4
-15
lines changed

4 files changed

+4
-15
lines changed

library/core/src/num/int_macros.rs

+1-6
Original file line numberDiff line numberDiff line change
@@ -1055,22 +1055,17 @@ macro_rules! int_impl {
10551055
/// Basic usage:
10561056
///
10571057
/// ```
1058-
/// #![feature(saturating_div)]
1059-
///
10601058
#[doc = concat!("assert_eq!(5", stringify!($SelfT), ".saturating_div(2), 2);")]
10611059
#[doc = concat!("assert_eq!(", stringify!($SelfT), "::MAX.saturating_div(-1), ", stringify!($SelfT), "::MIN + 1);")]
10621060
#[doc = concat!("assert_eq!(", stringify!($SelfT), "::MIN.saturating_div(-1), ", stringify!($SelfT), "::MAX);")]
10631061
///
10641062
/// ```
10651063
///
10661064
/// ```should_panic
1067-
/// #![feature(saturating_div)]
1068-
///
10691065
#[doc = concat!("let _ = 1", stringify!($SelfT), ".saturating_div(0);")]
10701066
///
10711067
/// ```
1072-
#[unstable(feature = "saturating_div", issue = "87920")]
1073-
#[rustc_const_unstable(feature = "saturating_div", issue = "87920")]
1068+
#[stable(feature = "saturating_div", since = "1.58.0")]
10741069
#[must_use = "this returns the result of the operation, \
10751070
without modifying the original"]
10761071
#[inline]

library/core/src/num/saturating.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ macro_rules! saturating_impl {
273273
/// Basic usage:
274274
///
275275
/// ```
276-
/// #![feature(saturating_int_impl, saturating_div)]
276+
/// #![feature(saturating_int_impl)]
277277
/// use std::num::Saturating;
278278
///
279279
#[doc = concat!("assert_eq!(Saturating(2", stringify!($t), "), Saturating(5", stringify!($t), ") / Saturating(2));")]
@@ -282,7 +282,7 @@ macro_rules! saturating_impl {
282282
/// ```
283283
///
284284
/// ```should_panic
285-
/// #![feature(saturating_int_impl, saturating_div)]
285+
/// #![feature(saturating_int_impl)]
286286
/// use std::num::Saturating;
287287
///
288288
#[doc = concat!("let _ = Saturating(0", stringify!($t), ") / Saturating(0);")]

library/core/src/num/uint_macros.rs

+1-6
Original file line numberDiff line numberDiff line change
@@ -1120,20 +1120,15 @@ macro_rules! uint_impl {
11201120
/// Basic usage:
11211121
///
11221122
/// ```
1123-
/// #![feature(saturating_div)]
1124-
///
11251123
#[doc = concat!("assert_eq!(5", stringify!($SelfT), ".saturating_div(2), 2);")]
11261124
///
11271125
/// ```
11281126
///
11291127
/// ```should_panic
1130-
/// #![feature(saturating_div)]
1131-
///
11321128
#[doc = concat!("let _ = 1", stringify!($SelfT), ".saturating_div(0);")]
11331129
///
11341130
/// ```
1135-
#[unstable(feature = "saturating_div", issue = "87920")]
1136-
#[rustc_const_unstable(feature = "saturating_div", issue = "87920")]
1131+
#[stable(feature = "saturating_div", since = "1.58.0")]
11371132
#[must_use = "this returns the result of the operation, \
11381133
without modifying the original"]
11391134
#[inline]

library/std/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,6 @@
324324
#![feature(ptr_internals)]
325325
#![feature(rustc_attrs)]
326326
#![feature(rustc_private)]
327-
#![feature(saturating_div)]
328327
#![feature(saturating_int_impl)]
329328
#![feature(slice_concat_ext)]
330329
#![feature(slice_internals)]

0 commit comments

Comments
 (0)