From 1ba2fa4b637d3611f8c6978ae0955148b5746761 Mon Sep 17 00:00:00 2001 From: Trevor Gross Date: Sun, 7 Apr 2024 04:30:49 -0400 Subject: [PATCH] Stabilize `hint_assert_unchecked` Make both `hint_assert_unchecked` and `const_hint_assert_unchecked` stable as `hint_assert_unchecked`. --- alloc/src/lib.rs | 1 - core/src/hint.rs | 8 +++----- core/src/intrinsics.rs | 2 +- core/src/lib.rs | 1 - std/src/lib.rs | 1 - 5 files changed, 4 insertions(+), 9 deletions(-) diff --git a/alloc/src/lib.rs b/alloc/src/lib.rs index 895d1b8d59f2c..095e13ee98c98 100644 --- a/alloc/src/lib.rs +++ b/alloc/src/lib.rs @@ -126,7 +126,6 @@ #![feature(fmt_internals)] #![feature(fn_traits)] #![feature(hasher_prefixfree_extras)] -#![feature(hint_assert_unchecked)] #![feature(inplace_iteration)] #![feature(iter_advance_by)] #![feature(iter_next_chunk)] diff --git a/core/src/hint.rs b/core/src/hint.rs index b8db4ad8237bd..e637baf826ff2 100644 --- a/core/src/hint.rs +++ b/core/src/hint.rs @@ -146,8 +146,6 @@ pub const unsafe fn unreachable_unchecked() -> ! { /// # Example /// /// ``` -/// #![feature(hint_assert_unchecked)] -/// /// use core::hint; /// /// /// # Safety @@ -194,11 +192,11 @@ pub const unsafe fn unreachable_unchecked() -> ! { /// to put an an assertion right next to code that checks the same thing, and dereferencing a /// pointer already has the builtin assumption that it is nonnull. However, it illustrates the /// kind of changes the optimizer can make even when the behavior is less obviously related. +#[track_caller] #[inline(always)] #[doc(alias = "assume")] -#[track_caller] -#[unstable(feature = "hint_assert_unchecked", issue = "119131")] -#[rustc_const_unstable(feature = "const_hint_assert_unchecked", issue = "119131")] +#[stable(feature = "hint_assert_unchecked", since = "CURRENT_RUSTC_VERSION")] +#[rustc_const_stable(feature = "hint_assert_unchecked", since = "CURRENT_RUSTC_VERSION")] pub const unsafe fn assert_unchecked(cond: bool) { // SAFETY: The caller promised `cond` is true. unsafe { diff --git a/core/src/intrinsics.rs b/core/src/intrinsics.rs index 6b5054a9f0612..598b7ac0f82c4 100644 --- a/core/src/intrinsics.rs +++ b/core/src/intrinsics.rs @@ -959,7 +959,7 @@ extern "rust-intrinsic" { /// not be used if the invariant can be discovered by the optimizer on its /// own, or if it does not enable any significant optimizations. /// -/// This intrinsic does not have a stable counterpart. +/// The stabilized version of this intrinsic is [`core::hint::assert_unchecked`]. #[rustc_const_stable(feature = "const_assume", since = "1.77.0")] #[rustc_nounwind] #[unstable(feature = "core_intrinsics", issue = "none")] diff --git a/core/src/lib.rs b/core/src/lib.rs index ef28bc99c4fc8..abd8e1d1d0b2e 100644 --- a/core/src/lib.rs +++ b/core/src/lib.rs @@ -130,7 +130,6 @@ #![feature(const_fmt_arguments_new)] #![feature(const_hash)] #![feature(const_heap)] -#![feature(const_hint_assert_unchecked)] #![feature(const_index_range_slice_index)] #![feature(const_int_from_str)] #![feature(const_intrinsic_copy)] diff --git a/std/src/lib.rs b/std/src/lib.rs index 1c226f9f08f10..1fcfbdcd12dfb 100644 --- a/std/src/lib.rs +++ b/std/src/lib.rs @@ -335,7 +335,6 @@ #![feature(fmt_internals)] #![feature(hasher_prefixfree_extras)] #![feature(hashmap_internals)] -#![feature(hint_assert_unchecked)] #![feature(ip)] #![feature(maybe_uninit_slice)] #![feature(maybe_uninit_uninit_array)]