From 9b5a004bf8a388cfe1fc6b844d65e528cca6e2fd Mon Sep 17 00:00:00 2001 From: Connor Horman Date: Wed, 21 Aug 2024 20:57:50 +0000 Subject: [PATCH 1/8] feat(core): Add implementations for `unbounded_shl`/`unbounded_shr` --- library/core/src/num/int_macros.rs | 60 +++++++++++++++++++++++++++++ library/core/src/num/uint_macros.rs | 54 ++++++++++++++++++++++++++ 2 files changed, 114 insertions(+) diff --git a/library/core/src/num/int_macros.rs b/library/core/src/num/int_macros.rs index 17cf2a7b261fd..0ec178448e476 100644 --- a/library/core/src/num/int_macros.rs +++ b/library/core/src/num/int_macros.rs @@ -1312,6 +1312,33 @@ macro_rules! int_impl { } } + /// Unbounded shift left. Computes `self << rhs`, without bounding the value of `rhs` + /// + /// If `rhs` is larger or equal to the number of bits in `self`, + /// the entire value is shifted out, and `0` is returned. + /// + /// # Examples + /// + /// Basic usage: + /// ``` + #[doc = concat!("assert_eq!(0x1", stringify!($SelfT), ".unbounded_shl(4), 0x10);")] + #[doc = concat!("assert_eq!(0x1", stringify!($SelfT), ".unbounded_shl(129), 0);")] + /// ``` + #[unstable(feature = "unbounded_shifts", issue = "129375")] + #[rustc_allow_const_fn_unstable(unchecked_shifts)] + #[must_use = "this returns the result of the operation, \ + without modifying the original"] + #[inline] + pub const fn unbounded_shl(self, v: u32) -> $SelfT{ + if v < Self::BITS{ + // SAFETY: + // v is just checked to be in-range above + unsafe{self.unchecked_shl(v)} + }else{ + 0 + } + } + /// Checked shift right. Computes `self >> rhs`, returning `None` if `rhs` is /// larger than or equal to the number of bits in `self`. /// @@ -1410,6 +1437,39 @@ macro_rules! int_impl { } } + /// Unbounded shift right. Computes `self >> rhs`, without bounding the value of `rhs` + /// + /// If `rhs` is larger or equal to the number of bits in `self`, + /// the entire value is shifted out, which yields `0` for a positive number, + /// and `-1` for a negative number. + /// + /// # Examples + /// + /// Basic usage: + /// ``` + #[doc = concat!("assert_eq!(0x10", stringify!($SelfT), ".unbounded_shl(4), 0x1);")] + #[doc = concat!("assert_eq!(0x10", stringify!($SelfT), ".unbounded_shr(129), 0);")] + #[doc = concat!("assert_eq!(", stringify!($SelfT), "::MIN.unbounded_shr(129), -1);")] + /// ``` + #[unstable(feature = "unbounded_shifts", issue = "129375")] + #[rustc_allow_const_fn_unstable(unchecked_shifts)] + #[must_use = "this returns the result of the operation, \ + without modifying the original"] + #[inline] + pub const fn unbounded_shr(self, v: u32) -> $SelfT{ + if v < Self::BITS{ + // SAFETY: + // v is just checked to be in-range above + unsafe{self.unchecked_shr(v)} + }else{ + // A shift by `Self::BITS-1` suffices for signed integers, because the sign bit is copied for each of the shifted bits. + + // SAFETY: + // `Self::BITS-1` is guaranteed to be less than `Self::BITS` + unsafe{self.unchecked_shr(Self::BITS - 1)} + } + } + /// Checked absolute value. Computes `self.abs()`, returning `None` if /// `self == MIN`. /// diff --git a/library/core/src/num/uint_macros.rs b/library/core/src/num/uint_macros.rs index 719a6a55940dc..5a2f1876ca2b8 100644 --- a/library/core/src/num/uint_macros.rs +++ b/library/core/src/num/uint_macros.rs @@ -1501,6 +1501,33 @@ macro_rules! uint_impl { } } + /// Unbounded shift left. Computes `self << rhs`, without bounding the value of `rhs` + /// + /// If `rhs` is larger or equal to the number of bits in `self`, + /// the entire value is shifted out, and `0` is returned. + /// + /// # Examples + /// + /// Basic usage: + /// ``` + #[doc = concat!("assert_eq!(0x1", stringify!($SelfT), ".unbounded_shl(4), 0x10);")] + #[doc = concat!("assert_eq!(0x1", stringify!($SelfT), ".unbounded_shl(129), 0);")] + /// ``` + #[unstable(feature = "unbounded_shifts", issue = "129375")] + #[rustc_allow_const_fn_unstable(unchecked_shifts)] + #[must_use = "this returns the result of the operation, \ + without modifying the original"] + #[inline] + pub const fn unbounded_shl(self, v: u32) -> $SelfT{ + if v < Self::BITS{ + // SAFETY: + // v is just checked to be in-range above + unsafe{self.unchecked_shl(v)} + }else{ + 0 + } + } + /// Checked shift right. Computes `self >> rhs`, returning `None` /// if `rhs` is larger than or equal to the number of bits in `self`. /// @@ -1599,6 +1626,33 @@ macro_rules! uint_impl { } } + /// Unbounded shift right. Computes `self >> rhs`, without bounding the value of `rhs` + /// + /// If `rhs` is larger or equal to the number of bits in `self`, + /// the entire value is shifted out, and `0` is returned. + /// + /// # Examples + /// + /// Basic usage: + /// ``` + #[doc = concat!("assert_eq!(0x10", stringify!($SelfT), ".unbounded_shr(4), 0x10);")] + #[doc = concat!("assert_eq!(0x10", stringify!($SelfT), ".unbounded_shr(129), 0);")] + /// ``` + #[unstable(feature = "unbounded_shifts", issue = "129375")] + #[rustc_allow_const_fn_unstable(unchecked_shifts)] + #[must_use = "this returns the result of the operation, \ + without modifying the original"] + #[inline] + pub const fn unbounded_shr(self, v: u32) -> $SelfT{ + if v < Self::BITS{ + // SAFETY: + // v is just checked to be in-range above + unsafe{self.unchecked_shr(v)} + }else{ + 0 + } + } + /// Checked exponentiation. Computes `self.pow(exp)`, returning `None` if /// overflow occurred. /// From c89bae0ea8f2b6c04ff26a14f8dd37eaa9bc2f0b Mon Sep 17 00:00:00 2001 From: Connor Horman Date: Wed, 21 Aug 2024 21:16:18 +0000 Subject: [PATCH 2/8] Manually format functions and use `rhs` instead of `v` from my CE testing --- library/core/src/num/int_macros.rs | 18 +++++++++--------- library/core/src/num/uint_macros.rs | 16 ++++++++-------- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/library/core/src/num/int_macros.rs b/library/core/src/num/int_macros.rs index 0ec178448e476..b22311da1e354 100644 --- a/library/core/src/num/int_macros.rs +++ b/library/core/src/num/int_macros.rs @@ -1329,11 +1329,11 @@ macro_rules! int_impl { #[must_use = "this returns the result of the operation, \ without modifying the original"] #[inline] - pub const fn unbounded_shl(self, v: u32) -> $SelfT{ - if v < Self::BITS{ + pub const fn unbounded_shl(self, rhs: u32) -> $SelfT{ + if rhs < Self::BITS{ // SAFETY: - // v is just checked to be in-range above - unsafe{self.unchecked_shl(v)} + // rhs is just checked to be in-range above + unsafe { self.unchecked_shl(rhs) } }else{ 0 } @@ -1456,17 +1456,17 @@ macro_rules! int_impl { #[must_use = "this returns the result of the operation, \ without modifying the original"] #[inline] - pub const fn unbounded_shr(self, v: u32) -> $SelfT{ - if v < Self::BITS{ + pub const fn unbounded_shr(self, rhs: u32) -> $SelfT{ + if rhs < Self::BITS{ // SAFETY: - // v is just checked to be in-range above - unsafe{self.unchecked_shr(v)} + // rhs is just checked to be in-range above + unsafe { self.unchecked_shr(rhs) } }else{ // A shift by `Self::BITS-1` suffices for signed integers, because the sign bit is copied for each of the shifted bits. // SAFETY: // `Self::BITS-1` is guaranteed to be less than `Self::BITS` - unsafe{self.unchecked_shr(Self::BITS - 1)} + unsafe { self.unchecked_shr(Self::BITS - 1) } } } diff --git a/library/core/src/num/uint_macros.rs b/library/core/src/num/uint_macros.rs index 5a2f1876ca2b8..b8ca299f67ddd 100644 --- a/library/core/src/num/uint_macros.rs +++ b/library/core/src/num/uint_macros.rs @@ -1518,11 +1518,11 @@ macro_rules! uint_impl { #[must_use = "this returns the result of the operation, \ without modifying the original"] #[inline] - pub const fn unbounded_shl(self, v: u32) -> $SelfT{ - if v < Self::BITS{ + pub const fn unbounded_shl(self, rhs: u32) -> $SelfT{ + if rhs < Self::BITS{ // SAFETY: - // v is just checked to be in-range above - unsafe{self.unchecked_shl(v)} + // rhs is just checked to be in-range above + unsafe { self.unchecked_shl(rhs) } }else{ 0 } @@ -1643,11 +1643,11 @@ macro_rules! uint_impl { #[must_use = "this returns the result of the operation, \ without modifying the original"] #[inline] - pub const fn unbounded_shr(self, v: u32) -> $SelfT{ - if v < Self::BITS{ + pub const fn unbounded_shr(self, rhs: u32) -> $SelfT{ + if rhs < Self::BITS{ // SAFETY: - // v is just checked to be in-range above - unsafe{self.unchecked_shr(v)} + // rhs is just checked to be in-range above + unsafe { self.unchecked_shr(rhs) } }else{ 0 } From 38b5a2a67e64e8a02c4bee9bd0314e5023a559cb Mon Sep 17 00:00:00 2001 From: Connor Horman Date: Wed, 21 Aug 2024 21:23:25 +0000 Subject: [PATCH 3/8] chore: Also format the control flow --- library/core/src/num/int_macros.rs | 8 ++++---- library/core/src/num/uint_macros.rs | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/library/core/src/num/int_macros.rs b/library/core/src/num/int_macros.rs index b22311da1e354..b48b05577c96c 100644 --- a/library/core/src/num/int_macros.rs +++ b/library/core/src/num/int_macros.rs @@ -1330,11 +1330,11 @@ macro_rules! int_impl { without modifying the original"] #[inline] pub const fn unbounded_shl(self, rhs: u32) -> $SelfT{ - if rhs < Self::BITS{ + if rhs < Self::BITS { // SAFETY: // rhs is just checked to be in-range above unsafe { self.unchecked_shl(rhs) } - }else{ + } else { 0 } } @@ -1457,11 +1457,11 @@ macro_rules! int_impl { without modifying the original"] #[inline] pub const fn unbounded_shr(self, rhs: u32) -> $SelfT{ - if rhs < Self::BITS{ + if rhs < Self::BITS { // SAFETY: // rhs is just checked to be in-range above unsafe { self.unchecked_shr(rhs) } - }else{ + } else { // A shift by `Self::BITS-1` suffices for signed integers, because the sign bit is copied for each of the shifted bits. // SAFETY: diff --git a/library/core/src/num/uint_macros.rs b/library/core/src/num/uint_macros.rs index b8ca299f67ddd..f09fd604dc6a4 100644 --- a/library/core/src/num/uint_macros.rs +++ b/library/core/src/num/uint_macros.rs @@ -1519,11 +1519,11 @@ macro_rules! uint_impl { without modifying the original"] #[inline] pub const fn unbounded_shl(self, rhs: u32) -> $SelfT{ - if rhs < Self::BITS{ + if rhs < Self::BITS { // SAFETY: // rhs is just checked to be in-range above unsafe { self.unchecked_shl(rhs) } - }else{ + } else { 0 } } @@ -1644,11 +1644,11 @@ macro_rules! uint_impl { without modifying the original"] #[inline] pub const fn unbounded_shr(self, rhs: u32) -> $SelfT{ - if rhs < Self::BITS{ + if rhs < Self::BITS { // SAFETY: // rhs is just checked to be in-range above unsafe { self.unchecked_shr(rhs) } - }else{ + } else { 0 } } From 79cbb878c7ca739b5136c9b87402860f017919d2 Mon Sep 17 00:00:00 2001 From: Connor Horman Date: Wed, 21 Aug 2024 21:37:50 +0000 Subject: [PATCH 4/8] chore: `x fmt` and hopefully fix the tidy issue --- library/core/src/num/int_macros.rs | 12 ++++++------ library/core/src/num/uint_macros.rs | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/library/core/src/num/int_macros.rs b/library/core/src/num/int_macros.rs index b48b05577c96c..8c4f6a37fa91e 100644 --- a/library/core/src/num/int_macros.rs +++ b/library/core/src/num/int_macros.rs @@ -1313,12 +1313,12 @@ macro_rules! int_impl { } /// Unbounded shift left. Computes `self << rhs`, without bounding the value of `rhs` - /// - /// If `rhs` is larger or equal to the number of bits in `self`, + /// + /// If `rhs` is larger or equal to the number of bits in `self`, /// the entire value is shifted out, and `0` is returned. /// /// # Examples - /// + /// /// Basic usage: /// ``` #[doc = concat!("assert_eq!(0x1", stringify!($SelfT), ".unbounded_shl(4), 0x10);")] @@ -1438,13 +1438,13 @@ macro_rules! int_impl { } /// Unbounded shift right. Computes `self >> rhs`, without bounding the value of `rhs` - /// - /// If `rhs` is larger or equal to the number of bits in `self`, + /// + /// If `rhs` is larger or equal to the number of bits in `self`, /// the entire value is shifted out, which yields `0` for a positive number, /// and `-1` for a negative number. /// /// # Examples - /// + /// /// Basic usage: /// ``` #[doc = concat!("assert_eq!(0x10", stringify!($SelfT), ".unbounded_shl(4), 0x1);")] diff --git a/library/core/src/num/uint_macros.rs b/library/core/src/num/uint_macros.rs index f09fd604dc6a4..643a76d23e415 100644 --- a/library/core/src/num/uint_macros.rs +++ b/library/core/src/num/uint_macros.rs @@ -1502,12 +1502,12 @@ macro_rules! uint_impl { } /// Unbounded shift left. Computes `self << rhs`, without bounding the value of `rhs` - /// - /// If `rhs` is larger or equal to the number of bits in `self`, + /// + /// If `rhs` is larger or equal to the number of bits in `self`, /// the entire value is shifted out, and `0` is returned. /// /// # Examples - /// + /// /// Basic usage: /// ``` #[doc = concat!("assert_eq!(0x1", stringify!($SelfT), ".unbounded_shl(4), 0x10);")] @@ -1627,12 +1627,12 @@ macro_rules! uint_impl { } /// Unbounded shift right. Computes `self >> rhs`, without bounding the value of `rhs` - /// - /// If `rhs` is larger or equal to the number of bits in `self`, + /// + /// If `rhs` is larger or equal to the number of bits in `self`, /// the entire value is shifted out, and `0` is returned. /// /// # Examples - /// + /// /// Basic usage: /// ``` #[doc = concat!("assert_eq!(0x10", stringify!($SelfT), ".unbounded_shr(4), 0x10);")] From 9907f617ab8c0fc1a36161d5b33cd86780fb9b09 Mon Sep 17 00:00:00 2001 From: Connor Horman Date: Wed, 21 Aug 2024 23:22:07 +0000 Subject: [PATCH 5/8] fix(core): Add `#![feature(unbounded_shifts)]` to doctests for `unbounded_shr`/`unbounded_shl` --- library/core/src/num/int_macros.rs | 4 +++- library/core/src/num/uint_macros.rs | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/library/core/src/num/int_macros.rs b/library/core/src/num/int_macros.rs index 8c4f6a37fa91e..91d70473a6613 100644 --- a/library/core/src/num/int_macros.rs +++ b/library/core/src/num/int_macros.rs @@ -1321,6 +1321,7 @@ macro_rules! int_impl { /// /// Basic usage: /// ``` + /// #![feature(unbounded_shifts)] #[doc = concat!("assert_eq!(0x1", stringify!($SelfT), ".unbounded_shl(4), 0x10);")] #[doc = concat!("assert_eq!(0x1", stringify!($SelfT), ".unbounded_shl(129), 0);")] /// ``` @@ -1447,10 +1448,11 @@ macro_rules! int_impl { /// /// Basic usage: /// ``` + /// #![feature(unbounded_shifts)] #[doc = concat!("assert_eq!(0x10", stringify!($SelfT), ".unbounded_shl(4), 0x1);")] #[doc = concat!("assert_eq!(0x10", stringify!($SelfT), ".unbounded_shr(129), 0);")] #[doc = concat!("assert_eq!(", stringify!($SelfT), "::MIN.unbounded_shr(129), -1);")] - /// ``` + /// ``` #[unstable(feature = "unbounded_shifts", issue = "129375")] #[rustc_allow_const_fn_unstable(unchecked_shifts)] #[must_use = "this returns the result of the operation, \ diff --git a/library/core/src/num/uint_macros.rs b/library/core/src/num/uint_macros.rs index 643a76d23e415..161ee649c841b 100644 --- a/library/core/src/num/uint_macros.rs +++ b/library/core/src/num/uint_macros.rs @@ -1501,7 +1501,7 @@ macro_rules! uint_impl { } } - /// Unbounded shift left. Computes `self << rhs`, without bounding the value of `rhs` + /// Unbounded shift left. Computes `self << rhs`, without bounding the value of `rhs` /// /// If `rhs` is larger or equal to the number of bits in `self`, /// the entire value is shifted out, and `0` is returned. @@ -1510,6 +1510,7 @@ macro_rules! uint_impl { /// /// Basic usage: /// ``` + /// #![feature(unbounded_shifts)] #[doc = concat!("assert_eq!(0x1", stringify!($SelfT), ".unbounded_shl(4), 0x10);")] #[doc = concat!("assert_eq!(0x1", stringify!($SelfT), ".unbounded_shl(129), 0);")] /// ``` @@ -1635,6 +1636,7 @@ macro_rules! uint_impl { /// /// Basic usage: /// ``` + /// #![feature(unbounded_shifts)] #[doc = concat!("assert_eq!(0x10", stringify!($SelfT), ".unbounded_shr(4), 0x10);")] #[doc = concat!("assert_eq!(0x10", stringify!($SelfT), ".unbounded_shr(129), 0);")] /// ``` From 27b63b85ec7f8a767b91dd75bad7ca18399901a6 Mon Sep 17 00:00:00 2001 From: Connor Horman Date: Wed, 21 Aug 2024 23:38:04 +0000 Subject: [PATCH 6/8] chore: `x fmt` --- library/core/src/num/int_macros.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/core/src/num/int_macros.rs b/library/core/src/num/int_macros.rs index 91d70473a6613..c11cae1666f20 100644 --- a/library/core/src/num/int_macros.rs +++ b/library/core/src/num/int_macros.rs @@ -1452,7 +1452,7 @@ macro_rules! int_impl { #[doc = concat!("assert_eq!(0x10", stringify!($SelfT), ".unbounded_shl(4), 0x1);")] #[doc = concat!("assert_eq!(0x10", stringify!($SelfT), ".unbounded_shr(129), 0);")] #[doc = concat!("assert_eq!(", stringify!($SelfT), "::MIN.unbounded_shr(129), -1);")] - /// ``` + /// ``` #[unstable(feature = "unbounded_shifts", issue = "129375")] #[rustc_allow_const_fn_unstable(unchecked_shifts)] #[must_use = "this returns the result of the operation, \ From 2cf48eaebc9aa696aa7e7170e8d340123daddaa4 Mon Sep 17 00:00:00 2001 From: Connor Horman Date: Thu, 22 Aug 2024 00:08:03 +0000 Subject: [PATCH 7/8] fix(core): Use correct operations/values in `unbounded_shr` doctests --- library/core/src/num/int_macros.rs | 2 +- library/core/src/num/uint_macros.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/library/core/src/num/int_macros.rs b/library/core/src/num/int_macros.rs index c11cae1666f20..d3dd68a9d610c 100644 --- a/library/core/src/num/int_macros.rs +++ b/library/core/src/num/int_macros.rs @@ -1449,7 +1449,7 @@ macro_rules! int_impl { /// Basic usage: /// ``` /// #![feature(unbounded_shifts)] - #[doc = concat!("assert_eq!(0x10", stringify!($SelfT), ".unbounded_shl(4), 0x1);")] + #[doc = concat!("assert_eq!(0x10", stringify!($SelfT), ".unbounded_shr(4), 0x1);")] #[doc = concat!("assert_eq!(0x10", stringify!($SelfT), ".unbounded_shr(129), 0);")] #[doc = concat!("assert_eq!(", stringify!($SelfT), "::MIN.unbounded_shr(129), -1);")] /// ``` diff --git a/library/core/src/num/uint_macros.rs b/library/core/src/num/uint_macros.rs index 161ee649c841b..2e4e367af9b90 100644 --- a/library/core/src/num/uint_macros.rs +++ b/library/core/src/num/uint_macros.rs @@ -1637,7 +1637,7 @@ macro_rules! uint_impl { /// Basic usage: /// ``` /// #![feature(unbounded_shifts)] - #[doc = concat!("assert_eq!(0x10", stringify!($SelfT), ".unbounded_shr(4), 0x10);")] + #[doc = concat!("assert_eq!(0x10", stringify!($SelfT), ".unbounded_shr(4), 0x1);")] #[doc = concat!("assert_eq!(0x10", stringify!($SelfT), ".unbounded_shr(129), 0);")] /// ``` #[unstable(feature = "unbounded_shifts", issue = "129375")] From f4dc7830ed64a713ef7d4e3c63032b9002c2040a Mon Sep 17 00:00:00 2001 From: Connor Horman Date: Thu, 22 Aug 2024 10:28:48 +0000 Subject: [PATCH 8/8] feat(core): Make `unbounded_shl{l,r}` unstably const and remove `rustc_allow_const_fn_unstable` --- library/core/src/num/int_macros.rs | 4 ++-- library/core/src/num/uint_macros.rs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/library/core/src/num/int_macros.rs b/library/core/src/num/int_macros.rs index d3dd68a9d610c..229cd89bea3f0 100644 --- a/library/core/src/num/int_macros.rs +++ b/library/core/src/num/int_macros.rs @@ -1326,7 +1326,7 @@ macro_rules! int_impl { #[doc = concat!("assert_eq!(0x1", stringify!($SelfT), ".unbounded_shl(129), 0);")] /// ``` #[unstable(feature = "unbounded_shifts", issue = "129375")] - #[rustc_allow_const_fn_unstable(unchecked_shifts)] + #[rustc_const_unstable(feature = "const_unbounded_shifts", issue = "129375")] #[must_use = "this returns the result of the operation, \ without modifying the original"] #[inline] @@ -1454,7 +1454,7 @@ macro_rules! int_impl { #[doc = concat!("assert_eq!(", stringify!($SelfT), "::MIN.unbounded_shr(129), -1);")] /// ``` #[unstable(feature = "unbounded_shifts", issue = "129375")] - #[rustc_allow_const_fn_unstable(unchecked_shifts)] + #[rustc_const_unstable(feature = "const_unbounded_shifts", issue = "129375")] #[must_use = "this returns the result of the operation, \ without modifying the original"] #[inline] diff --git a/library/core/src/num/uint_macros.rs b/library/core/src/num/uint_macros.rs index 2e4e367af9b90..0d0bbc5256f78 100644 --- a/library/core/src/num/uint_macros.rs +++ b/library/core/src/num/uint_macros.rs @@ -1515,7 +1515,7 @@ macro_rules! uint_impl { #[doc = concat!("assert_eq!(0x1", stringify!($SelfT), ".unbounded_shl(129), 0);")] /// ``` #[unstable(feature = "unbounded_shifts", issue = "129375")] - #[rustc_allow_const_fn_unstable(unchecked_shifts)] + #[rustc_const_unstable(feature = "const_unbounded_shifts", issue = "129375")] #[must_use = "this returns the result of the operation, \ without modifying the original"] #[inline] @@ -1641,7 +1641,7 @@ macro_rules! uint_impl { #[doc = concat!("assert_eq!(0x10", stringify!($SelfT), ".unbounded_shr(129), 0);")] /// ``` #[unstable(feature = "unbounded_shifts", issue = "129375")] - #[rustc_allow_const_fn_unstable(unchecked_shifts)] + #[rustc_const_unstable(feature = "const_unbounded_shifts", issue = "129375")] #[must_use = "this returns the result of the operation, \ without modifying the original"] #[inline]