diff options
| author | Simon Sapin <simon.sapin@exyr.org> | 2017-11-26 23:19:18 +0100 |
|---|---|---|
| committer | Simon Sapin <simon.sapin@exyr.org> | 2017-11-26 23:43:44 +0100 |
| commit | 6c5f53e65ee5f022611033dbf58c42e26be7f93d (patch) | |
| tree | 9da24c4b5df8b773ff53d9fa207fdeb3aebdea42 /src/libcore | |
| parent | 827cb0d61e22eb6d5c9c5e8e8d05b07108a9968b (diff) | |
| download | rust-6c5f53e65ee5f022611033dbf58c42e26be7f93d.tar.gz rust-6c5f53e65ee5f022611033dbf58c42e26be7f93d.zip | |
Stabilize const-calling existing const-fns in std
Fixes #46038
Diffstat (limited to 'src/libcore')
| -rw-r--r-- | src/libcore/cell.rs | 3 | ||||
| -rw-r--r-- | src/libcore/lib.rs | 34 | ||||
| -rw-r--r-- | src/libcore/mem.rs | 2 | ||||
| -rw-r--r-- | src/libcore/nonzero.rs | 1 | ||||
| -rw-r--r-- | src/libcore/num/mod.rs | 4 | ||||
| -rw-r--r-- | src/libcore/ptr.rs | 4 | ||||
| -rw-r--r-- | src/libcore/sync/atomic.rs | 15 | ||||
| -rw-r--r-- | src/libcore/tests/lib.rs | 4 |
8 files changed, 1 insertions, 66 deletions
diff --git a/src/libcore/cell.rs b/src/libcore/cell.rs index d02576ae546..d4cd3f6264e 100644 --- a/src/libcore/cell.rs +++ b/src/libcore/cell.rs @@ -329,7 +329,6 @@ impl<T> Cell<T> { /// let c = Cell::new(5); /// ``` #[stable(feature = "rust1", since = "1.0.0")] - #[rustc_const_unstable(feature = "const_cell_new")] #[inline] pub const fn new(value: T) -> Cell<T> { Cell { @@ -544,7 +543,6 @@ impl<T> RefCell<T> { /// let c = RefCell::new(5); /// ``` #[stable(feature = "rust1", since = "1.0.0")] - #[rustc_const_unstable(feature = "const_refcell_new")] #[inline] pub const fn new(value: T) -> RefCell<T> { RefCell { @@ -1215,7 +1213,6 @@ impl<T> UnsafeCell<T> { /// let uc = UnsafeCell::new(5); /// ``` #[stable(feature = "rust1", since = "1.0.0")] - #[rustc_const_unstable(feature = "const_unsafe_cell_new")] #[inline] pub const fn new(value: T) -> UnsafeCell<T> { UnsafeCell { value: value } diff --git a/src/libcore/lib.rs b/src/libcore/lib.rs index 631b9f98589..07b45ad6a50 100644 --- a/src/libcore/lib.rs +++ b/src/libcore/lib.rs @@ -85,47 +85,13 @@ #![feature(prelude_import)] #![feature(repr_simd, platform_intrinsics)] #![feature(rustc_attrs)] -#![feature(rustc_const_unstable)] #![feature(specialization)] #![feature(staged_api)] #![feature(unboxed_closures)] #![feature(untagged_unions)] #![feature(unwind_attributes)] -#![feature(const_min_value)] -#![feature(const_max_value)] -#![feature(const_atomic_bool_new)] -#![feature(const_atomic_isize_new)] -#![feature(const_atomic_usize_new)] -#![feature(const_atomic_i8_new)] -#![feature(const_atomic_u8_new)] -#![feature(const_atomic_i16_new)] -#![feature(const_atomic_u16_new)] -#![feature(const_atomic_i32_new)] -#![feature(const_atomic_u32_new)] -#![feature(const_atomic_i64_new)] -#![feature(const_atomic_u64_new)] -#![feature(const_unsafe_cell_new)] -#![feature(const_cell_new)] -#![feature(const_nonzero_new)] #![cfg_attr(not(stage0), feature(doc_spotlight))] -#![cfg_attr(not(stage0), feature(const_min_value))] -#![cfg_attr(not(stage0), feature(const_max_value))] -#![cfg_attr(not(stage0), feature(const_atomic_bool_new))] -#![cfg_attr(not(stage0), feature(const_atomic_isize_new))] -#![cfg_attr(not(stage0), feature(const_atomic_usize_new))] -#![cfg_attr(not(stage0), feature(const_atomic_i8_new))] -#![cfg_attr(not(stage0), feature(const_atomic_u8_new))] -#![cfg_attr(not(stage0), feature(const_atomic_i16_new))] -#![cfg_attr(not(stage0), feature(const_atomic_u16_new))] -#![cfg_attr(not(stage0), feature(const_atomic_i32_new))] -#![cfg_attr(not(stage0), feature(const_atomic_u32_new))] -#![cfg_attr(not(stage0), feature(const_atomic_i64_new))] -#![cfg_attr(not(stage0), feature(const_atomic_u64_new))] -#![cfg_attr(not(stage0), feature(const_unsafe_cell_new))] -#![cfg_attr(not(stage0), feature(const_cell_new))] -#![cfg_attr(not(stage0), feature(const_nonzero_new))] - #[prelude_import] #[allow(unused)] use prelude::v1::*; diff --git a/src/libcore/mem.rs b/src/libcore/mem.rs index d57fbdf55f8..5b1a9399c39 100644 --- a/src/libcore/mem.rs +++ b/src/libcore/mem.rs @@ -311,7 +311,6 @@ pub fn forget<T>(t: T) { /// [alignment]: ./fn.align_of.html #[inline] #[stable(feature = "rust1", since = "1.0.0")] -#[rustc_const_unstable(feature = "const_size_of")] pub const fn size_of<T>() -> usize { unsafe { intrinsics::size_of::<T>() } } @@ -403,7 +402,6 @@ pub fn min_align_of_val<T: ?Sized>(val: &T) -> usize { /// ``` #[inline] #[stable(feature = "rust1", since = "1.0.0")] -#[rustc_const_unstable(feature = "const_align_of")] pub const fn align_of<T>() -> usize { unsafe { intrinsics::min_align_of::<T>() } } diff --git a/src/libcore/nonzero.rs b/src/libcore/nonzero.rs index edc0104f46b..a943adb7540 100644 --- a/src/libcore/nonzero.rs +++ b/src/libcore/nonzero.rs @@ -71,7 +71,6 @@ impl<T: Zeroable> NonZero<T> { #[unstable(feature = "nonzero", reason = "needs an RFC to flesh out the design", issue = "27730")] - #[rustc_const_unstable(feature = "const_nonzero_new")] #[inline] pub const unsafe fn new_unchecked(inner: T) -> Self { NonZero(inner) diff --git a/src/libcore/num/mod.rs b/src/libcore/num/mod.rs index 1230066e2b3..bfa00f895c0 100644 --- a/src/libcore/num/mod.rs +++ b/src/libcore/num/mod.rs @@ -110,7 +110,6 @@ macro_rules! int_impl { /// assert_eq!(i8::min_value(), -128); /// ``` #[stable(feature = "rust1", since = "1.0.0")] - #[rustc_const_unstable(feature = "const_min_value")] #[inline] pub const fn min_value() -> Self { !0 ^ ((!0 as $UnsignedT) >> 1) as Self @@ -124,7 +123,6 @@ macro_rules! int_impl { /// assert_eq!(i8::max_value(), 127); /// ``` #[stable(feature = "rust1", since = "1.0.0")] - #[rustc_const_unstable(feature = "const_max_value")] #[inline] pub const fn max_value() -> Self { !Self::min_value() @@ -1283,7 +1281,6 @@ macro_rules! uint_impl { /// assert_eq!(u8::min_value(), 0); /// ``` #[stable(feature = "rust1", since = "1.0.0")] - #[rustc_const_unstable(feature = "const_min_value")] #[inline] pub const fn min_value() -> Self { 0 } @@ -1295,7 +1292,6 @@ macro_rules! uint_impl { /// assert_eq!(u8::max_value(), 255); /// ``` #[stable(feature = "rust1", since = "1.0.0")] - #[rustc_const_unstable(feature = "const_max_value")] #[inline] pub const fn max_value() -> Self { !0 } diff --git a/src/libcore/ptr.rs b/src/libcore/ptr.rs index 126558e3025..0c2fcd082ef 100644 --- a/src/libcore/ptr.rs +++ b/src/libcore/ptr.rs @@ -74,7 +74,6 @@ pub unsafe fn drop_in_place<T: ?Sized>(to_drop: *mut T) { /// ``` #[inline] #[stable(feature = "rust1", since = "1.0.0")] -#[rustc_const_unstable(feature = "const_ptr_null")] pub const fn null<T>() -> *const T { 0 as *const T } /// Creates a null mutable raw pointer. @@ -89,7 +88,6 @@ pub const fn null<T>() -> *const T { 0 as *const T } /// ``` #[inline] #[stable(feature = "rust1", since = "1.0.0")] -#[rustc_const_unstable(feature = "const_ptr_null_mut")] pub const fn null_mut<T>() -> *mut T { 0 as *mut T } /// Swaps the values at two mutable locations of the same type, without @@ -2339,7 +2337,6 @@ impl<T: ?Sized> Unique<T> { /// /// `ptr` must be non-null. #[unstable(feature = "unique", issue = "27730")] - #[rustc_const_unstable(feature = "const_unique_new")] pub const unsafe fn new_unchecked(ptr: *mut T) -> Self { Unique { pointer: NonZero::new_unchecked(ptr), _marker: PhantomData } } @@ -2474,7 +2471,6 @@ impl<T: ?Sized> Shared<T> { /// /// `ptr` must be non-null. #[unstable(feature = "shared", issue = "27730")] - #[rustc_const_unstable(feature = "const_shared_new")] pub const unsafe fn new_unchecked(ptr: *mut T) -> Self { Shared { pointer: NonZero::new_unchecked(ptr), _marker: PhantomData } } diff --git a/src/libcore/sync/atomic.rs b/src/libcore/sync/atomic.rs index b7cf6d778a2..2cabadebfb7 100644 --- a/src/libcore/sync/atomic.rs +++ b/src/libcore/sync/atomic.rs @@ -243,7 +243,6 @@ impl AtomicBool { /// ``` #[inline] #[stable(feature = "rust1", since = "1.0.0")] - #[rustc_const_unstable(feature = "const_atomic_bool_new")] pub const fn new(v: bool) -> AtomicBool { AtomicBool { v: UnsafeCell::new(v as u8) } } @@ -657,7 +656,6 @@ impl<T> AtomicPtr<T> { /// ``` #[inline] #[stable(feature = "rust1", since = "1.0.0")] - #[rustc_const_unstable(feature = "const_atomic_ptr_new")] pub const fn new(p: *mut T) -> AtomicPtr<T> { AtomicPtr { p: UnsafeCell::new(p) } } @@ -936,7 +934,7 @@ impl<T> From<*mut T> for AtomicPtr<T> { #[cfg(target_has_atomic = "ptr")] macro_rules! atomic_int { - ($stable:meta, $const_unstable:meta, + ($stable:meta, $stable_cxchg:meta, $stable_debug:meta, $stable_access:meta, @@ -1005,7 +1003,6 @@ macro_rules! atomic_int { /// ``` #[inline] #[$stable] - #[$const_unstable] pub const fn new(v: $int_type) -> Self { $atomic_type {v: UnsafeCell::new(v)} } @@ -1369,7 +1366,6 @@ macro_rules! atomic_int { #[cfg(target_has_atomic = "8")] atomic_int! { unstable(feature = "integer_atomics", issue = "32976"), - rustc_const_unstable(feature = "const_atomic_i8_new"), unstable(feature = "integer_atomics", issue = "32976"), unstable(feature = "integer_atomics", issue = "32976"), unstable(feature = "integer_atomics", issue = "32976"), @@ -1379,7 +1375,6 @@ atomic_int! { #[cfg(target_has_atomic = "8")] atomic_int! { unstable(feature = "integer_atomics", issue = "32976"), - rustc_const_unstable(feature = "const_atomic_u8_new"), unstable(feature = "integer_atomics", issue = "32976"), unstable(feature = "integer_atomics", issue = "32976"), unstable(feature = "integer_atomics", issue = "32976"), @@ -1389,7 +1384,6 @@ atomic_int! { #[cfg(target_has_atomic = "16")] atomic_int! { unstable(feature = "integer_atomics", issue = "32976"), - rustc_const_unstable(feature = "const_atomic_i16_new"), unstable(feature = "integer_atomics", issue = "32976"), unstable(feature = "integer_atomics", issue = "32976"), unstable(feature = "integer_atomics", issue = "32976"), @@ -1399,7 +1393,6 @@ atomic_int! { #[cfg(target_has_atomic = "16")] atomic_int! { unstable(feature = "integer_atomics", issue = "32976"), - rustc_const_unstable(feature = "const_atomic_u16_new"), unstable(feature = "integer_atomics", issue = "32976"), unstable(feature = "integer_atomics", issue = "32976"), unstable(feature = "integer_atomics", issue = "32976"), @@ -1409,7 +1402,6 @@ atomic_int! { #[cfg(target_has_atomic = "32")] atomic_int! { unstable(feature = "integer_atomics", issue = "32976"), - rustc_const_unstable(feature = "const_atomic_i32_new"), unstable(feature = "integer_atomics", issue = "32976"), unstable(feature = "integer_atomics", issue = "32976"), unstable(feature = "integer_atomics", issue = "32976"), @@ -1419,7 +1411,6 @@ atomic_int! { #[cfg(target_has_atomic = "32")] atomic_int! { unstable(feature = "integer_atomics", issue = "32976"), - rustc_const_unstable(feature = "const_atomic_u32_new"), unstable(feature = "integer_atomics", issue = "32976"), unstable(feature = "integer_atomics", issue = "32976"), unstable(feature = "integer_atomics", issue = "32976"), @@ -1429,7 +1420,6 @@ atomic_int! { #[cfg(target_has_atomic = "64")] atomic_int! { unstable(feature = "integer_atomics", issue = "32976"), - rustc_const_unstable(feature = "const_atomic_i64_new"), unstable(feature = "integer_atomics", issue = "32976"), unstable(feature = "integer_atomics", issue = "32976"), unstable(feature = "integer_atomics", issue = "32976"), @@ -1439,7 +1429,6 @@ atomic_int! { #[cfg(target_has_atomic = "64")] atomic_int! { unstable(feature = "integer_atomics", issue = "32976"), - rustc_const_unstable(feature = "const_atomic_u64_new"), unstable(feature = "integer_atomics", issue = "32976"), unstable(feature = "integer_atomics", issue = "32976"), unstable(feature = "integer_atomics", issue = "32976"), @@ -1449,7 +1438,6 @@ atomic_int! { #[cfg(target_has_atomic = "ptr")] atomic_int!{ stable(feature = "rust1", since = "1.0.0"), - rustc_const_unstable(feature = "const_atomic_isize_new"), stable(feature = "extended_compare_and_swap", since = "1.10.0"), stable(feature = "atomic_debug", since = "1.3.0"), stable(feature = "atomic_access", since = "1.15.0"), @@ -1459,7 +1447,6 @@ atomic_int!{ #[cfg(target_has_atomic = "ptr")] atomic_int!{ stable(feature = "rust1", since = "1.0.0"), - rustc_const_unstable(feature = "const_atomic_usize_new"), stable(feature = "extended_compare_and_swap", since = "1.10.0"), stable(feature = "atomic_debug", since = "1.3.0"), stable(feature = "atomic_access", since = "1.15.0"), diff --git a/src/libcore/tests/lib.rs b/src/libcore/tests/lib.rs index e2283a71a0a..0e445cdac35 100644 --- a/src/libcore/tests/lib.rs +++ b/src/libcore/tests/lib.rs @@ -42,10 +42,6 @@ #![feature(try_trait)] #![feature(unique)] -#![feature(const_atomic_bool_new)] -#![feature(const_atomic_usize_new)] -#![feature(const_atomic_isize_new)] - extern crate core; extern crate test; |
