unchecked_shifts, unchecked_neg are safe-to-const-expose-on-stable, so we can get rid of a bunch of attributes
This commit is contained in:
parent
a8e1186e3c
commit
901b340c1f
@ -1161,7 +1161,7 @@ pub const fn checked_neg(self) -> Option<Self> {
|
|||||||
)]
|
)]
|
||||||
#[must_use = "this returns the result of the operation, \
|
#[must_use = "this returns the result of the operation, \
|
||||||
without modifying the original"]
|
without modifying the original"]
|
||||||
#[rustc_const_unstable(feature = "unchecked_neg", issue = "85122")]
|
#[cfg_attr(bootstrap, rustc_const_unstable(feature = "unchecked_neg", issue = "85122"))]
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
#[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces
|
#[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces
|
||||||
pub const unsafe fn unchecked_neg(self) -> Self {
|
pub const unsafe fn unchecked_neg(self) -> Self {
|
||||||
@ -1227,8 +1227,7 @@ pub const fn strict_neg(self) -> Self {
|
|||||||
/// ```
|
/// ```
|
||||||
#[stable(feature = "wrapping", since = "1.7.0")]
|
#[stable(feature = "wrapping", since = "1.7.0")]
|
||||||
#[rustc_const_stable(feature = "const_checked_int_methods", since = "1.47.0")]
|
#[rustc_const_stable(feature = "const_checked_int_methods", since = "1.47.0")]
|
||||||
// We could always go back to wrapping
|
#[cfg_attr(bootstrap, rustc_allow_const_fn_unstable(unchecked_shifts))]
|
||||||
#[rustc_allow_const_fn_unstable(unchecked_shifts)]
|
|
||||||
#[must_use = "this returns the result of the operation, \
|
#[must_use = "this returns the result of the operation, \
|
||||||
without modifying the original"]
|
without modifying the original"]
|
||||||
#[inline]
|
#[inline]
|
||||||
@ -1294,7 +1293,7 @@ pub const fn strict_shl(self, rhs: u32) -> Self {
|
|||||||
)]
|
)]
|
||||||
#[must_use = "this returns the result of the operation, \
|
#[must_use = "this returns the result of the operation, \
|
||||||
without modifying the original"]
|
without modifying the original"]
|
||||||
#[rustc_const_unstable(feature = "unchecked_shifts", issue = "85122")]
|
#[cfg_attr(bootstrap, rustc_const_unstable(feature = "unchecked_shifts", issue = "85122"))]
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
#[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces
|
#[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces
|
||||||
pub const unsafe fn unchecked_shl(self, rhs: u32) -> Self {
|
pub const unsafe fn unchecked_shl(self, rhs: u32) -> Self {
|
||||||
@ -1353,8 +1352,7 @@ pub const fn unbounded_shl(self, rhs: u32) -> $SelfT{
|
|||||||
/// ```
|
/// ```
|
||||||
#[stable(feature = "wrapping", since = "1.7.0")]
|
#[stable(feature = "wrapping", since = "1.7.0")]
|
||||||
#[rustc_const_stable(feature = "const_checked_int_methods", since = "1.47.0")]
|
#[rustc_const_stable(feature = "const_checked_int_methods", since = "1.47.0")]
|
||||||
// We could always go back to wrapping
|
#[cfg_attr(bootstrap, rustc_allow_const_fn_unstable(unchecked_shifts))]
|
||||||
#[rustc_allow_const_fn_unstable(unchecked_shifts)]
|
|
||||||
#[must_use = "this returns the result of the operation, \
|
#[must_use = "this returns the result of the operation, \
|
||||||
without modifying the original"]
|
without modifying the original"]
|
||||||
#[inline]
|
#[inline]
|
||||||
@ -1420,7 +1418,7 @@ pub const fn strict_shr(self, rhs: u32) -> Self {
|
|||||||
)]
|
)]
|
||||||
#[must_use = "this returns the result of the operation, \
|
#[must_use = "this returns the result of the operation, \
|
||||||
without modifying the original"]
|
without modifying the original"]
|
||||||
#[rustc_const_unstable(feature = "unchecked_shifts", issue = "85122")]
|
#[cfg_attr(bootstrap, rustc_const_unstable(feature = "unchecked_shifts", issue = "85122"))]
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
#[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces
|
#[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces
|
||||||
pub const unsafe fn unchecked_shr(self, rhs: u32) -> Self {
|
pub const unsafe fn unchecked_shr(self, rhs: u32) -> Self {
|
||||||
@ -2151,7 +2149,7 @@ pub const fn wrapping_neg(self) -> Self {
|
|||||||
#[must_use = "this returns the result of the operation, \
|
#[must_use = "this returns the result of the operation, \
|
||||||
without modifying the original"]
|
without modifying the original"]
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
#[rustc_allow_const_fn_unstable(unchecked_shifts)]
|
#[cfg_attr(bootstrap, rustc_allow_const_fn_unstable(unchecked_shifts))]
|
||||||
pub const fn wrapping_shl(self, rhs: u32) -> Self {
|
pub const fn wrapping_shl(self, rhs: u32) -> Self {
|
||||||
// SAFETY: the masking by the bitsize of the type ensures that we do not shift
|
// SAFETY: the masking by the bitsize of the type ensures that we do not shift
|
||||||
// out of bounds
|
// out of bounds
|
||||||
@ -2181,7 +2179,7 @@ pub const fn wrapping_shl(self, rhs: u32) -> Self {
|
|||||||
#[must_use = "this returns the result of the operation, \
|
#[must_use = "this returns the result of the operation, \
|
||||||
without modifying the original"]
|
without modifying the original"]
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
#[rustc_allow_const_fn_unstable(unchecked_shifts)]
|
#[cfg_attr(bootstrap, rustc_allow_const_fn_unstable(unchecked_shifts))]
|
||||||
pub const fn wrapping_shr(self, rhs: u32) -> Self {
|
pub const fn wrapping_shr(self, rhs: u32) -> Self {
|
||||||
// SAFETY: the masking by the bitsize of the type ensures that we do not shift
|
// SAFETY: the masking by the bitsize of the type ensures that we do not shift
|
||||||
// out of bounds
|
// out of bounds
|
||||||
|
@ -1416,8 +1416,7 @@ pub const fn strict_neg(self) -> Self {
|
|||||||
/// ```
|
/// ```
|
||||||
#[stable(feature = "wrapping", since = "1.7.0")]
|
#[stable(feature = "wrapping", since = "1.7.0")]
|
||||||
#[rustc_const_stable(feature = "const_checked_int_methods", since = "1.47.0")]
|
#[rustc_const_stable(feature = "const_checked_int_methods", since = "1.47.0")]
|
||||||
// We could always go back to wrapping
|
#[cfg_attr(bootstrap, rustc_allow_const_fn_unstable(unchecked_shifts))]
|
||||||
#[rustc_allow_const_fn_unstable(unchecked_shifts)]
|
|
||||||
#[must_use = "this returns the result of the operation, \
|
#[must_use = "this returns the result of the operation, \
|
||||||
without modifying the original"]
|
without modifying the original"]
|
||||||
#[inline]
|
#[inline]
|
||||||
@ -1483,7 +1482,7 @@ pub const fn strict_shl(self, rhs: u32) -> Self {
|
|||||||
)]
|
)]
|
||||||
#[must_use = "this returns the result of the operation, \
|
#[must_use = "this returns the result of the operation, \
|
||||||
without modifying the original"]
|
without modifying the original"]
|
||||||
#[rustc_const_unstable(feature = "unchecked_shifts", issue = "85122")]
|
#[cfg_attr(bootstrap, rustc_const_unstable(feature = "unchecked_shifts", issue = "85122"))]
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
#[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces
|
#[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces
|
||||||
pub const unsafe fn unchecked_shl(self, rhs: u32) -> Self {
|
pub const unsafe fn unchecked_shl(self, rhs: u32) -> Self {
|
||||||
@ -1542,8 +1541,7 @@ pub const fn unbounded_shl(self, rhs: u32) -> $SelfT{
|
|||||||
/// ```
|
/// ```
|
||||||
#[stable(feature = "wrapping", since = "1.7.0")]
|
#[stable(feature = "wrapping", since = "1.7.0")]
|
||||||
#[rustc_const_stable(feature = "const_checked_int_methods", since = "1.47.0")]
|
#[rustc_const_stable(feature = "const_checked_int_methods", since = "1.47.0")]
|
||||||
// We could always go back to wrapping
|
#[cfg_attr(bootstrap, rustc_allow_const_fn_unstable(unchecked_shifts))]
|
||||||
#[rustc_allow_const_fn_unstable(unchecked_shifts)]
|
|
||||||
#[must_use = "this returns the result of the operation, \
|
#[must_use = "this returns the result of the operation, \
|
||||||
without modifying the original"]
|
without modifying the original"]
|
||||||
#[inline]
|
#[inline]
|
||||||
@ -1609,7 +1607,7 @@ pub const fn strict_shr(self, rhs: u32) -> Self {
|
|||||||
)]
|
)]
|
||||||
#[must_use = "this returns the result of the operation, \
|
#[must_use = "this returns the result of the operation, \
|
||||||
without modifying the original"]
|
without modifying the original"]
|
||||||
#[rustc_const_unstable(feature = "unchecked_shifts", issue = "85122")]
|
#[cfg_attr(bootstrap, rustc_const_unstable(feature = "unchecked_shifts", issue = "85122"))]
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
#[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces
|
#[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces
|
||||||
pub const unsafe fn unchecked_shr(self, rhs: u32) -> Self {
|
pub const unsafe fn unchecked_shr(self, rhs: u32) -> Self {
|
||||||
@ -2132,7 +2130,7 @@ pub const fn wrapping_neg(self) -> Self {
|
|||||||
#[must_use = "this returns the result of the operation, \
|
#[must_use = "this returns the result of the operation, \
|
||||||
without modifying the original"]
|
without modifying the original"]
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
#[rustc_allow_const_fn_unstable(unchecked_shifts)]
|
#[cfg_attr(bootstrap, rustc_allow_const_fn_unstable(unchecked_shifts))]
|
||||||
pub const fn wrapping_shl(self, rhs: u32) -> Self {
|
pub const fn wrapping_shl(self, rhs: u32) -> Self {
|
||||||
// SAFETY: the masking by the bitsize of the type ensures that we do not shift
|
// SAFETY: the masking by the bitsize of the type ensures that we do not shift
|
||||||
// out of bounds
|
// out of bounds
|
||||||
@ -2165,7 +2163,7 @@ pub const fn wrapping_shl(self, rhs: u32) -> Self {
|
|||||||
#[must_use = "this returns the result of the operation, \
|
#[must_use = "this returns the result of the operation, \
|
||||||
without modifying the original"]
|
without modifying the original"]
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
#[rustc_allow_const_fn_unstable(unchecked_shifts)]
|
#[cfg_attr(bootstrap, rustc_allow_const_fn_unstable(unchecked_shifts))]
|
||||||
pub const fn wrapping_shr(self, rhs: u32) -> Self {
|
pub const fn wrapping_shr(self, rhs: u32) -> Self {
|
||||||
// SAFETY: the masking by the bitsize of the type ensures that we do not shift
|
// SAFETY: the masking by the bitsize of the type ensures that we do not shift
|
||||||
// out of bounds
|
// out of bounds
|
||||||
|
@ -1005,7 +1005,7 @@ const fn comptime(_: *const (), _: usize, _: usize) -> bool {
|
|||||||
#[stable(feature = "pointer_methods", since = "1.26.0")]
|
#[stable(feature = "pointer_methods", since = "1.26.0")]
|
||||||
#[must_use = "returns a new pointer rather than modifying its argument"]
|
#[must_use = "returns a new pointer rather than modifying its argument"]
|
||||||
#[rustc_const_stable(feature = "const_ptr_offset", since = "1.61.0")]
|
#[rustc_const_stable(feature = "const_ptr_offset", since = "1.61.0")]
|
||||||
#[rustc_allow_const_fn_unstable(unchecked_neg)]
|
#[cfg_attr(bootstrap, rustc_allow_const_fn_unstable(unchecked_neg))]
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
#[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces
|
#[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces
|
||||||
pub const unsafe fn sub(self, count: usize) -> Self
|
pub const unsafe fn sub(self, count: usize) -> Self
|
||||||
|
@ -1085,7 +1085,7 @@ const fn comptime(_: *const (), _: usize, _: usize) -> bool {
|
|||||||
#[stable(feature = "pointer_methods", since = "1.26.0")]
|
#[stable(feature = "pointer_methods", since = "1.26.0")]
|
||||||
#[must_use = "returns a new pointer rather than modifying its argument"]
|
#[must_use = "returns a new pointer rather than modifying its argument"]
|
||||||
#[rustc_const_stable(feature = "const_ptr_offset", since = "1.61.0")]
|
#[rustc_const_stable(feature = "const_ptr_offset", since = "1.61.0")]
|
||||||
#[rustc_allow_const_fn_unstable(unchecked_neg)]
|
#[cfg_attr(bootstrap, rustc_allow_const_fn_unstable(unchecked_neg))]
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
#[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces
|
#[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces
|
||||||
pub const unsafe fn sub(self, count: usize) -> Self
|
pub const unsafe fn sub(self, count: usize) -> Self
|
||||||
|
@ -635,7 +635,7 @@ pub const fn cast<U>(self) -> NonNull<U> {
|
|||||||
#[must_use = "returns a new pointer rather than modifying its argument"]
|
#[must_use = "returns a new pointer rather than modifying its argument"]
|
||||||
#[stable(feature = "non_null_convenience", since = "1.80.0")]
|
#[stable(feature = "non_null_convenience", since = "1.80.0")]
|
||||||
#[rustc_const_stable(feature = "non_null_convenience", since = "1.80.0")]
|
#[rustc_const_stable(feature = "non_null_convenience", since = "1.80.0")]
|
||||||
#[rustc_allow_const_fn_unstable(unchecked_neg)]
|
#[cfg_attr(bootstrap, rustc_allow_const_fn_unstable(unchecked_neg))]
|
||||||
pub const unsafe fn sub(self, count: usize) -> Self
|
pub const unsafe fn sub(self, count: usize) -> Self
|
||||||
where
|
where
|
||||||
T: Sized,
|
T: Sized,
|
||||||
|
Loading…
Reference in New Issue
Block a user