Skip to content

Commit 0e78c29

Browse files
authored
Rollup merge of rust-lang#46287 - SimonSapin:stable-constness, r=aturon
Stabilize const-calling existing const-fns in std Fixes rust-lang#46038
2 parents 6006c0f + 6c5f53e commit 0e78c29

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+8
-164
lines changed

src/libcore/cell.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,6 @@ impl<T> Cell<T> {
329329
/// let c = Cell::new(5);
330330
/// ```
331331
#[stable(feature = "rust1", since = "1.0.0")]
332-
#[rustc_const_unstable(feature = "const_cell_new")]
333332
#[inline]
334333
pub const fn new(value: T) -> Cell<T> {
335334
Cell {
@@ -544,7 +543,6 @@ impl<T> RefCell<T> {
544543
/// let c = RefCell::new(5);
545544
/// ```
546545
#[stable(feature = "rust1", since = "1.0.0")]
547-
#[rustc_const_unstable(feature = "const_refcell_new")]
548546
#[inline]
549547
pub const fn new(value: T) -> RefCell<T> {
550548
RefCell {
@@ -1215,7 +1213,6 @@ impl<T> UnsafeCell<T> {
12151213
/// let uc = UnsafeCell::new(5);
12161214
/// ```
12171215
#[stable(feature = "rust1", since = "1.0.0")]
1218-
#[rustc_const_unstable(feature = "const_unsafe_cell_new")]
12191216
#[inline]
12201217
pub const fn new(value: T) -> UnsafeCell<T> {
12211218
UnsafeCell { value: value }

src/libcore/lib.rs

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -85,47 +85,13 @@
8585
#![feature(prelude_import)]
8686
#![feature(repr_simd, platform_intrinsics)]
8787
#![feature(rustc_attrs)]
88-
#![feature(rustc_const_unstable)]
8988
#![feature(specialization)]
9089
#![feature(staged_api)]
9190
#![feature(unboxed_closures)]
9291
#![feature(untagged_unions)]
9392
#![feature(unwind_attributes)]
94-
#![feature(const_min_value)]
95-
#![feature(const_max_value)]
96-
#![feature(const_atomic_bool_new)]
97-
#![feature(const_atomic_isize_new)]
98-
#![feature(const_atomic_usize_new)]
99-
#![feature(const_atomic_i8_new)]
100-
#![feature(const_atomic_u8_new)]
101-
#![feature(const_atomic_i16_new)]
102-
#![feature(const_atomic_u16_new)]
103-
#![feature(const_atomic_i32_new)]
104-
#![feature(const_atomic_u32_new)]
105-
#![feature(const_atomic_i64_new)]
106-
#![feature(const_atomic_u64_new)]
107-
#![feature(const_unsafe_cell_new)]
108-
#![feature(const_cell_new)]
109-
#![feature(const_nonzero_new)]
11093
#![cfg_attr(not(stage0), feature(doc_spotlight))]
11194

112-
#![cfg_attr(not(stage0), feature(const_min_value))]
113-
#![cfg_attr(not(stage0), feature(const_max_value))]
114-
#![cfg_attr(not(stage0), feature(const_atomic_bool_new))]
115-
#![cfg_attr(not(stage0), feature(const_atomic_isize_new))]
116-
#![cfg_attr(not(stage0), feature(const_atomic_usize_new))]
117-
#![cfg_attr(not(stage0), feature(const_atomic_i8_new))]
118-
#![cfg_attr(not(stage0), feature(const_atomic_u8_new))]
119-
#![cfg_attr(not(stage0), feature(const_atomic_i16_new))]
120-
#![cfg_attr(not(stage0), feature(const_atomic_u16_new))]
121-
#![cfg_attr(not(stage0), feature(const_atomic_i32_new))]
122-
#![cfg_attr(not(stage0), feature(const_atomic_u32_new))]
123-
#![cfg_attr(not(stage0), feature(const_atomic_i64_new))]
124-
#![cfg_attr(not(stage0), feature(const_atomic_u64_new))]
125-
#![cfg_attr(not(stage0), feature(const_unsafe_cell_new))]
126-
#![cfg_attr(not(stage0), feature(const_cell_new))]
127-
#![cfg_attr(not(stage0), feature(const_nonzero_new))]
128-
12995
#[prelude_import]
13096
#[allow(unused)]
13197
use prelude::v1::*;

src/libcore/mem.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,6 @@ pub fn forget<T>(t: T) {
311311
/// [alignment]: ./fn.align_of.html
312312
#[inline]
313313
#[stable(feature = "rust1", since = "1.0.0")]
314-
#[rustc_const_unstable(feature = "const_size_of")]
315314
pub const fn size_of<T>() -> usize {
316315
unsafe { intrinsics::size_of::<T>() }
317316
}
@@ -403,7 +402,6 @@ pub fn min_align_of_val<T: ?Sized>(val: &T) -> usize {
403402
/// ```
404403
#[inline]
405404
#[stable(feature = "rust1", since = "1.0.0")]
406-
#[rustc_const_unstable(feature = "const_align_of")]
407405
pub const fn align_of<T>() -> usize {
408406
unsafe { intrinsics::min_align_of::<T>() }
409407
}

src/libcore/nonzero.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@ impl<T: Zeroable> NonZero<T> {
7070
#[unstable(feature = "nonzero",
7171
reason = "needs an RFC to flesh out the design",
7272
issue = "27730")]
73-
#[rustc_const_unstable(feature = "const_nonzero_new")]
7473
#[inline]
7574
pub const unsafe fn new_unchecked(inner: T) -> Self {
7675
NonZero(inner)

src/libcore/num/mod.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,6 @@ macro_rules! int_impl {
110110
/// assert_eq!(i8::min_value(), -128);
111111
/// ```
112112
#[stable(feature = "rust1", since = "1.0.0")]
113-
#[rustc_const_unstable(feature = "const_min_value")]
114113
#[inline]
115114
pub const fn min_value() -> Self {
116115
!0 ^ ((!0 as $UnsignedT) >> 1) as Self
@@ -124,7 +123,6 @@ macro_rules! int_impl {
124123
/// assert_eq!(i8::max_value(), 127);
125124
/// ```
126125
#[stable(feature = "rust1", since = "1.0.0")]
127-
#[rustc_const_unstable(feature = "const_max_value")]
128126
#[inline]
129127
pub const fn max_value() -> Self {
130128
!Self::min_value()
@@ -1290,7 +1288,6 @@ macro_rules! uint_impl {
12901288
/// assert_eq!(u8::min_value(), 0);
12911289
/// ```
12921290
#[stable(feature = "rust1", since = "1.0.0")]
1293-
#[rustc_const_unstable(feature = "const_min_value")]
12941291
#[inline]
12951292
pub const fn min_value() -> Self { 0 }
12961293

@@ -1302,7 +1299,6 @@ macro_rules! uint_impl {
13021299
/// assert_eq!(u8::max_value(), 255);
13031300
/// ```
13041301
#[stable(feature = "rust1", since = "1.0.0")]
1305-
#[rustc_const_unstable(feature = "const_max_value")]
13061302
#[inline]
13071303
pub const fn max_value() -> Self { !0 }
13081304

src/libcore/ptr.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@ pub unsafe fn drop_in_place<T: ?Sized>(to_drop: *mut T) {
7474
/// ```
7575
#[inline]
7676
#[stable(feature = "rust1", since = "1.0.0")]
77-
#[rustc_const_unstable(feature = "const_ptr_null")]
7877
pub const fn null<T>() -> *const T { 0 as *const T }
7978

8079
/// Creates a null mutable raw pointer.
@@ -89,7 +88,6 @@ pub const fn null<T>() -> *const T { 0 as *const T }
8988
/// ```
9089
#[inline]
9190
#[stable(feature = "rust1", since = "1.0.0")]
92-
#[rustc_const_unstable(feature = "const_ptr_null_mut")]
9391
pub const fn null_mut<T>() -> *mut T { 0 as *mut T }
9492

9593
/// Swaps the values at two mutable locations of the same type, without
@@ -2347,7 +2345,6 @@ impl<T: ?Sized> Unique<T> {
23472345
///
23482346
/// `ptr` must be non-null.
23492347
#[unstable(feature = "unique", issue = "27730")]
2350-
#[rustc_const_unstable(feature = "const_unique_new")]
23512348
pub const unsafe fn new_unchecked(ptr: *mut T) -> Self {
23522349
Unique { pointer: NonZero::new_unchecked(ptr), _marker: PhantomData }
23532350
}
@@ -2482,7 +2479,6 @@ impl<T: ?Sized> Shared<T> {
24822479
///
24832480
/// `ptr` must be non-null.
24842481
#[unstable(feature = "shared", issue = "27730")]
2485-
#[rustc_const_unstable(feature = "const_shared_new")]
24862482
pub const unsafe fn new_unchecked(ptr: *mut T) -> Self {
24872483
Shared { pointer: NonZero::new_unchecked(ptr), _marker: PhantomData }
24882484
}

src/libcore/sync/atomic.rs

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,6 @@ impl AtomicBool {
242242
/// ```
243243
#[inline]
244244
#[stable(feature = "rust1", since = "1.0.0")]
245-
#[rustc_const_unstable(feature = "const_atomic_bool_new")]
246245
pub const fn new(v: bool) -> AtomicBool {
247246
AtomicBool { v: UnsafeCell::new(v as u8) }
248247
}
@@ -656,7 +655,6 @@ impl<T> AtomicPtr<T> {
656655
/// ```
657656
#[inline]
658657
#[stable(feature = "rust1", since = "1.0.0")]
659-
#[rustc_const_unstable(feature = "const_atomic_ptr_new")]
660658
pub const fn new(p: *mut T) -> AtomicPtr<T> {
661659
AtomicPtr { p: UnsafeCell::new(p) }
662660
}
@@ -935,7 +933,7 @@ impl<T> From<*mut T> for AtomicPtr<T> {
935933

936934
#[cfg(target_has_atomic = "ptr")]
937935
macro_rules! atomic_int {
938-
($stable:meta, $const_unstable:meta,
936+
($stable:meta,
939937
$stable_cxchg:meta,
940938
$stable_debug:meta,
941939
$stable_access:meta,
@@ -1004,7 +1002,6 @@ macro_rules! atomic_int {
10041002
/// ```
10051003
#[inline]
10061004
#[$stable]
1007-
#[$const_unstable]
10081005
pub const fn new(v: $int_type) -> Self {
10091006
$atomic_type {v: UnsafeCell::new(v)}
10101007
}
@@ -1368,7 +1365,6 @@ macro_rules! atomic_int {
13681365
#[cfg(target_has_atomic = "8")]
13691366
atomic_int! {
13701367
unstable(feature = "integer_atomics", issue = "32976"),
1371-
rustc_const_unstable(feature = "const_atomic_i8_new"),
13721368
unstable(feature = "integer_atomics", issue = "32976"),
13731369
unstable(feature = "integer_atomics", issue = "32976"),
13741370
unstable(feature = "integer_atomics", issue = "32976"),
@@ -1378,7 +1374,6 @@ atomic_int! {
13781374
#[cfg(target_has_atomic = "8")]
13791375
atomic_int! {
13801376
unstable(feature = "integer_atomics", issue = "32976"),
1381-
rustc_const_unstable(feature = "const_atomic_u8_new"),
13821377
unstable(feature = "integer_atomics", issue = "32976"),
13831378
unstable(feature = "integer_atomics", issue = "32976"),
13841379
unstable(feature = "integer_atomics", issue = "32976"),
@@ -1388,7 +1383,6 @@ atomic_int! {
13881383
#[cfg(target_has_atomic = "16")]
13891384
atomic_int! {
13901385
unstable(feature = "integer_atomics", issue = "32976"),
1391-
rustc_const_unstable(feature = "const_atomic_i16_new"),
13921386
unstable(feature = "integer_atomics", issue = "32976"),
13931387
unstable(feature = "integer_atomics", issue = "32976"),
13941388
unstable(feature = "integer_atomics", issue = "32976"),
@@ -1398,7 +1392,6 @@ atomic_int! {
13981392
#[cfg(target_has_atomic = "16")]
13991393
atomic_int! {
14001394
unstable(feature = "integer_atomics", issue = "32976"),
1401-
rustc_const_unstable(feature = "const_atomic_u16_new"),
14021395
unstable(feature = "integer_atomics", issue = "32976"),
14031396
unstable(feature = "integer_atomics", issue = "32976"),
14041397
unstable(feature = "integer_atomics", issue = "32976"),
@@ -1408,7 +1401,6 @@ atomic_int! {
14081401
#[cfg(target_has_atomic = "32")]
14091402
atomic_int! {
14101403
unstable(feature = "integer_atomics", issue = "32976"),
1411-
rustc_const_unstable(feature = "const_atomic_i32_new"),
14121404
unstable(feature = "integer_atomics", issue = "32976"),
14131405
unstable(feature = "integer_atomics", issue = "32976"),
14141406
unstable(feature = "integer_atomics", issue = "32976"),
@@ -1418,7 +1410,6 @@ atomic_int! {
14181410
#[cfg(target_has_atomic = "32")]
14191411
atomic_int! {
14201412
unstable(feature = "integer_atomics", issue = "32976"),
1421-
rustc_const_unstable(feature = "const_atomic_u32_new"),
14221413
unstable(feature = "integer_atomics", issue = "32976"),
14231414
unstable(feature = "integer_atomics", issue = "32976"),
14241415
unstable(feature = "integer_atomics", issue = "32976"),
@@ -1428,7 +1419,6 @@ atomic_int! {
14281419
#[cfg(target_has_atomic = "64")]
14291420
atomic_int! {
14301421
unstable(feature = "integer_atomics", issue = "32976"),
1431-
rustc_const_unstable(feature = "const_atomic_i64_new"),
14321422
unstable(feature = "integer_atomics", issue = "32976"),
14331423
unstable(feature = "integer_atomics", issue = "32976"),
14341424
unstable(feature = "integer_atomics", issue = "32976"),
@@ -1438,7 +1428,6 @@ atomic_int! {
14381428
#[cfg(target_has_atomic = "64")]
14391429
atomic_int! {
14401430
unstable(feature = "integer_atomics", issue = "32976"),
1441-
rustc_const_unstable(feature = "const_atomic_u64_new"),
14421431
unstable(feature = "integer_atomics", issue = "32976"),
14431432
unstable(feature = "integer_atomics", issue = "32976"),
14441433
unstable(feature = "integer_atomics", issue = "32976"),
@@ -1448,7 +1437,6 @@ atomic_int! {
14481437
#[cfg(target_has_atomic = "ptr")]
14491438
atomic_int!{
14501439
stable(feature = "rust1", since = "1.0.0"),
1451-
rustc_const_unstable(feature = "const_atomic_isize_new"),
14521440
stable(feature = "extended_compare_and_swap", since = "1.10.0"),
14531441
stable(feature = "atomic_debug", since = "1.3.0"),
14541442
stable(feature = "atomic_access", since = "1.15.0"),
@@ -1458,7 +1446,6 @@ atomic_int!{
14581446
#[cfg(target_has_atomic = "ptr")]
14591447
atomic_int!{
14601448
stable(feature = "rust1", since = "1.0.0"),
1461-
rustc_const_unstable(feature = "const_atomic_usize_new"),
14621449
stable(feature = "extended_compare_and_swap", since = "1.10.0"),
14631450
stable(feature = "atomic_debug", since = "1.3.0"),
14641451
stable(feature = "atomic_access", since = "1.15.0"),

src/libcore/tests/lib.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,6 @@
4242
#![feature(try_trait)]
4343
#![feature(unique)]
4444

45-
#![feature(const_atomic_bool_new)]
46-
#![feature(const_atomic_usize_new)]
47-
#![feature(const_atomic_isize_new)]
48-
4945
extern crate core;
5046
extern crate test;
5147

src/librustc/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@
6464
#![feature(underscore_lifetimes)]
6565
#![feature(trace_macros)]
6666
#![feature(test)]
67-
#![feature(const_atomic_bool_new)]
6867

6968
#![recursion_limit="512"]
7069

src/librustc_apfloat/lib.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,6 @@
4545
#![deny(warnings)]
4646
#![forbid(unsafe_code)]
4747

48-
#![feature(const_max_value)]
49-
#![feature(const_min_value)]
5048
#![feature(i128_type)]
5149
#![feature(slice_patterns)]
5250
#![feature(try_from)]

src/librustc_const_eval/lib.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@
2525
#![feature(box_syntax)]
2626
#![feature(i128_type)]
2727

28-
#![feature(const_min_value)]
29-
3028
extern crate arena;
3129
#[macro_use] extern crate syntax;
3230
#[macro_use] extern crate log;

src/librustc_const_math/lib.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,6 @@
2222
#![feature(i128)]
2323
#![feature(i128_type)]
2424

25-
#![feature(const_min_value)]
26-
#![feature(const_max_value)]
27-
2825
extern crate rustc_apfloat;
2926

3027
extern crate syntax;

src/librustc_mir/diagnostics.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -770,8 +770,6 @@ static B: &'static AtomicUsize = &A; // ok!
770770
You can also have this error while using a cell type:
771771
772772
```compile_fail,E0492
773-
#![feature(const_cell_new)]
774-
775773
use std::cell::Cell;
776774
777775
const A: Cell<usize> = Cell::new(1);
@@ -798,8 +796,6 @@ However, if you still wish to use these types, you can achieve this by an unsafe
798796
wrapper:
799797
800798
```
801-
#![feature(const_cell_new)]
802-
803799
use std::cell::Cell;
804800
use std::marker::Sync;
805801

src/librustc_trans/lib.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,6 @@
3333
#![feature(slice_patterns)]
3434
#![feature(conservative_impl_trait)]
3535

36-
#![feature(const_atomic_bool_new)]
37-
#![feature(const_once_new)]
38-
3936
use rustc::dep_graph::WorkProduct;
4037
use syntax_pos::symbol::Symbol;
4138

src/libstd/lib.rs

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -256,15 +256,6 @@
256256
#![feature(collections_range)]
257257
#![feature(compiler_builtins_lib)]
258258
#![feature(const_fn)]
259-
#![feature(const_max_value)]
260-
#![feature(const_atomic_bool_new)]
261-
#![feature(const_atomic_isize_new)]
262-
#![feature(const_atomic_usize_new)]
263-
#![feature(const_unsafe_cell_new)]
264-
#![feature(const_cell_new)]
265-
#![feature(const_once_new)]
266-
#![feature(const_ptr_null)]
267-
#![feature(const_ptr_null_mut)]
268259
#![feature(core_float)]
269260
#![feature(core_intrinsics)]
270261
#![feature(dropck_eyepatch)]
@@ -306,7 +297,6 @@
306297
#![feature(repr_align)]
307298
#![feature(repr_simd)]
308299
#![feature(rustc_attrs)]
309-
#![feature(rustc_const_unstable)]
310300
#![feature(shared)]
311301
#![feature(sip_hash_13)]
312302
#![feature(slice_bytes)]
@@ -331,7 +321,6 @@
331321
#![feature(doc_masked)]
332322
#![feature(doc_spotlight)]
333323
#![cfg_attr(test, feature(update_panic_count))]
334-
#![cfg_attr(windows, feature(const_atomic_ptr_new))]
335324
#![cfg_attr(windows, feature(used))]
336325

337326
#![default_lib_allocator]

src/libstd/sync/once.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,6 @@ struct Finish {
156156
impl Once {
157157
/// Creates a new `Once` value.
158158
#[stable(feature = "once_new", since = "1.2.0")]
159-
#[rustc_const_unstable(feature = "const_once_new")]
160159
pub const fn new() -> Once {
161160
Once {
162161
state: AtomicUsize::new(INCOMPLETE),

src/test/compile-fail-fulldeps/dropck_tarena_cycle_checked.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
// for the error message we see here.)
1818

1919
#![feature(rustc_private)]
20-
#![feature(const_atomic_usize_new)]
2120

2221
extern crate arena;
2322

0 commit comments

Comments
 (0)