Skip to content

Commit 6739555

Browse files
committed
Auto merge of #132458 - RalfJung:rustc-const-unstable, r=Amanieu
get rid of a whole bunch of unnecessary rustc_const_unstable attributes In general, when a `const fn` is still unstable, it doesn't need a `#[rustc_const_unstable]` attribute. The only exception is functions that internally use things that can't be used in stable const fn yet. So this gets rid of a whole bunch of `#[rustc_const_unstable]` in libcore.
2 parents 8ccb78e + 66351a6 commit 6739555

22 files changed

+0
-106
lines changed

library/core/src/array/iter.rs

-2
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,6 @@ impl<T, const N: usize> IntoIter<T, N> {
136136
/// assert_eq!(r.collect::<Vec<_>>(), vec![10, 11, 12, 13, 14, 15]);
137137
/// ```
138138
#[unstable(feature = "array_into_iter_constructors", issue = "91583")]
139-
#[rustc_const_unstable(feature = "const_array_into_iter_constructors", issue = "91583")]
140139
pub const unsafe fn new_unchecked(
141140
buffer: [MaybeUninit<T>; N],
142141
initialized: Range<usize>,
@@ -199,7 +198,6 @@ impl<T, const N: usize> IntoIter<T, N> {
199198
/// assert_eq!(get_bytes(false).collect::<Vec<_>>(), vec![]);
200199
/// ```
201200
#[unstable(feature = "array_into_iter_constructors", issue = "91583")]
202-
#[rustc_const_unstable(feature = "const_array_into_iter_constructors", issue = "91583")]
203201
pub const fn empty() -> Self {
204202
let buffer = [const { MaybeUninit::uninit() }; N];
205203
let initialized = 0..0;

library/core/src/char/methods.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1515,7 +1515,6 @@ impl char {
15151515
/// ```
15161516
#[must_use]
15171517
#[unstable(feature = "is_ascii_octdigit", issue = "101288")]
1518-
#[rustc_const_unstable(feature = "is_ascii_octdigit", issue = "101288")]
15191518
#[inline]
15201519
pub const fn is_ascii_octdigit(&self) -> bool {
15211520
matches!(*self, '0'..='7')

library/core/src/lib.rs

-5
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,6 @@
115115
#![feature(const_align_offset)]
116116
#![feature(const_alloc_layout)]
117117
#![feature(const_arguments_as_str)]
118-
#![feature(const_array_into_iter_constructors)]
119-
#![feature(const_bigint_helper_methods)]
120118
#![feature(const_black_box)]
121119
#![feature(const_char_encode_utf16)]
122120
#![feature(const_eval_select)]
@@ -125,7 +123,6 @@
125123
#![feature(const_hash)]
126124
#![feature(const_heap)]
127125
#![feature(const_nonnull_new)]
128-
#![feature(const_num_midpoint)]
129126
#![feature(const_option_ext)]
130127
#![feature(const_pin_2)]
131128
#![feature(const_pointer_is_aligned)]
@@ -135,7 +132,6 @@
135132
#![feature(const_size_of_val)]
136133
#![feature(const_size_of_val_raw)]
137134
#![feature(const_sockaddr_setters)]
138-
#![feature(const_strict_overflow_ops)]
139135
#![feature(const_swap)]
140136
#![feature(const_try)]
141137
#![feature(const_type_id)]
@@ -167,7 +163,6 @@
167163
#![feature(unchecked_neg)]
168164
#![feature(unchecked_shifts)]
169165
#![feature(utf16_extra)]
170-
#![feature(utf16_extra_const)]
171166
#![feature(variant_count)]
172167
// tidy-alphabetical-end
173168
//

library/core/src/mem/maybe_uninit.rs

-6
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,6 @@ impl<T> MaybeUninit<T> {
338338
/// let data = read(&mut buf);
339339
/// ```
340340
#[unstable(feature = "maybe_uninit_uninit_array", issue = "96097")]
341-
#[rustc_const_unstable(feature = "const_maybe_uninit_uninit_array", issue = "96097")]
342341
#[must_use]
343342
#[inline(always)]
344343
pub const fn uninit_array<const N: usize>() -> [Self; N] {
@@ -946,7 +945,6 @@ impl<T> MaybeUninit<T> {
946945
/// assert_eq!(array, [0, 1, 2]);
947946
/// ```
948947
#[unstable(feature = "maybe_uninit_array_assume_init", issue = "96097")]
949-
#[rustc_const_unstable(feature = "const_maybe_uninit_array_assume_init", issue = "96097")]
950948
#[inline(always)]
951949
#[track_caller]
952950
pub const unsafe fn array_assume_init<const N: usize>(array: [Self; N]) -> [T; N] {
@@ -973,7 +971,6 @@ impl<T> MaybeUninit<T> {
973971
///
974972
/// [`assume_init_ref`]: MaybeUninit::assume_init_ref
975973
#[unstable(feature = "maybe_uninit_slice", issue = "63569")]
976-
#[rustc_const_unstable(feature = "maybe_uninit_slice", issue = "63569")]
977974
#[inline(always)]
978975
pub const unsafe fn slice_assume_init_ref(slice: &[Self]) -> &[T] {
979976
// SAFETY: casting `slice` to a `*const [T]` is safe since the caller guarantees that
@@ -995,7 +992,6 @@ impl<T> MaybeUninit<T> {
995992
///
996993
/// [`assume_init_mut`]: MaybeUninit::assume_init_mut
997994
#[unstable(feature = "maybe_uninit_slice", issue = "63569")]
998-
#[rustc_const_unstable(feature = "maybe_uninit_slice", issue = "63569")]
999995
#[inline(always)]
1000996
pub const unsafe fn slice_assume_init_mut(slice: &mut [Self]) -> &mut [T] {
1001997
// SAFETY: similar to safety notes for `slice_get_ref`, but we have a
@@ -1005,15 +1001,13 @@ impl<T> MaybeUninit<T> {
10051001

10061002
/// Gets a pointer to the first element of the array.
10071003
#[unstable(feature = "maybe_uninit_slice", issue = "63569")]
1008-
#[rustc_const_unstable(feature = "maybe_uninit_slice", issue = "63569")]
10091004
#[inline(always)]
10101005
pub const fn slice_as_ptr(this: &[MaybeUninit<T>]) -> *const T {
10111006
this.as_ptr() as *const T
10121007
}
10131008

10141009
/// Gets a mutable pointer to the first element of the array.
10151010
#[unstable(feature = "maybe_uninit_slice", issue = "63569")]
1016-
#[rustc_const_unstable(feature = "maybe_uninit_slice", issue = "63569")]
10171011
#[inline(always)]
10181012
pub const fn slice_as_mut_ptr(this: &mut [MaybeUninit<T>]) -> *mut T {
10191013
this.as_mut_ptr() as *mut T

library/core/src/net/ip_addr.rs

-1
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,6 @@ impl IpAddr {
373373
/// assert_eq!(IpAddr::V6(Ipv6Addr::new(0x2001, 0x2, 0, 0, 0, 0, 0, 0)).is_benchmarking(), true);
374374
/// ```
375375
#[unstable(feature = "ip", issue = "27709")]
376-
#[rustc_const_unstable(feature = "const_ipv4", issue = "76205")]
377376
#[must_use]
378377
#[inline]
379378
pub const fn is_benchmarking(&self) -> bool {

library/core/src/num/f32.rs

-2
Original file line numberDiff line numberDiff line change
@@ -748,7 +748,6 @@ impl f32 {
748748
/// [`MAX`]: Self::MAX
749749
#[inline]
750750
#[unstable(feature = "float_next_up_down", issue = "91399")]
751-
#[rustc_const_unstable(feature = "float_next_up_down", issue = "91399")]
752751
pub const fn next_up(self) -> Self {
753752
// Some targets violate Rust's assumption of IEEE semantics, e.g. by flushing
754753
// denormals to zero. This is in general unsound and unsupported, but here
@@ -797,7 +796,6 @@ impl f32 {
797796
/// [`MAX`]: Self::MAX
798797
#[inline]
799798
#[unstable(feature = "float_next_up_down", issue = "91399")]
800-
#[rustc_const_unstable(feature = "float_next_up_down", issue = "91399")]
801799
pub const fn next_down(self) -> Self {
802800
// Some targets violate Rust's assumption of IEEE semantics, e.g. by flushing
803801
// denormals to zero. This is in general unsound and unsupported, but here

library/core/src/num/f64.rs

-2
Original file line numberDiff line numberDiff line change
@@ -765,7 +765,6 @@ impl f64 {
765765
/// [`MAX`]: Self::MAX
766766
#[inline]
767767
#[unstable(feature = "float_next_up_down", issue = "91399")]
768-
#[rustc_const_unstable(feature = "float_next_up_down", issue = "91399")]
769768
pub const fn next_up(self) -> Self {
770769
// Some targets violate Rust's assumption of IEEE semantics, e.g. by flushing
771770
// denormals to zero. This is in general unsound and unsupported, but here
@@ -814,7 +813,6 @@ impl f64 {
814813
/// [`MAX`]: Self::MAX
815814
#[inline]
816815
#[unstable(feature = "float_next_up_down", issue = "91399")]
817-
#[rustc_const_unstable(feature = "float_next_up_down", issue = "91399")]
818816
pub const fn next_down(self) -> Self {
819817
// Some targets violate Rust's assumption of IEEE semantics, e.g. by flushing
820818
// denormals to zero. This is in general unsound and unsupported, but here

library/core/src/num/int_macros.rs

-18
Original file line numberDiff line numberDiff line change
@@ -477,7 +477,6 @@ macro_rules! int_impl {
477477
#[doc = concat!("let _ = (", stringify!($SelfT), "::MAX - 2).strict_add(3);")]
478478
/// ```
479479
#[unstable(feature = "strict_overflow_ops", issue = "118260")]
480-
#[rustc_const_unstable(feature = "const_strict_overflow_ops", issue = "118260")]
481480
#[must_use = "this returns the result of the operation, \
482481
without modifying the original"]
483482
#[inline]
@@ -573,7 +572,6 @@ macro_rules! int_impl {
573572
#[doc = concat!("let _ = (", stringify!($SelfT), "::MAX - 2).strict_add_unsigned(3);")]
574573
/// ```
575574
#[unstable(feature = "strict_overflow_ops", issue = "118260")]
576-
#[rustc_const_unstable(feature = "const_strict_overflow_ops", issue = "118260")]
577575
#[must_use = "this returns the result of the operation, \
578576
without modifying the original"]
579577
#[inline]
@@ -629,7 +627,6 @@ macro_rules! int_impl {
629627
#[doc = concat!("let _ = (", stringify!($SelfT), "::MIN + 2).strict_sub(3);")]
630628
/// ```
631629
#[unstable(feature = "strict_overflow_ops", issue = "118260")]
632-
#[rustc_const_unstable(feature = "const_strict_overflow_ops", issue = "118260")]
633630
#[must_use = "this returns the result of the operation, \
634631
without modifying the original"]
635632
#[inline]
@@ -725,7 +722,6 @@ macro_rules! int_impl {
725722
#[doc = concat!("let _ = (", stringify!($SelfT), "::MIN + 2).strict_sub_unsigned(3);")]
726723
/// ```
727724
#[unstable(feature = "strict_overflow_ops", issue = "118260")]
728-
#[rustc_const_unstable(feature = "const_strict_overflow_ops", issue = "118260")]
729725
#[must_use = "this returns the result of the operation, \
730726
without modifying the original"]
731727
#[inline]
@@ -781,7 +777,6 @@ macro_rules! int_impl {
781777
#[doc = concat!("let _ = ", stringify!($SelfT), "::MAX.strict_mul(2);")]
782778
/// ```
783779
#[unstable(feature = "strict_overflow_ops", issue = "118260")]
784-
#[rustc_const_unstable(feature = "const_strict_overflow_ops", issue = "118260")]
785780
#[must_use = "this returns the result of the operation, \
786781
without modifying the original"]
787782
#[inline]
@@ -895,7 +890,6 @@ macro_rules! int_impl {
895890
#[doc = concat!("let _ = (1", stringify!($SelfT), ").strict_div(0);")]
896891
/// ```
897892
#[unstable(feature = "strict_overflow_ops", issue = "118260")]
898-
#[rustc_const_unstable(feature = "const_strict_overflow_ops", issue = "118260")]
899893
#[must_use = "this returns the result of the operation, \
900894
without modifying the original"]
901895
#[inline]
@@ -969,7 +963,6 @@ macro_rules! int_impl {
969963
#[doc = concat!("let _ = (1", stringify!($SelfT), ").strict_div_euclid(0);")]
970964
/// ```
971965
#[unstable(feature = "strict_overflow_ops", issue = "118260")]
972-
#[rustc_const_unstable(feature = "const_strict_overflow_ops", issue = "118260")]
973966
#[must_use = "this returns the result of the operation, \
974967
without modifying the original"]
975968
#[inline]
@@ -1042,7 +1035,6 @@ macro_rules! int_impl {
10421035
#[doc = concat!("let _ = ", stringify!($SelfT), "::MIN.strict_rem(-1);")]
10431036
/// ```
10441037
#[unstable(feature = "strict_overflow_ops", issue = "118260")]
1045-
#[rustc_const_unstable(feature = "const_strict_overflow_ops", issue = "118260")]
10461038
#[must_use = "this returns the result of the operation, \
10471039
without modifying the original"]
10481040
#[inline]
@@ -1115,7 +1107,6 @@ macro_rules! int_impl {
11151107
#[doc = concat!("let _ = ", stringify!($SelfT), "::MIN.strict_rem_euclid(-1);")]
11161108
/// ```
11171109
#[unstable(feature = "strict_overflow_ops", issue = "118260")]
1118-
#[rustc_const_unstable(feature = "const_strict_overflow_ops", issue = "118260")]
11191110
#[must_use = "this returns the result of the operation, \
11201111
without modifying the original"]
11211112
#[inline]
@@ -1203,7 +1194,6 @@ macro_rules! int_impl {
12031194
#[doc = concat!("let _ = ", stringify!($SelfT), "::MIN.strict_neg();")]
12041195
///
12051196
#[unstable(feature = "strict_overflow_ops", issue = "118260")]
1206-
#[rustc_const_unstable(feature = "const_strict_overflow_ops", issue = "118260")]
12071197
#[must_use = "this returns the result of the operation, \
12081198
without modifying the original"]
12091199
#[inline]
@@ -1266,7 +1256,6 @@ macro_rules! int_impl {
12661256
#[doc = concat!("let _ = 0x1", stringify!($SelfT), ".strict_shl(129);")]
12671257
/// ```
12681258
#[unstable(feature = "strict_overflow_ops", issue = "118260")]
1269-
#[rustc_const_unstable(feature = "const_strict_overflow_ops", issue = "118260")]
12701259
#[must_use = "this returns the result of the operation, \
12711260
without modifying the original"]
12721261
#[inline]
@@ -1325,7 +1314,6 @@ macro_rules! int_impl {
13251314
#[doc = concat!("assert_eq!(0x1", stringify!($SelfT), ".unbounded_shl(129), 0);")]
13261315
/// ```
13271316
#[unstable(feature = "unbounded_shifts", issue = "129375")]
1328-
#[rustc_const_unstable(feature = "const_unbounded_shifts", issue = "129375")]
13291317
#[must_use = "this returns the result of the operation, \
13301318
without modifying the original"]
13311319
#[inline]
@@ -1391,7 +1379,6 @@ macro_rules! int_impl {
13911379
#[doc = concat!("let _ = 0x10", stringify!($SelfT), ".strict_shr(128);")]
13921380
/// ```
13931381
#[unstable(feature = "strict_overflow_ops", issue = "118260")]
1394-
#[rustc_const_unstable(feature = "const_strict_overflow_ops", issue = "118260")]
13951382
#[must_use = "this returns the result of the operation, \
13961383
without modifying the original"]
13971384
#[inline]
@@ -1452,7 +1439,6 @@ macro_rules! int_impl {
14521439
#[doc = concat!("assert_eq!(", stringify!($SelfT), "::MIN.unbounded_shr(129), -1);")]
14531440
/// ```
14541441
#[unstable(feature = "unbounded_shifts", issue = "129375")]
1455-
#[rustc_const_unstable(feature = "const_unbounded_shifts", issue = "129375")]
14561442
#[must_use = "this returns the result of the operation, \
14571443
without modifying the original"]
14581444
#[inline]
@@ -1519,7 +1505,6 @@ macro_rules! int_impl {
15191505
#[doc = concat!("let _ = ", stringify!($SelfT), "::MIN.strict_abs();")]
15201506
/// ```
15211507
#[unstable(feature = "strict_overflow_ops", issue = "118260")]
1522-
#[rustc_const_unstable(feature = "const_strict_overflow_ops", issue = "118260")]
15231508
#[must_use = "this returns the result of the operation, \
15241509
without modifying the original"]
15251510
#[inline]
@@ -1594,7 +1579,6 @@ macro_rules! int_impl {
15941579
#[doc = concat!("let _ = ", stringify!($SelfT), "::MAX.strict_pow(2);")]
15951580
/// ```
15961581
#[unstable(feature = "strict_overflow_ops", issue = "118260")]
1597-
#[rustc_const_unstable(feature = "const_strict_overflow_ops", issue = "118260")]
15981582
#[must_use = "this returns the result of the operation, \
15991583
without modifying the original"]
16001584
#[inline]
@@ -2368,7 +2352,6 @@ macro_rules! int_impl {
23682352
/// assert_eq!((sum1, sum0), (6, 8));
23692353
/// ```
23702354
#[unstable(feature = "bigint_helper_methods", issue = "85532")]
2371-
#[rustc_const_unstable(feature = "const_bigint_helper_methods", issue = "85532")]
23722355
#[must_use = "this returns the result of the operation, \
23732356
without modifying the original"]
23742357
#[inline]
@@ -2476,7 +2459,6 @@ macro_rules! int_impl {
24762459
#[doc = concat!("assert_eq!((diff1, diff0), (10, ", stringify!($UnsignedT), "::MAX));")]
24772460
/// ```
24782461
#[unstable(feature = "bigint_helper_methods", issue = "85532")]
2479-
#[rustc_const_unstable(feature = "const_bigint_helper_methods", issue = "85532")]
24802462
#[must_use = "this returns the result of the operation, \
24812463
without modifying the original"]
24822464
#[inline]

library/core/src/num/mod.rs

-8
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,6 @@ macro_rules! midpoint_impl {
114114
#[doc = concat!("assert_eq!(1", stringify!($SelfT), ".midpoint(4), 2);")]
115115
/// ```
116116
#[unstable(feature = "num_midpoint", issue = "110840")]
117-
#[rustc_const_unstable(feature = "const_num_midpoint", issue = "110840")]
118117
#[must_use = "this returns the result of the operation, \
119118
without modifying the original"]
120119
#[inline]
@@ -142,7 +141,6 @@ macro_rules! midpoint_impl {
142141
#[doc = concat!("assert_eq!(0", stringify!($SelfT), ".midpoint(7), 3);")]
143142
/// ```
144143
#[unstable(feature = "num_midpoint", issue = "110840")]
145-
#[rustc_const_unstable(feature = "const_num_midpoint", issue = "110840")]
146144
#[must_use = "this returns the result of the operation, \
147145
without modifying the original"]
148146
#[inline]
@@ -170,7 +168,6 @@ macro_rules! midpoint_impl {
170168
#[doc = concat!("assert_eq!(1", stringify!($SelfT), ".midpoint(4), 2);")]
171169
/// ```
172170
#[unstable(feature = "num_midpoint", issue = "110840")]
173-
#[rustc_const_unstable(feature = "const_num_midpoint", issue = "110840")]
174171
#[must_use = "this returns the result of the operation, \
175172
without modifying the original"]
176173
#[inline]
@@ -196,7 +193,6 @@ macro_rules! midpoint_impl {
196193
#[doc = concat!("assert_eq!(0", stringify!($SelfT), ".midpoint(7), 3);")]
197194
/// ```
198195
#[unstable(feature = "num_midpoint", issue = "110840")]
199-
#[rustc_const_unstable(feature = "const_num_midpoint", issue = "110840")]
200196
#[must_use = "this returns the result of the operation, \
201197
without modifying the original"]
202198
#[inline]
@@ -229,7 +225,6 @@ macro_rules! widening_impl {
229225
/// assert_eq!(1_000_000_000u32.widening_mul(10), (1410065408, 2));
230226
/// ```
231227
#[unstable(feature = "bigint_helper_methods", issue = "85532")]
232-
#[rustc_const_unstable(feature = "const_bigint_helper_methods", issue = "85532")]
233228
#[must_use = "this returns the result of the operation, \
234229
without modifying the original"]
235230
#[inline]
@@ -320,7 +315,6 @@ macro_rules! widening_impl {
320315
/// );
321316
/// ```
322317
#[unstable(feature = "bigint_helper_methods", issue = "85532")]
323-
#[rustc_const_unstable(feature = "bigint_helper_methods", issue = "85532")]
324318
#[must_use = "this returns the result of the operation, \
325319
without modifying the original"]
326320
#[inline]
@@ -915,7 +909,6 @@ impl u8 {
915909
/// ```
916910
#[must_use]
917911
#[unstable(feature = "is_ascii_octdigit", issue = "101288")]
918-
#[rustc_const_unstable(feature = "is_ascii_octdigit", issue = "101288")]
919912
#[inline]
920913
pub const fn is_ascii_octdigit(&self) -> bool {
921914
matches!(*self, b'0'..=b'7')
@@ -1195,7 +1188,6 @@ impl u16 {
11951188
/// ```
11961189
#[must_use]
11971190
#[unstable(feature = "utf16_extra", issue = "94919")]
1198-
#[rustc_const_unstable(feature = "utf16_extra_const", issue = "94919")]
11991191
#[inline]
12001192
pub const fn is_utf16_surrogate(self) -> bool {
12011193
matches!(self, 0xD800..=0xDFFF)

library/core/src/num/nonzero.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1474,7 +1474,6 @@ macro_rules! nonzero_integer_signedness_dependent_methods {
14741474
/// # }
14751475
/// ```
14761476
#[unstable(feature = "num_midpoint", issue = "110840")]
1477-
#[rustc_const_unstable(feature = "const_num_midpoint", issue = "110840")]
14781477
#[must_use = "this returns the result of the operation, \
14791478
without modifying the original"]
14801479
#[inline]

0 commit comments

Comments
 (0)