Stabilize unchecked_neg and unchecked_shifts

This commit is contained in:
nxsaken
2025-11-19 13:19:22 +04:00
parent a591113c0a
commit 47153b5276
11 changed files with 10 additions and 66 deletions
-2
View File
@@ -126,8 +126,6 @@
#![feature(str_split_inclusive_remainder)]
#![feature(str_split_remainder)]
#![feature(ub_checks)]
#![feature(unchecked_neg)]
#![feature(unchecked_shifts)]
#![feature(unsafe_pinned)]
#![feature(utf16_extra)]
#![feature(variant_count)]
+6 -15
View File
@@ -1259,11 +1259,8 @@ pub const fn checked_neg(self) -> Option<Self> {
/// i.e. when [`checked_neg`] would return `None`.
///
#[doc = concat!("[`checked_neg`]: ", stringify!($SelfT), "::checked_neg")]
#[unstable(
feature = "unchecked_neg",
reason = "niche optimization path",
issue = "85122",
)]
#[stable(feature = "unchecked_neg", since = "CURRENT_RUSTC_VERSION")]
#[rustc_const_stable(feature = "unchecked_neg", since = "CURRENT_RUSTC_VERSION")]
#[must_use = "this returns the result of the operation, \
without modifying the original"]
#[inline(always)]
@@ -1379,11 +1376,8 @@ pub const fn strict_shl(self, rhs: u32) -> Self {
/// i.e. when [`checked_shl`] would return `None`.
///
#[doc = concat!("[`checked_shl`]: ", stringify!($SelfT), "::checked_shl")]
#[unstable(
feature = "unchecked_shifts",
reason = "niche optimization path",
issue = "85122",
)]
#[stable(feature = "unchecked_shifts", since = "CURRENT_RUSTC_VERSION")]
#[rustc_const_stable(feature = "unchecked_shifts", since = "CURRENT_RUSTC_VERSION")]
#[must_use = "this returns the result of the operation, \
without modifying the original"]
#[inline(always)]
@@ -1554,11 +1548,8 @@ pub const fn strict_shr(self, rhs: u32) -> Self {
/// i.e. when [`checked_shr`] would return `None`.
///
#[doc = concat!("[`checked_shr`]: ", stringify!($SelfT), "::checked_shr")]
#[unstable(
feature = "unchecked_shifts",
reason = "niche optimization path",
issue = "85122",
)]
#[stable(feature = "unchecked_shifts", since = "CURRENT_RUSTC_VERSION")]
#[rustc_const_stable(feature = "unchecked_shifts", since = "CURRENT_RUSTC_VERSION")]
#[must_use = "this returns the result of the operation, \
without modifying the original"]
#[inline(always)]
+4 -10
View File
@@ -1781,11 +1781,8 @@ pub const fn strict_shl(self, rhs: u32) -> Self {
/// i.e. when [`checked_shl`] would return `None`.
///
#[doc = concat!("[`checked_shl`]: ", stringify!($SelfT), "::checked_shl")]
#[unstable(
feature = "unchecked_shifts",
reason = "niche optimization path",
issue = "85122",
)]
#[stable(feature = "unchecked_shifts", since = "CURRENT_RUSTC_VERSION")]
#[rustc_const_stable(feature = "unchecked_shifts", since = "CURRENT_RUSTC_VERSION")]
#[must_use = "this returns the result of the operation, \
without modifying the original"]
#[inline(always)]
@@ -1953,11 +1950,8 @@ pub const fn strict_shr(self, rhs: u32) -> Self {
/// i.e. when [`checked_shr`] would return `None`.
///
#[doc = concat!("[`checked_shr`]: ", stringify!($SelfT), "::checked_shr")]
#[unstable(
feature = "unchecked_shifts",
reason = "niche optimization path",
issue = "85122",
)]
#[stable(feature = "unchecked_shifts", since = "CURRENT_RUSTC_VERSION")]
#[rustc_const_stable(feature = "unchecked_shifts", since = "CURRENT_RUSTC_VERSION")]
#[must_use = "this returns the result of the operation, \
without modifying the original"]
#[inline(always)]
@@ -1,5 +1,3 @@
#![feature(unchecked_shifts)]
fn main() {
unsafe {
let _n = 1i8.unchecked_shl(8);
@@ -1,5 +1,3 @@
#![feature(unchecked_shifts)]
fn main() {
unsafe {
let _n = 1i64.unchecked_shr(64);
@@ -11840,34 +11840,6 @@ extern "rust-call" fn add_args(args: (u32, u32)) -> u32 {
fn main() {}
```
"##,
default_severity: Severity::Allow,
warn_since: None,
deny_since: None,
},
Lint {
label: "unchecked_neg",
description: r##"# `unchecked_neg`
The tracking issue for this feature is: [#85122]
[#85122]: https://github.com/rust-lang/rust/issues/85122
------------------------
"##,
default_severity: Severity::Allow,
warn_since: None,
deny_since: None,
},
Lint {
label: "unchecked_shifts",
description: r##"# `unchecked_shifts`
The tracking issue for this feature is: [#85122]
[#85122]: https://github.com/rust-lang/rust/issues/85122
------------------------
"##,
default_severity: Severity::Allow,
warn_since: None,
-1
View File
@@ -1,7 +1,6 @@
//@ compile-flags: -Copt-level=3 -Z merge-functions=disabled
#![crate_type = "lib"]
#![feature(unchecked_shifts)]
// Because the result of something like `u32::checked_sub` can only be used if it
// didn't overflow, make sure that LLVM actually knows that in optimized builds.
-1
View File
@@ -4,7 +4,6 @@
// optimizations so it doesn't need to worry about them adding more flags.
#![crate_type = "lib"]
#![feature(unchecked_shifts)]
#![feature(core_intrinsics)]
// CHECK-LABEL: @unchecked_shl_unsigned_same
-1
View File
@@ -1,6 +1,5 @@
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
#![crate_type = "lib"]
#![feature(unchecked_shifts)]
//@ compile-flags: -Zmir-opt-level=2 -Zinline-mir
@@ -2,8 +2,6 @@
//@ compile-flags: -Copt-level=3 -Cdebug-assertions=no -Zub-checks=yes
//@ error-pattern: unsafe precondition(s) violated: u8::unchecked_shl cannot overflow
#![feature(unchecked_shifts)]
fn main() {
unsafe {
0u8.unchecked_shl(u8::BITS);
@@ -2,8 +2,6 @@
//@ compile-flags: -Copt-level=3 -Cdebug-assertions=no -Zub-checks=yes
//@ error-pattern: unsafe precondition(s) violated: u8::unchecked_shr cannot overflow
#![feature(unchecked_shifts)]
fn main() {
unsafe {
0u8.unchecked_shr(u8::BITS);