Skip to content

Commit

Permalink
mark is_val_statically_known intrinsic as stably const-callable
Browse files Browse the repository at this point in the history
  • Loading branch information
RalfJung committed Nov 1, 2024
1 parent a8e1186 commit 5cb9be1
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 10 deletions.
9 changes: 5 additions & 4 deletions library/core/src/intrinsics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2802,7 +2802,6 @@ where
/// In other words, the following code has *Undefined Behavior*:
///
/// ```no_run
/// #![feature(is_val_statically_known)]
/// #![feature(core_intrinsics)]
/// # #![allow(internal_features)]
/// use std::hint::unreachable_unchecked;
Expand All @@ -2815,7 +2814,6 @@ where
/// may panic, or it may not:
///
/// ```no_run
/// #![feature(is_val_statically_known)]
/// #![feature(core_intrinsics)]
/// # #![allow(internal_features)]
/// use std::intrinsics::is_val_statically_known;
Expand Down Expand Up @@ -2848,7 +2846,6 @@ where
/// behave identically:
///
/// ```
/// #![feature(is_val_statically_known)]
/// #![feature(core_intrinsics)]
/// # #![allow(internal_features)]
/// use std::intrinsics::is_val_statically_known;
Expand All @@ -2865,7 +2862,11 @@ where
/// # _ = foo(&5_i32);
/// # _ = bar(&5_i32);
/// ```
#[rustc_const_unstable(feature = "is_val_statically_known", issue = "none")]
#[cfg_attr(
bootstrap,
rustc_const_stable(feature = "const_is_val_statically_known", since = "CURRENT_RUSTC_VERSION")
)]
#[cfg_attr(not(bootstrap), rustc_const_stable_indirect)]
#[rustc_nounwind]
#[unstable(feature = "core_intrinsics", issue = "none")]
#[rustc_intrinsic]
Expand Down
1 change: 0 additions & 1 deletion library/core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,6 @@
#![feature(internal_impls_macro)]
#![feature(ip)]
#![feature(is_ascii_octdigit)]
#![feature(is_val_statically_known)]
#![feature(lazy_get)]
#![feature(link_cfg)]
#![feature(non_null_from_ref)]
Expand Down
2 changes: 0 additions & 2 deletions library/core/src/num/int_macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2260,7 +2260,6 @@ macro_rules! int_impl {
#[must_use = "this returns the result of the operation, \
without modifying the original"]
#[inline]
#[rustc_allow_const_fn_unstable(is_val_statically_known)]
pub const fn wrapping_pow(self, mut exp: u32) -> Self {
if exp == 0 {
return 1;
Expand Down Expand Up @@ -2828,7 +2827,6 @@ macro_rules! int_impl {
without modifying the original"]
#[inline]
#[rustc_inherit_overflow_checks]
#[rustc_allow_const_fn_unstable(is_val_statically_known)]
pub const fn pow(self, mut exp: u32) -> Self {
if exp == 0 {
return 1;
Expand Down
2 changes: 0 additions & 2 deletions library/core/src/num/uint_macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2190,7 +2190,6 @@ macro_rules! uint_impl {
#[must_use = "this returns the result of the operation, \
without modifying the original"]
#[inline]
#[rustc_allow_const_fn_unstable(is_val_statically_known)]
pub const fn wrapping_pow(self, mut exp: u32) -> Self {
if exp == 0 {
return 1;
Expand Down Expand Up @@ -2706,7 +2705,6 @@ macro_rules! uint_impl {
without modifying the original"]
#[inline]
#[rustc_inherit_overflow_checks]
#[rustc_allow_const_fn_unstable(is_val_statically_known)]
pub const fn pow(self, mut exp: u32) -> Self {
if exp == 0 {
return 1;
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/consts/is_val_statically_known.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//@ run-pass

#![feature(core_intrinsics, is_val_statically_known)]
#![feature(core_intrinsics)]

use std::intrinsics::is_val_statically_known;

Expand Down

0 comments on commit 5cb9be1

Please sign in to comment.