Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stabilize const-calling existing const-fns in std #46287

Merged
merged 1 commit into from
Nov 29, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions src/libcore/cell.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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 }
Expand Down
34 changes: 0 additions & 34 deletions src/libcore/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::*;
Expand Down
2 changes: 0 additions & 2 deletions src/libcore/mem.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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>() }
}
Expand Down Expand Up @@ -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>() }
}
Expand Down
1 change: 0 additions & 1 deletion src/libcore/nonzero.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 0 additions & 4 deletions src/libcore/num/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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()
Expand Down Expand Up @@ -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 }

Expand All @@ -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 }

Expand Down
4 changes: 0 additions & 4 deletions src/libcore/ptr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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
Expand Down Expand Up @@ -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 }
}
Expand Down Expand Up @@ -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 }
}
Expand Down
15 changes: 1 addition & 14 deletions src/libcore/sync/atomic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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) }
}
Expand Down Expand Up @@ -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) }
}
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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)}
}
Expand Down Expand Up @@ -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"),
Expand All @@ -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"),
Expand All @@ -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"),
Expand All @@ -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"),
Expand All @@ -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"),
Expand All @@ -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"),
Expand All @@ -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"),
Expand All @@ -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"),
Expand All @@ -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"),
Expand All @@ -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"),
Expand Down
4 changes: 0 additions & 4 deletions src/libcore/tests/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
1 change: 0 additions & 1 deletion src/librustc/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@
#![feature(underscore_lifetimes)]
#![feature(trace_macros)]
#![feature(test)]
#![feature(const_atomic_bool_new)]

#![recursion_limit="512"]

Expand Down
2 changes: 0 additions & 2 deletions src/librustc_apfloat/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@
#![deny(warnings)]
#![forbid(unsafe_code)]

#![feature(const_max_value)]
#![feature(const_min_value)]
#![feature(i128_type)]
#![feature(slice_patterns)]
#![feature(try_from)]
Expand Down
2 changes: 0 additions & 2 deletions src/librustc_const_eval/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@
#![feature(box_syntax)]
#![feature(i128_type)]

#![feature(const_min_value)]

extern crate arena;
#[macro_use] extern crate syntax;
#[macro_use] extern crate log;
Expand Down
3 changes: 0 additions & 3 deletions src/librustc_const_math/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@
#![feature(i128)]
#![feature(i128_type)]

#![feature(const_min_value)]
#![feature(const_max_value)]

extern crate rustc_apfloat;

extern crate syntax;
Expand Down
4 changes: 0 additions & 4 deletions src/librustc_mir/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -770,8 +770,6 @@ static B: &'static AtomicUsize = &A; // ok!
You can also have this error while using a cell type:

```compile_fail,E0492
#![feature(const_cell_new)]

use std::cell::Cell;

const A: Cell<usize> = Cell::new(1);
Expand All @@ -798,8 +796,6 @@ However, if you still wish to use these types, you can achieve this by an unsafe
wrapper:

```
#![feature(const_cell_new)]

use std::cell::Cell;
use std::marker::Sync;

Expand Down
3 changes: 0 additions & 3 deletions src/librustc_trans/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,6 @@
#![feature(slice_patterns)]
#![feature(conservative_impl_trait)]

#![feature(const_atomic_bool_new)]
#![feature(const_once_new)]

use rustc::dep_graph::WorkProduct;
use syntax_pos::symbol::Symbol;

Expand Down
11 changes: 0 additions & 11 deletions src/libstd/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -256,15 +256,6 @@
#![feature(collections_range)]
#![feature(compiler_builtins_lib)]
#![feature(const_fn)]
#![feature(const_max_value)]
#![feature(const_atomic_bool_new)]
#![feature(const_atomic_isize_new)]
#![feature(const_atomic_usize_new)]
#![feature(const_unsafe_cell_new)]
#![feature(const_cell_new)]
#![feature(const_once_new)]
#![feature(const_ptr_null)]
#![feature(const_ptr_null_mut)]
#![feature(core_float)]
#![feature(core_intrinsics)]
#![feature(dropck_eyepatch)]
Expand Down Expand Up @@ -306,7 +297,6 @@
#![feature(repr_align)]
#![feature(repr_simd)]
#![feature(rustc_attrs)]
#![feature(rustc_const_unstable)]
#![feature(shared)]
#![feature(sip_hash_13)]
#![feature(slice_bytes)]
Expand All @@ -331,7 +321,6 @@
#![feature(doc_masked)]
#![feature(doc_spotlight)]
#![cfg_attr(test, feature(update_panic_count))]
#![cfg_attr(windows, feature(const_atomic_ptr_new))]
#![cfg_attr(windows, feature(used))]

#![default_lib_allocator]
Expand Down
1 change: 0 additions & 1 deletion src/libstd/sync/once.rs
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,6 @@ struct Finish {
impl Once {
/// Creates a new `Once` value.
#[stable(feature = "once_new", since = "1.2.0")]
#[rustc_const_unstable(feature = "const_once_new")]
pub const fn new() -> Once {
Once {
state: AtomicUsize::new(INCOMPLETE),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
// for the error message we see here.)

#![feature(rustc_private)]
#![feature(const_atomic_usize_new)]

extern crate arena;

Expand Down
Loading