Rollup merge of #132445 - RalfJung:const-unchecked-shifts, r=tgross35 · qinheping/verify-rust-std@9f63901 (original) (raw)

`@@ -1161,7 +1161,7 @@ macro_rules! int_impl {

`

1161

1161

`)]

`

1162

1162

` #[must_use = "this returns the result of the operation, \

`

1163

1163

` without modifying the original"]

`

1164

``

`-

#[rustc_const_unstable(feature = "unchecked_neg", issue = "85122")]

`

``

1164

`+

#[cfg_attr(bootstrap, rustc_const_unstable(feature = "unchecked_neg", issue = "85122"))]

`

1165

1165

` #[inline(always)]

`

1166

1166

` #[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces

`

1167

1167

`pub const unsafe fn unchecked_neg(self) -> Self {

`

`@@ -1227,8 +1227,7 @@ macro_rules! int_impl {

`

1227

1227

```` /// ```


`1228`

`1228`

` #[stable(feature = "wrapping", since = "1.7.0")]

`

`1229`

`1229`

` #[rustc_const_stable(feature = "const_checked_int_methods", since = "1.47.0")]

`

`1230`

``

`-

// We could always go back to wrapping

`

`1231`

``

`-

#[rustc_allow_const_fn_unstable(unchecked_shifts)]

`

``

`1230`

`+

#[cfg_attr(bootstrap, rustc_allow_const_fn_unstable(unchecked_shifts))]

`

`1232`

`1231`

` #[must_use = "this returns the result of the operation, \

`

`1233`

`1232`

` without modifying the original"]

`

`1234`

`1233`

` #[inline]

`

`@@ -1294,7 +1293,7 @@ macro_rules! int_impl {

`

`1294`

`1293`

`)]

`

`1295`

`1294`

` #[must_use = "this returns the result of the operation, \

`

`1296`

`1295`

` without modifying the original"]

`

`1297`

``

`-

#[rustc_const_unstable(feature = "unchecked_shifts", issue = "85122")]

`

``

`1296`

`+

#[cfg_attr(bootstrap, rustc_const_unstable(feature = "unchecked_shifts", issue = "85122"))]

`

`1298`

`1297`

` #[inline(always)]

`

`1299`

`1298`

` #[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces

`

`1300`

`1299`

`pub const unsafe fn unchecked_shl(self, rhs: u32) -> Self {

`

`@@ -1353,8 +1352,7 @@ macro_rules! int_impl {

`

`1353`

`1352`

```` /// ```

1354

1353

` #[stable(feature = "wrapping", since = "1.7.0")]

`

1355

1354

` #[rustc_const_stable(feature = "const_checked_int_methods", since = "1.47.0")]

`

1356

``

`-

// We could always go back to wrapping

`

1357

``

`-

#[rustc_allow_const_fn_unstable(unchecked_shifts)]

`

``

1355

`+

#[cfg_attr(bootstrap, rustc_allow_const_fn_unstable(unchecked_shifts))]

`

1358

1356

` #[must_use = "this returns the result of the operation, \

`

1359

1357

` without modifying the original"]

`

1360

1358

` #[inline]

`

`@@ -1420,7 +1418,7 @@ macro_rules! int_impl {

`

1420

1418

`)]

`

1421

1419

` #[must_use = "this returns the result of the operation, \

`

1422

1420

` without modifying the original"]

`

1423

``

`-

#[rustc_const_unstable(feature = "unchecked_shifts", issue = "85122")]

`

``

1421

`+

#[cfg_attr(bootstrap, rustc_const_unstable(feature = "unchecked_shifts", issue = "85122"))]

`

1424

1422

` #[inline(always)]

`

1425

1423

` #[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces

`

1426

1424

`pub const unsafe fn unchecked_shr(self, rhs: u32) -> Self {

`

`@@ -2151,7 +2149,7 @@ macro_rules! int_impl {

`

2151

2149

` #[must_use = "this returns the result of the operation, \

`

2152

2150

` without modifying the original"]

`

2153

2151

` #[inline(always)]

`

2154

``

`-

#[rustc_allow_const_fn_unstable(unchecked_shifts)]

`

``

2152

`+

#[cfg_attr(bootstrap, rustc_allow_const_fn_unstable(unchecked_shifts))]

`

2155

2153

`pub const fn wrapping_shl(self, rhs: u32) -> Self {

`

2156

2154

`// SAFETY: the masking by the bitsize of the type ensures that we do not shift

`

2157

2155

`// out of bounds

`

`@@ -2181,7 +2179,7 @@ macro_rules! int_impl {

`

2181

2179

` #[must_use = "this returns the result of the operation, \

`

2182

2180

` without modifying the original"]

`

2183

2181

` #[inline(always)]

`

2184

``

`-

#[rustc_allow_const_fn_unstable(unchecked_shifts)]

`

``

2182

`+

#[cfg_attr(bootstrap, rustc_allow_const_fn_unstable(unchecked_shifts))]

`

2185

2183

`pub const fn wrapping_shr(self, rhs: u32) -> Self {

`

2186

2184

`// SAFETY: the masking by the bitsize of the type ensures that we do not shift

`

2187

2185

`// out of bounds

`