Skip to content

Commit 47153b5

Browse files
committed
Stabilize unchecked_neg and unchecked_shifts
1 parent a591113 commit 47153b5

File tree

11 files changed

+10
-66
lines changed

11 files changed

+10
-66
lines changed

library/core/src/lib.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,6 @@
126126
#![feature(str_split_inclusive_remainder)]
127127
#![feature(str_split_remainder)]
128128
#![feature(ub_checks)]
129-
#![feature(unchecked_neg)]
130-
#![feature(unchecked_shifts)]
131129
#![feature(unsafe_pinned)]
132130
#![feature(utf16_extra)]
133131
#![feature(variant_count)]

library/core/src/num/int_macros.rs

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1259,11 +1259,8 @@ macro_rules! int_impl {
12591259
/// i.e. when [`checked_neg`] would return `None`.
12601260
///
12611261
#[doc = concat!("[`checked_neg`]: ", stringify!($SelfT), "::checked_neg")]
1262-
#[unstable(
1263-
feature = "unchecked_neg",
1264-
reason = "niche optimization path",
1265-
issue = "85122",
1266-
)]
1262+
#[stable(feature = "unchecked_neg", since = "CURRENT_RUSTC_VERSION")]
1263+
#[rustc_const_stable(feature = "unchecked_neg", since = "CURRENT_RUSTC_VERSION")]
12671264
#[must_use = "this returns the result of the operation, \
12681265
without modifying the original"]
12691266
#[inline(always)]
@@ -1379,11 +1376,8 @@ macro_rules! int_impl {
13791376
/// i.e. when [`checked_shl`] would return `None`.
13801377
///
13811378
#[doc = concat!("[`checked_shl`]: ", stringify!($SelfT), "::checked_shl")]
1382-
#[unstable(
1383-
feature = "unchecked_shifts",
1384-
reason = "niche optimization path",
1385-
issue = "85122",
1386-
)]
1379+
#[stable(feature = "unchecked_shifts", since = "CURRENT_RUSTC_VERSION")]
1380+
#[rustc_const_stable(feature = "unchecked_shifts", since = "CURRENT_RUSTC_VERSION")]
13871381
#[must_use = "this returns the result of the operation, \
13881382
without modifying the original"]
13891383
#[inline(always)]
@@ -1554,11 +1548,8 @@ macro_rules! int_impl {
15541548
/// i.e. when [`checked_shr`] would return `None`.
15551549
///
15561550
#[doc = concat!("[`checked_shr`]: ", stringify!($SelfT), "::checked_shr")]
1557-
#[unstable(
1558-
feature = "unchecked_shifts",
1559-
reason = "niche optimization path",
1560-
issue = "85122",
1561-
)]
1551+
#[stable(feature = "unchecked_shifts", since = "CURRENT_RUSTC_VERSION")]
1552+
#[rustc_const_stable(feature = "unchecked_shifts", since = "CURRENT_RUSTC_VERSION")]
15621553
#[must_use = "this returns the result of the operation, \
15631554
without modifying the original"]
15641555
#[inline(always)]

library/core/src/num/uint_macros.rs

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1781,11 +1781,8 @@ macro_rules! uint_impl {
17811781
/// i.e. when [`checked_shl`] would return `None`.
17821782
///
17831783
#[doc = concat!("[`checked_shl`]: ", stringify!($SelfT), "::checked_shl")]
1784-
#[unstable(
1785-
feature = "unchecked_shifts",
1786-
reason = "niche optimization path",
1787-
issue = "85122",
1788-
)]
1784+
#[stable(feature = "unchecked_shifts", since = "CURRENT_RUSTC_VERSION")]
1785+
#[rustc_const_stable(feature = "unchecked_shifts", since = "CURRENT_RUSTC_VERSION")]
17891786
#[must_use = "this returns the result of the operation, \
17901787
without modifying the original"]
17911788
#[inline(always)]
@@ -1953,11 +1950,8 @@ macro_rules! uint_impl {
19531950
/// i.e. when [`checked_shr`] would return `None`.
19541951
///
19551952
#[doc = concat!("[`checked_shr`]: ", stringify!($SelfT), "::checked_shr")]
1956-
#[unstable(
1957-
feature = "unchecked_shifts",
1958-
reason = "niche optimization path",
1959-
issue = "85122",
1960-
)]
1953+
#[stable(feature = "unchecked_shifts", since = "CURRENT_RUSTC_VERSION")]
1954+
#[rustc_const_stable(feature = "unchecked_shifts", since = "CURRENT_RUSTC_VERSION")]
19611955
#[must_use = "this returns the result of the operation, \
19621956
without modifying the original"]
19631957
#[inline(always)]

src/tools/miri/tests/fail/intrinsics/unchecked_shl.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#![feature(unchecked_shifts)]
2-
31
fn main() {
42
unsafe {
53
let _n = 1i8.unchecked_shl(8);

src/tools/miri/tests/fail/intrinsics/unchecked_shr.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#![feature(unchecked_shifts)]
2-
31
fn main() {
42
unsafe {
53
let _n = 1i64.unchecked_shr(64);

src/tools/rust-analyzer/crates/ide-db/src/generated/lints.rs

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -11840,34 +11840,6 @@ extern "rust-call" fn add_args(args: (u32, u32)) -> u32 {
1184011840

1184111841
fn main() {}
1184211842
```
11843-
"##,
11844-
default_severity: Severity::Allow,
11845-
warn_since: None,
11846-
deny_since: None,
11847-
},
11848-
Lint {
11849-
label: "unchecked_neg",
11850-
description: r##"# `unchecked_neg`
11851-
11852-
The tracking issue for this feature is: [#85122]
11853-
11854-
[#85122]: https://github.com/rust-lang/rust/issues/85122
11855-
11856-
------------------------
11857-
"##,
11858-
default_severity: Severity::Allow,
11859-
warn_since: None,
11860-
deny_since: None,
11861-
},
11862-
Lint {
11863-
label: "unchecked_shifts",
11864-
description: r##"# `unchecked_shifts`
11865-
11866-
The tracking issue for this feature is: [#85122]
11867-
11868-
[#85122]: https://github.com/rust-lang/rust/issues/85122
11869-
11870-
------------------------
1187111843
"##,
1187211844
default_severity: Severity::Allow,
1187311845
warn_since: None,

tests/codegen-llvm/checked_math.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
//@ compile-flags: -Copt-level=3 -Z merge-functions=disabled
22

33
#![crate_type = "lib"]
4-
#![feature(unchecked_shifts)]
54

65
// Because the result of something like `u32::checked_sub` can only be used if it
76
// didn't overflow, make sure that LLVM actually knows that in optimized builds.

tests/codegen-llvm/unchecked_shifts.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
// optimizations so it doesn't need to worry about them adding more flags.
55

66
#![crate_type = "lib"]
7-
#![feature(unchecked_shifts)]
87
#![feature(core_intrinsics)]
98

109
// CHECK-LABEL: @unchecked_shl_unsigned_same

tests/mir-opt/inline/unchecked_shifts.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
22
#![crate_type = "lib"]
3-
#![feature(unchecked_shifts)]
43

54
//@ compile-flags: -Zmir-opt-level=2 -Zinline-mir
65

tests/ui/precondition-checks/unchecked_shl.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
//@ compile-flags: -Copt-level=3 -Cdebug-assertions=no -Zub-checks=yes
33
//@ error-pattern: unsafe precondition(s) violated: u8::unchecked_shl cannot overflow
44

5-
#![feature(unchecked_shifts)]
6-
75
fn main() {
86
unsafe {
97
0u8.unchecked_shl(u8::BITS);

0 commit comments

Comments
 (0)