Rollup merge of #149087 - nxsaken:unchecked_neg_shifts_stabilize, r=Amanieu
Stabilize `unchecked_neg` and `unchecked_shifts` Features: `unchecked_neg`, `unchecked_shifts` Tracking issue: rust-lang/rust#85122 r? `@Amanieu`
This commit is contained in:
commit
549c577c2a
11 changed files with 10 additions and 66 deletions
|
|
@ -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)]
|
||||
|
|
|
|||
|
|
@ -1275,11 +1275,8 @@ macro_rules! int_impl {
|
|||
/// 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)]
|
||||
|
|
@ -1395,11 +1392,8 @@ macro_rules! int_impl {
|
|||
/// 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)]
|
||||
|
|
@ -1570,11 +1564,8 @@ macro_rules! int_impl {
|
|||
/// 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)]
|
||||
|
|
|
|||
|
|
@ -1851,11 +1851,8 @@ macro_rules! uint_impl {
|
|||
/// 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)]
|
||||
|
|
@ -2023,11 +2020,8 @@ macro_rules! uint_impl {
|
|||
/// 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,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.
|
||||
|
|
|
|||
|
|
@ -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,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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue