Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 1e4a9ee

Browse files
authoredNov 16, 2024
Rollup merge of rust-lang#132449 - RalfJung:is_val_statically_known, r=compiler-errors
mark is_val_statically_known intrinsic as stably const-callable The intrinsic doesn't actually "do" anything in terms of language semantics, and we are already using it in stable const fn. So let's just properly mark it as stably const-callable to avoid needing `rustc_allow_const_fn_unstable` (and thus reducing noise and keeping the remaining `rustc_allow_const_fn_unstable` as a more clear signal). Cc `@rust-lang/lang` usually you have to approve exposing intrinsics in const, but this intrinsic is basically just a compiler implementation detail. So FCP doesn't seem necessary. Cc `@rust-lang/wg-const-eval`
2 parents 1dfe94c + 086cfef commit 1e4a9ee

File tree

4 files changed

+5
-9
lines changed

4 files changed

+5
-9
lines changed
 

‎core/src/intrinsics/mod.rs

+5-4
Original file line numberDiff line numberDiff line change
@@ -3535,7 +3535,6 @@ pub(crate) macro const_eval_select {
35353535
/// In other words, the following code has *Undefined Behavior*:
35363536
///
35373537
/// ```no_run
3538-
/// #![feature(is_val_statically_known)]
35393538
/// #![feature(core_intrinsics)]
35403539
/// # #![allow(internal_features)]
35413540
/// use std::hint::unreachable_unchecked;
@@ -3548,7 +3547,6 @@ pub(crate) macro const_eval_select {
35483547
/// may panic, or it may not:
35493548
///
35503549
/// ```no_run
3551-
/// #![feature(is_val_statically_known)]
35523550
/// #![feature(core_intrinsics)]
35533551
/// # #![allow(internal_features)]
35543552
/// use std::intrinsics::is_val_statically_known;
@@ -3581,7 +3579,6 @@ pub(crate) macro const_eval_select {
35813579
/// behave identically:
35823580
///
35833581
/// ```
3584-
/// #![feature(is_val_statically_known)]
35853582
/// #![feature(core_intrinsics)]
35863583
/// # #![allow(internal_features)]
35873584
/// use std::intrinsics::is_val_statically_known;
@@ -3598,7 +3595,11 @@ pub(crate) macro const_eval_select {
35983595
/// # _ = foo(&5_i32);
35993596
/// # _ = bar(&5_i32);
36003597
/// ```
3601-
#[rustc_const_unstable(feature = "is_val_statically_known", issue = "none")]
3598+
#[cfg_attr(
3599+
bootstrap,
3600+
rustc_const_stable(feature = "const_is_val_statically_known", since = "CURRENT_RUSTC_VERSION")
3601+
)]
3602+
#[cfg_attr(not(bootstrap), rustc_const_stable_indirect)]
36023603
#[rustc_nounwind]
36033604
#[unstable(feature = "core_intrinsics", issue = "none")]
36043605
#[rustc_intrinsic]

‎core/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,6 @@
139139
#![feature(internal_impls_macro)]
140140
#![feature(ip)]
141141
#![feature(is_ascii_octdigit)]
142-
#![feature(is_val_statically_known)]
143142
#![feature(lazy_get)]
144143
#![feature(link_cfg)]
145144
#![feature(non_null_from_ref)]

‎core/src/num/int_macros.rs

-2
Original file line numberDiff line numberDiff line change
@@ -2242,7 +2242,6 @@ macro_rules! int_impl {
22422242
#[must_use = "this returns the result of the operation, \
22432243
without modifying the original"]
22442244
#[inline]
2245-
#[rustc_allow_const_fn_unstable(is_val_statically_known)]
22462245
pub const fn wrapping_pow(self, mut exp: u32) -> Self {
22472246
if exp == 0 {
22482247
return 1;
@@ -2808,7 +2807,6 @@ macro_rules! int_impl {
28082807
without modifying the original"]
28092808
#[inline]
28102809
#[rustc_inherit_overflow_checks]
2811-
#[rustc_allow_const_fn_unstable(is_val_statically_known)]
28122810
pub const fn pow(self, mut exp: u32) -> Self {
28132811
if exp == 0 {
28142812
return 1;

‎core/src/num/uint_macros.rs

-2
Original file line numberDiff line numberDiff line change
@@ -2251,7 +2251,6 @@ macro_rules! uint_impl {
22512251
#[must_use = "this returns the result of the operation, \
22522252
without modifying the original"]
22532253
#[inline]
2254-
#[rustc_allow_const_fn_unstable(is_val_statically_known)]
22552254
pub const fn wrapping_pow(self, mut exp: u32) -> Self {
22562255
if exp == 0 {
22572256
return 1;
@@ -2791,7 +2790,6 @@ macro_rules! uint_impl {
27912790
without modifying the original"]
27922791
#[inline]
27932792
#[rustc_inherit_overflow_checks]
2794-
#[rustc_allow_const_fn_unstable(is_val_statically_known)]
27952793
pub const fn pow(self, mut exp: u32) -> Self {
27962794
if exp == 0 {
27972795
return 1;

0 commit comments

Comments
 (0)
Failed to load comments.