]> git.lizzy.rs Git - rust.git/commitdiff
change #![feature(const_fn)] to specific gates
authorAlex Burka <alex@alexburka.com>
Fri, 8 Sep 2017 18:26:54 +0000 (18:26 +0000)
committerAlex Burka <alex@alexburka.com>
Sat, 16 Sep 2017 15:53:02 +0000 (15:53 +0000)
50 files changed:
src/libcore/cell.rs
src/libcore/lib.rs
src/libcore/mem.rs
src/libcore/nonzero.rs
src/libcore/num/mod.rs
src/libcore/ptr.rs
src/libcore/sync/atomic.rs
src/libcore/tests/lib.rs
src/librustc/lib.rs
src/librustc_apfloat/lib.rs
src/librustc_const_eval/lib.rs
src/librustc_const_math/lib.rs
src/librustc_mir/diagnostics.rs
src/librustc_trans/lib.rs
src/librustc_trans_utils/lib.rs
src/libstd/lib.rs
src/libstd/sync/once.rs
src/test/compile-fail-fulldeps/dropck_tarena_cycle_checked.rs
src/test/compile-fail/const-call.rs
src/test/compile-fail/const-fn-stability-calls.rs [deleted file]
src/test/compile-fail/dropck_trait_cycle_checked.rs
src/test/compile-fail/functional-struct-update-respects-privacy.rs
src/test/compile-fail/issue-17718-const-borrow.rs
src/test/compile-fail/issue-43733-2.rs
src/test/compile-fail/issue-7364.rs
src/test/debuginfo/constant-debug-locs.rs
src/test/run-pass-valgrind/cast-enum-with-dtor.rs
src/test/run-pass/associated-types-project-from-type-param-via-bound-in-where-clause.rs
src/test/run-pass/auxiliary/const_fn_lib.rs
src/test/run-pass/auxiliary/issue-17718-aux.rs
src/test/run-pass/auxiliary/thread-local-extern-static.rs
src/test/run-pass/box-of-array-of-drop-1.rs
src/test/run-pass/box-of-array-of-drop-2.rs
src/test/run-pass/const-fn-cross-crate.rs [deleted file]
src/test/run-pass/const-fn-stability-calls.rs [new file with mode: 0644]
src/test/run-pass/const-size_of-align_of.rs
src/test/run-pass/issue-17718-static-unsafe-interior.rs
src/test/run-pass/issue-17718.rs
src/test/run-pass/issue-21486.rs
src/test/run-pass/issue-26655.rs
src/test/run-pass/issue-27997.rs
src/test/run-pass/nested-vec-3.rs
src/test/run-pass/panic-handler-chain.rs
src/test/run-pass/panic-handler-set-twice.rs
src/test/run-pass/struct-order-of-eval-3.rs
src/test/run-pass/struct-order-of-eval-4.rs
src/test/run-pass/vector-sort-panic-safe.rs
src/test/ui/span/dropck_arr_cycle_checked.rs
src/test/ui/span/dropck_vec_cycle_checked.rs
src/test/ui/span/vec-must-not-hide-type-from-dropck.rs

index e0a3b8d52f40efb5df9180a1b741928196675fed..b9c5ff10f87b976670101468f2ed7fac070b6482 100644 (file)
@@ -329,6 +329,7 @@ impl<T> Cell<T> {
     /// let c = Cell::new(5);
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
+    #[cfg_attr(not(stage0), rustc_const_unstable(feature = "const_cell_new"))]
     #[inline]
     pub const fn new(value: T) -> Cell<T> {
         Cell {
@@ -543,6 +544,7 @@ impl<T> RefCell<T> {
     /// let c = RefCell::new(5);
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
+    #[cfg_attr(not(stage0), rustc_const_unstable(feature = "const_refcell_new"))]
     #[inline]
     pub const fn new(value: T) -> RefCell<T> {
         RefCell {
@@ -1188,6 +1190,7 @@ impl<T> UnsafeCell<T> {
     /// let uc = UnsafeCell::new(5);
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
+    #[cfg_attr(not(stage0), rustc_const_unstable(feature = "const_unsafe_cell_new"))]
     #[inline]
     pub const fn new(value: T) -> UnsafeCell<T> {
         UnsafeCell { value: value }
index c270c6ae0dbad23944db36f3d19ff8ecc2b885e2..69612bd2a32a4e838d103ff829bc65c05c6b7ff2 100644 (file)
 #![feature(prelude_import)]
 #![feature(repr_simd, platform_intrinsics)]
 #![feature(rustc_attrs)]
+#![cfg_attr(not(stage0), feature(rustc_const_unstable))]
 #![feature(specialization)]
 #![feature(staged_api)]
 #![feature(unboxed_closures)]
 #![feature(untagged_unions)]
 #![feature(unwind_attributes)]
 
+#![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::*;
index af2f876a2f35906010bad6e63e94c1d8c4ceeca6..7c82b00f2cf3835c20dd264657ca0826825ee6f7 100644 (file)
@@ -189,6 +189,7 @@ pub fn forget<T>(t: T) {
 /// ```
 #[inline]
 #[stable(feature = "rust1", since = "1.0.0")]
+#[cfg_attr(not(stage0), rustc_const_unstable(feature = "const_size_of"))]
 pub const fn size_of<T>() -> usize {
     unsafe { intrinsics::size_of::<T>() }
 }
@@ -280,6 +281,7 @@ pub fn min_align_of_val<T: ?Sized>(val: &T) -> usize {
 /// ```
 #[inline]
 #[stable(feature = "rust1", since = "1.0.0")]
+#[cfg_attr(not(stage0), rustc_const_unstable(feature = "const_align_of"))]
 pub const fn align_of<T>() -> usize {
     unsafe { intrinsics::min_align_of::<T>() }
 }
index 3ff1068b93763581de7f71133b75bd8194eb1ea6..f075d825f5d53f81f5f03bf8bf277c5596004fac 100644 (file)
@@ -68,6 +68,10 @@ fn is_zero(&self) -> bool {
 impl<T: Zeroable> NonZero<T> {
     /// Creates an instance of NonZero with the provided value.
     /// You must indeed ensure that the value is actually "non-zero".
+    #[unstable(feature = "nonzero",
+               reason = "needs an RFC to flesh out the design",
+               issue = "27730")]
+    #[cfg_attr(not(stage0), rustc_const_unstable(feature = "const_nonzero_new"))]
     #[inline]
     pub const unsafe fn new_unchecked(inner: T) -> Self {
         NonZero(inner)
index c5175287ccfa63cf5ff654583bb4ee454b7391c4..bf31deae7a62576330f198c04ee8f62cb973a4a7 100644 (file)
@@ -109,6 +109,7 @@ macro_rules! int_impl {
         /// assert_eq!(i8::min_value(), -128);
         /// ```
         #[stable(feature = "rust1", since = "1.0.0")]
+        #[cfg_attr(not(stage0), rustc_const_unstable(feature = "const_min_value"))]
         #[inline]
         pub const fn min_value() -> Self {
             !0 ^ ((!0 as $UnsignedT) >> 1) as Self
@@ -122,6 +123,7 @@ pub const fn min_value() -> Self {
         /// assert_eq!(i8::max_value(), 127);
         /// ```
         #[stable(feature = "rust1", since = "1.0.0")]
+        #[cfg_attr(not(stage0), rustc_const_unstable(feature = "const_max_value"))]
         #[inline]
         pub const fn max_value() -> Self {
             !Self::min_value()
@@ -1280,6 +1282,7 @@ macro_rules! uint_impl {
         /// assert_eq!(u8::min_value(), 0);
         /// ```
         #[stable(feature = "rust1", since = "1.0.0")]
+        #[cfg_attr(not(stage0), rustc_const_unstable(feature = "const_min_value"))]
         #[inline]
         pub const fn min_value() -> Self { 0 }
 
@@ -1291,6 +1294,7 @@ pub const fn min_value() -> Self { 0 }
         /// assert_eq!(u8::max_value(), 255);
         /// ```
         #[stable(feature = "rust1", since = "1.0.0")]
+        #[cfg_attr(not(stage0), rustc_const_unstable(feature = "const_max_value"))]
         #[inline]
         pub const fn max_value() -> Self { !0 }
 
index 2e42e0dfd550d3b04d5a67907f2807054e100c02..20aa881f4bc0d5537147c4ad3180e96dc2463b5e 100644 (file)
@@ -76,6 +76,7 @@ pub unsafe fn drop_in_place<T: ?Sized>(to_drop: *mut T) {
 /// ```
 #[inline]
 #[stable(feature = "rust1", since = "1.0.0")]
+#[cfg_attr(not(stage0), rustc_const_unstable(feature = "const_ptr_null"))]
 pub const fn null<T>() -> *const T { 0 as *const T }
 
 /// Creates a null mutable raw pointer.
@@ -90,6 +91,7 @@ pub const fn null<T>() -> *const T { 0 as *const T }
 /// ```
 #[inline]
 #[stable(feature = "rust1", since = "1.0.0")]
+#[cfg_attr(not(stage0), 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
@@ -1097,6 +1099,8 @@ impl<T: ?Sized> Unique<T> {
     /// # Safety
     ///
     /// `ptr` must be non-null.
+    #[unstable(feature = "unique", issue = "27730")]
+    #[cfg_attr(not(stage0), 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 }
     }
@@ -1230,6 +1234,8 @@ impl<T: ?Sized> Shared<T> {
     /// # Safety
     ///
     /// `ptr` must be non-null.
+    #[unstable(feature = "shared", issue = "27730")]
+    #[cfg_attr(not(stage0), 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 }
     }
index 510e01db0e965ed190343d11552ce3343ad52b0f..09f3586a8c99fa96d37881a8540c5304f92eec65 100644 (file)
@@ -241,6 +241,7 @@ impl AtomicBool {
     /// ```
     #[inline]
     #[stable(feature = "rust1", since = "1.0.0")]
+    #[cfg_attr(not(stage0), rustc_const_unstable(feature = "const_atomic_bool_new"))]
     pub const fn new(v: bool) -> AtomicBool {
         AtomicBool { v: UnsafeCell::new(v as u8) }
     }
@@ -649,6 +650,7 @@ impl<T> AtomicPtr<T> {
     /// ```
     #[inline]
     #[stable(feature = "rust1", since = "1.0.0")]
+    #[cfg_attr(not(stage0), rustc_const_unstable(feature = "const_atomic_ptr_new"))]
     pub const fn new(p: *mut T) -> AtomicPtr<T> {
         AtomicPtr { p: UnsafeCell::new(p) }
     }
@@ -920,7 +922,7 @@ pub fn compare_exchange_weak(&self,
 
 #[cfg(target_has_atomic = "ptr")]
 macro_rules! atomic_int {
-    ($stable:meta,
+    ($stable:meta, $const_unstable:meta,
      $stable_cxchg:meta,
      $stable_debug:meta,
      $stable_access:meta,
@@ -969,6 +971,7 @@ impl $atomic_type {
             /// ```
             #[inline]
             #[$stable]
+            #[cfg_attr(not(stage0), $const_unstable)]
             pub const fn new(v: $int_type) -> Self {
                 $atomic_type {v: UnsafeCell::new(v)}
             }
@@ -1332,6 +1335,7 @@ pub fn fetch_xor(&self, val: $int_type, order: Ordering) -> $int_type {
 #[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"),
@@ -1340,6 +1344,7 @@ pub fn fetch_xor(&self, val: $int_type, order: Ordering) -> $int_type {
 #[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"),
@@ -1348,6 +1353,7 @@ pub fn fetch_xor(&self, val: $int_type, order: Ordering) -> $int_type {
 #[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"),
@@ -1356,6 +1362,7 @@ pub fn fetch_xor(&self, val: $int_type, order: Ordering) -> $int_type {
 #[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"),
@@ -1364,6 +1371,7 @@ pub fn fetch_xor(&self, val: $int_type, order: Ordering) -> $int_type {
 #[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"),
@@ -1372,6 +1380,7 @@ pub fn fetch_xor(&self, val: $int_type, order: Ordering) -> $int_type {
 #[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"),
@@ -1380,6 +1389,7 @@ pub fn fetch_xor(&self, val: $int_type, order: Ordering) -> $int_type {
 #[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"),
@@ -1388,6 +1398,7 @@ pub fn fetch_xor(&self, val: $int_type, order: Ordering) -> $int_type {
 #[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"),
@@ -1396,6 +1407,7 @@ pub fn fetch_xor(&self, val: $int_type, order: Ordering) -> $int_type {
 #[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"),
@@ -1404,6 +1416,7 @@ pub fn fetch_xor(&self, val: $int_type, order: Ordering) -> $int_type {
 #[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"),
index ab2022b1824ca3a2e5f5b682731d53c52abb5a14..ce4d14b222cb2ff0a8d9f6534abf393484d3472d 100644 (file)
@@ -11,7 +11,6 @@
 #![deny(warnings)]
 
 #![feature(box_syntax)]
-#![feature(const_fn)]
 #![feature(core_float)]
 #![feature(core_private_bignum)]
 #![feature(core_private_diy_float)]
 #![feature(try_from)]
 #![feature(unique)]
 
+#![feature(const_atomic_bool_new)]
+#![feature(const_atomic_usize_new)]
+#![feature(const_atomic_isize_new)]
+
 extern crate core;
 extern crate test;
 extern crate rand;
index 82f01c36fee7f6960d6942bae39cd20b4402ee5c..df97f2fb8bcd62cfc2eef5923faf83584fce2cd4 100644 (file)
@@ -22,7 +22,6 @@
 #![feature(box_patterns)]
 #![feature(box_syntax)]
 #![feature(conservative_impl_trait)]
-#![feature(const_fn)]
 #![feature(core_intrinsics)]
 #![feature(i128_type)]
 #![cfg_attr(windows, feature(libc))]
@@ -36,6 +35,9 @@
 #![feature(trace_macros)]
 #![feature(test)]
 
+#![cfg_attr(stage0, feature(const_fn))]
+#![cfg_attr(not(stage0), feature(const_atomic_bool_new))]
+
 #![recursion_limit="256"]
 
 extern crate arena;
index d4a020657616a05c93cd023cc9a2708e3a0811f8..c13141008a42623fae4d1e577dd5e65f41cceb2e 100644 (file)
 #![deny(warnings)]
 #![forbid(unsafe_code)]
 
-#![feature(const_fn)]
 #![feature(i128_type)]
 #![feature(slice_patterns)]
 #![feature(try_from)]
 
+#![cfg_attr(stage0, feature(const_fn))]
+#![cfg_attr(not(stage0), feature(const_min_value))]
+#![cfg_attr(not(stage0), feature(const_max_value))]
+
 #[macro_use]
 extern crate rustc_bitflags;
 
index 9fedee80d46a8e748804199cc2b621075ed8b787..0c3606cab10e1f8a65cbbd6b448e794658c320f4 100644 (file)
 #![feature(slice_patterns)]
 #![feature(box_patterns)]
 #![feature(box_syntax)]
-#![feature(const_fn)]
 #![feature(i128_type)]
 
+#![cfg_attr(stage0, feature(const_fn))]
+#![cfg_attr(not(stage0), feature(const_min_value))]
+
 extern crate arena;
 #[macro_use] extern crate syntax;
 #[macro_use] extern crate log;
index 93b70ef8e4a5856a1e13a3f1529bd003373bae56..0533f10104a5a8b588204dd3b9b48641cf9e480a 100644 (file)
       html_root_url = "https://doc.rust-lang.org/nightly/")]
 #![deny(warnings)]
 
-#![feature(const_fn)]
 #![feature(i128)]
 #![feature(i128_type)]
 
+#![cfg_attr(stage0, feature(const_fn))]
+#![cfg_attr(not(stage0), feature(const_min_value))]
+#![cfg_attr(not(stage0), feature(const_max_value))]
+
 extern crate rustc_apfloat;
 
 extern crate syntax;
index 4b71a429f847a39c36d73e4679bbbb028be21658..26436d54ac88647b2697c50df164f337760ffb7b 100644 (file)
@@ -384,7 +384,7 @@ fn main() {
 You can also have this error while using a cell type:
 
 ```compile_fail,E0492
-#![feature(const_fn)]
+#![feature(const_cell_new)]
 
 use std::cell::Cell;
 
@@ -412,7 +412,7 @@ struct C { a: Cell<usize> }
 wrapper:
 
 ```
-#![feature(const_fn)]
+#![feature(const_cell_new)]
 
 use std::cell::Cell;
 use std::marker::Sync;
index 63fd37c2b98bf62816b9f61cf23cca78b02937f8..256200a6e9572f1d10144f1dadbedafe07f6b4c5 100644 (file)
@@ -21,7 +21,6 @@
 
 #![feature(box_patterns)]
 #![feature(box_syntax)]
-#![feature(const_fn)]
 #![feature(custom_attribute)]
 #![allow(unused_attributes)]
 #![feature(i128_type)]
 #![feature(slice_patterns)]
 #![feature(conservative_impl_trait)]
 
+#![cfg_attr(stage0, feature(const_fn))]
+#![cfg_attr(not(stage0), feature(const_atomic_bool_new))]
+#![cfg_attr(not(stage0), feature(const_once_new))]
+
 use rustc::dep_graph::WorkProduct;
 use syntax_pos::symbol::Symbol;
 
index 90e17906328fbabaa80b047598e614bfef825cca..5e8abe59ad9a474c801d49b600704974a7311a98 100644 (file)
@@ -19,7 +19,6 @@
 
 #![feature(box_patterns)]
 #![feature(box_syntax)]
-#![feature(const_fn)]
 #![feature(custom_attribute)]
 #![allow(unused_attributes)]
 #![feature(i128_type)]
@@ -28,6 +27,8 @@
 #![feature(slice_patterns)]
 #![feature(conservative_impl_trait)]
 
+#![cfg_attr(stage0, feature(const_fn))]
+
 extern crate rustc;
 extern crate syntax;
 extern crate syntax_pos;
index 33bf0d68126d4c43f2ba4b24cc5cabcb102ae54c..aa1337a9da050f9a6117bbe6b0ea2c51bf7b2055 100644 (file)
 #![feature(raw)]
 #![feature(repr_simd)]
 #![feature(rustc_attrs)]
+#![cfg_attr(not(stage0), feature(rustc_const_unstable))]
 #![feature(shared)]
 #![feature(sip_hash_13)]
 #![feature(slice_bytes)]
 #![feature(doc_cfg)]
 #![cfg_attr(test, feature(update_panic_count))]
 
+#![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(all(not(stage0), windows), feature(const_atomic_ptr_new))]
+#![cfg_attr(not(stage0), feature(const_unsafe_cell_new))]
+#![cfg_attr(not(stage0), feature(const_cell_new))]
+#![cfg_attr(not(stage0), feature(const_once_new))]
+#![cfg_attr(not(stage0), feature(const_ptr_null))]
+#![cfg_attr(not(stage0), feature(const_ptr_null_mut))]
+
 #![default_lib_allocator]
 
 // Always use alloc_system during stage0 since we don't know if the alloc_*
index 403685a4b8e0be9de12f829cd28171b53db39e15..015106fc2e598f637a72a341f1e39aaa70c094fc 100644 (file)
@@ -156,6 +156,7 @@ struct Finish {
 impl Once {
     /// Creates a new `Once` value.
     #[stable(feature = "once_new", since = "1.2.0")]
+    #[cfg_attr(not(stage0), rustc_const_unstable(feature = "const_once_new"))]
     pub const fn new() -> Once {
         Once {
             state: AtomicUsize::new(INCOMPLETE),
index 7de6e58c784d57ad7083ae25409c538ad740e8d4..fa85432fb8e3f571a27f98f4169cf043429c0fc5 100644 (file)
@@ -16,7 +16,8 @@
 //  which is a reduction of this code to more directly show the reason
 //  for the error message we see here.)
 
-#![feature(const_fn, rustc_private)]
+#![feature(rustc_private)]
+#![feature(const_atomic_usize_new)]
 
 extern crate arena;
 
index 0745ac02d0723e620e82856f217cf666e1a21175..18476494300b21febeca61fd40a4b3bf37af454e 100644 (file)
@@ -8,8 +8,6 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![feature(const_fn)]
-
 fn f(x: usize) -> usize {
     x
 }
diff --git a/src/test/compile-fail/const-fn-stability-calls.rs b/src/test/compile-fail/const-fn-stability-calls.rs
deleted file mode 100644 (file)
index 6090776..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// Test use of const fn from another crate without a feature gate.
-
-// aux-build:const_fn_lib.rs
-
-extern crate const_fn_lib;
-
-use const_fn_lib::foo;
-
-static FOO: usize = foo(); //~ ERROR const fns are an unstable feature
-const BAR: usize = foo(); //~ ERROR const fns are an unstable feature
-
-macro_rules! constant {
-    ($n:ident: $t:ty = $v:expr) => {
-        const $n: $t = $v;
-    }
-}
-
-constant! {
-    BAZ: usize = foo() //~ ERROR const fns are an unstable feature
-}
-
-fn main() {
-//    let x: [usize; foo()] = [];
-}
index e701718028a7a05349d952f07cb98270b091db4e..c0f0e3650d9fbaf136d4816ed818a40de2c8e886 100644 (file)
@@ -13,7 +13,7 @@
 //
 // (Compare against compile-fail/dropck_vec_cycle_checked.rs)
 
-#![feature(const_fn)]
+#![feature(const_atomic_usize_new)]
 
 use std::cell::Cell;
 use id::Id;
index d2df0d9ef270204834ffaf8f1d96c204292d30ec..3f41401eb69c12275b58d7968e2526f8bc0204d7 100644 (file)
@@ -10,8 +10,6 @@
 
 // RFC 736 (and Issue 21407): functional struct update should respect privacy.
 
-#![feature(const_fn)]
-
 // The `foo` module attempts to maintains an invariant that each `S`
 // has a unique `u64` id.
 use self::foo::S;
index 327b6946822987d1c0ed16ed71164a583e4b04eb..1464fcd9a1cd92b0235db76ef57651e1b7c603ac 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![feature(const_fn)]
+#![feature(const_unsafe_cell_new)]
 
 use std::cell::UnsafeCell;
 
index 0fd31454596e645ece7c87be14ea4a34f29f3518..1bf165c89d329dfd73aeb4ede06b69ec5c957204 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![feature(const_fn)]
+#![feature(const_fn, const_cell_new, const_unsafe_cell_new)]
 #![feature(cfg_target_thread_local, thread_local_internals)]
 
 // On platforms *without* `#[thread_local]`, use
index bd32317ae78086b3e709bd9a19a1859aed2f35b9..ef53be757800565b2fb1a07bfed7a3687b7ad75c 100644 (file)
@@ -8,9 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![feature(box_syntax)]
-#![feature(const_fn)]
-#![allow(warnings)]
+#![feature(box_syntax, const_refcell_new)]
 
 use std::cell::RefCell;
 
@@ -18,5 +16,6 @@
 static boxed: Box<RefCell<isize>> = box RefCell::new(0);
 //~^ ERROR allocations are not allowed in statics
 //~| ERROR `std::cell::RefCell<isize>: std::marker::Sync` is not satisfied
+//~| WARN unsupported constant expr
 
 fn main() { }
index 7b7bda302250fd8a30c62432d9a588567c320c11..7a24510b7d409cff2fcee302de0ce3049fd0c895 100644 (file)
@@ -15,7 +15,7 @@
 #![allow(dead_code, unused_variables)]
 #![feature(omit_gdb_pretty_printer_section)]
 #![omit_gdb_pretty_printer_section]
-#![feature(const_fn)]
+#![feature(const_unsafe_cell_new)]
 #![feature(static_mutex)]
 
 // This test makes sure that the compiler doesn't crash when trying to assign
index 2815863fe9961ed41a390abbd0dfc2be231b456b..439c1080f47311ca1d06e65cb484a487ea022bc4 100644 (file)
@@ -11,7 +11,7 @@
 // no-prefer-dynamic
 
 #![allow(dead_code)]
-#![feature(const_fn)]
+#![feature(const_atomic_usize_new)]
 
 // check dtor calling order when casting enums.
 
index 8dc7d79ec2a7772c5c6d4162cd767d94ac118a2f..7cde780cc54ba928a42154c0fe0507f1be25f525 100644 (file)
@@ -12,7 +12,7 @@
 // `Item` originates in a where-clause, not the declaration of
 // `T`. Issue #20300.
 
-#![feature(const_fn)]
+#![feature(const_atomic_usize_new)]
 
 use std::marker::{PhantomData};
 use std::sync::atomic::{AtomicUsize};
index b0d5a6b12727b16225778adc037b0943931a7cc2..be06e8dd5700b19e383e01ec50c36204e4b449b7 100644 (file)
@@ -13,4 +13,4 @@
 #![crate_type="rlib"]
 #![feature(const_fn)]
 
-pub const fn foo() -> usize { 22 } //~ ERROR const fn is unstable
+pub const fn foo() -> usize { 22 }
index cf7fdd7f983f0e545d1851629925d84459fa0c4d..36891a1ecadb87362408b17b3a3cbe2634e6ea0c 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![feature(const_fn)]
+#![feature(const_atomic_usize_new)]
 
 use std::sync::atomic;
 
index e9457886be80d890a5e8287823777ab2508e1ed9..bce87ef5a2668ddf89da2984b65c81d464feec3a 100644 (file)
@@ -9,6 +9,7 @@
 // except according to those terms.
 
 #![feature(cfg_target_thread_local, const_fn, thread_local)]
+#![feature(const_cell_new)]
 #![crate_type = "lib"]
 
 #[cfg(target_thread_local)]
index a63a232e1b5be8e09ee2cbf1434554662d2f89d8..47b44863a74758227aea9eb1417e0327367b16dc 100644 (file)
@@ -13,7 +13,7 @@
 
 // ignore-emscripten no threads support
 
-#![feature(const_fn)]
+#![feature(const_atomic_usize_new)]
 
 use std::thread;
 use std::sync::atomic::{AtomicUsize, Ordering};
index ca17942917281329f9fa745760e845f3749a3f3a..54be4955baf5bddb11400ac471bcccaf3c80267d 100644 (file)
@@ -13,7 +13,7 @@
 
 // ignore-emscripten no threads support
 
-#![feature(const_fn)]
+#![feature(const_atomic_usize_new)]
 
 use std::thread;
 use std::sync::atomic::{AtomicUsize, Ordering};
diff --git a/src/test/run-pass/const-fn-cross-crate.rs b/src/test/run-pass/const-fn-cross-crate.rs
deleted file mode 100644 (file)
index 7b4b751..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// aux-build:const_fn_lib.rs
-
-// A very basic test of const fn functionality.
-
-#![feature(const_fn)]
-
-extern crate const_fn_lib;
-
-use const_fn_lib::foo;
-
-const FOO: usize = foo();
-
-fn main() {
-    assert_eq!(FOO, 22);
-    let _: [i32; foo()] = [42; 22];
-}
diff --git a/src/test/run-pass/const-fn-stability-calls.rs b/src/test/run-pass/const-fn-stability-calls.rs
new file mode 100644 (file)
index 0000000..c5f97d5
--- /dev/null
@@ -0,0 +1,34 @@
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// Test use of const fn from another crate without a feature gate.
+
+// aux-build:const_fn_lib.rs
+
+extern crate const_fn_lib;
+
+use const_fn_lib::foo;
+
+static FOO: usize = foo();
+const BAR: usize = foo();
+
+macro_rules! constant {
+    ($n:ident: $t:ty = $v:expr) => {
+        const $n: $t = $v;
+    }
+}
+
+constant! {
+    BAZ: usize = foo()
+}
+
+fn main() {
+    let x: [usize; foo()] = [42; foo()];
+}
index 06fbe9bf4f63958372c055f193e81dd09fe87a97..d5547ea5add0016aa9930b1e5491384c7d8267f8 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![feature(const_fn)]
+#![feature(const_fn, const_size_of, const_align_of)]
 
 use std::mem;
 
index 993e5e1c1e6e90f0eaa8f0f96f79de320ae0634c..66f70cdaeb08b65138e1d41872f1dbec2d40005b 100644 (file)
@@ -11,8 +11,7 @@
 // pretty-expanded FIXME #23616
 
 #![feature(core)]
-#![feature(const_fn)]
-
+#![feature(const_unsafe_cell_new)]
 
 use std::marker;
 use std::cell::UnsafeCell;
index 744e63f159b6566dc17ceb4187399bf043e2f495..1b8fbc1ad2f5c5f6b0df46c75a708e8417a43061 100644 (file)
@@ -12,7 +12,7 @@
 
 
 #![feature(core)]
-#![feature(const_fn)]
+#![feature(const_atomic_usize_new)]
 
 extern crate issue_17718_aux as other;
 
index 699189a4e6aedd88657acc9e56aedbb1b121e14e..23d06c4324da6ac065cb239c71e5cef932670aa8 100644 (file)
@@ -12,7 +12,7 @@
 // created via FRU and control-flow breaks in the middle of
 // construction.
 
-#![feature(const_fn)]
+#![feature(const_atomic_usize_new)]
 
 use std::sync::atomic::{Ordering, AtomicUsize};
 
index 402460e7253d31b8c5b5f057792bbce232d67c58..3e252b8629e12af728be3563f1498be2797a6cdd 100644 (file)
 
 // ignore-emscripten no threads support
 
-#![feature(const_fn)]
-
 // Check that the destructors of simple enums are run on unwinding
 
+#![feature(const_atomic_usize_new)]
+
 use std::sync::atomic::{Ordering, AtomicUsize};
 use std::thread;
 
index cd81f68969377d60d8a794a3866d208e5565daca..dab42e48e164522ce6a4ff686869ee123614e0a3 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![feature(const_fn)]
+#![feature(const_atomic_usize_new)]
 
 use std::sync::atomic::{Ordering, AtomicUsize};
 
index 458b6c16e62a776a8234c77013accf9a13a34c0f..9141b5f29ceb9000608083d60330b78c6bdf20a6 100644 (file)
@@ -14,7 +14,7 @@
 // the contents implement Drop and we hit a panic in the middle of
 // construction.
 
-#![feature(const_fn)]
+#![feature(const_atomic_usize_new)]
 
 use std::thread;
 use std::sync::atomic::{AtomicUsize, Ordering};
index 1ad43f5f17fb9b483fa35750524535b78a38f518..c5dc8ccd2eeaf9a3c6207e52f2cc4a3a6fc97a03 100644 (file)
@@ -10,7 +10,8 @@
 
 // ignore-emscripten no threads support
 
-#![feature(panic_handler, const_fn, std_panic)]
+#![feature(panic_handler, std_panic)]
+#![feature(const_atomic_usize_new)]
 
 use std::sync::atomic::{AtomicUsize, Ordering};
 use std::panic;
index 196e08a63a7f0fafecb1ac889681a7398e5264a7..8bf2683cd9feb0a3fc119db2012d8c8e57849f9a 100644 (file)
@@ -7,7 +7,8 @@
 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
-#![feature(panic_handler, const_fn, std_panic)]
+#![feature(panic_handler, std_panic)]
+#![feature(const_atomic_usize_new)]
 
 // ignore-emscripten no threads support
 
index b67eb205396b29cff30bdf088bc3877469b2c534..cf93133d205939c5b28aa835bc56fc50488616fc 100644 (file)
@@ -11,7 +11,7 @@
 // Checks that functional-record-update order-of-eval is as expected
 // even when no Drop-implementations are involved.
 
-#![feature(const_fn)]
+#![feature(const_atomic_usize_new)]
 
 use std::sync::atomic::{Ordering, AtomicUsize};
 
index 20d27d8b309bbb9c35795c129ffa4d61c906d7de..d442923478f1faed7243a3bb56de8ce3970bbdd2 100644 (file)
@@ -11,7 +11,7 @@
 // Checks that struct-literal expression order-of-eval is as expected
 // even when no Drop-implementations are involved.
 
-#![feature(const_fn)]
+#![feature(const_atomic_usize_new)]
 
 use std::sync::atomic::{Ordering, AtomicUsize};
 
index 4387a43f03b6a952026e5c3fb953cfac26b33f5d..c6a1859de30b8c9df6e1f4f12c3007ef437c6e00 100644 (file)
@@ -10,9 +10,9 @@
 
 // ignore-emscripten no threads support
 
-#![feature(const_fn)]
 #![feature(rand)]
 #![feature(sort_unstable)]
+#![feature(const_atomic_usize_new)]
 
 use std::__rand::{thread_rng, Rng};
 use std::cell::Cell;
index 8e8b3c24c76b083c62a4c4ffa7ef11730bf222bd..995a198271c11f10b6e983b6501d010edc4f7467 100644 (file)
@@ -13,7 +13,7 @@
 //
 // (Compare against compile-fail/dropck_vec_cycle_checked.rs)
 
-#![feature(const_fn)]
+#![feature(const_atomic_usize_new)]
 
 use std::cell::Cell;
 use id::Id;
index 65db2a56b7d819a2d8c0e9312430bea8167d1198..5bcaa71f73c294f56ccff246999026988d1d0fa2 100644 (file)
@@ -12,7 +12,7 @@
 //
 // (Compare against compile-fail/dropck_arr_cycle_checked.rs)
 
-#![feature(const_fn)]
+#![feature(const_atomic_usize_new)]
 
 use std::cell::Cell;
 use id::Id;
index 310ab20489a35b84ea2eb6b6f238a4791da77a04..d99f3bb19dbad6bba56befb803c0654221f675bc 100644 (file)
@@ -23,7 +23,7 @@
 // conditions above to be satisfied, meaning that if the dropck is
 // sound, it should reject this code.
 
-#![feature(const_fn)]
+#![feature(const_atomic_usize_new)]
 
 use std::cell::Cell;
 use id::Id;